Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Learn how to connect Secret Network contracts to a frontend.
Secret.js a JavaScript SDK for writing applications that interact with the Secret Network blockchain. Key features include:
Written in TypeScript and provided with type definitions.
Provides simple abstractions over core data structures.
Supports every possible message and transaction type.
Exposes every possible query type.
Handles input/output encryption/decryption for Secret Contracts.
Works in Node.js, modern web browsers and React Native.
You can find the full version of the docs here.
Refer to the reference SecretJS Templates to review code implementations of SecretJS such as:
Connecting to Secret Network
Creating account using SecretJS
Query Secret Network
Submitting transactions
Using contracts
Wallets
SNIP-20 tokens
Consuming websocket contract events
See here for a fullstack dApp tutorial that uses SecretJS.
Learn how to do contract migration with SecretJS.
secretjs.tx.compute.migrateContract()
Migrate a contract's code while keeping the same address. Invokes the migrate()
function on the new code.
Input: MsgMigrateContractParams
See here for further docs on contract migration.
SecretJS usage examples.
Learn how to install and use SecretJS.
Learn how to integrate various web3 wallets with SecretJS.
Notes:
MetaMask supports mobile!
MetaMask supports Ledger.
Secretjs MetaMaskWallet
will automatically prompt the user to sign a personal_sign
message, which is used to recover the users public key and derive the user's Secret Network address.
You might want to pass encryptionSeed
to SecretNetworkClient.create()
to use the same encryption key for the user across sessions. This value should be a true random 32 byte number that is stored securly in your app, such that only the user can decrypt it. This can also be a sha256(user_password)
but might impair UX.
The recommended way of integrating Keplr is by using window.keplr.getOfflineSignerOnlyAmino()
:
Notes:
No mobile support yet.
Keplr supports Ledger.
By using encryptionUtils
you let Keplr handle user encryption keys for you, which allows you to easily decrypt transactions across sessions.
Links:
TLDR:
Although this is the legacy way of signing transactions on cosmos-sdk, it's still the most recommended for connecting to Keplr due to Ledger support & better UI on Keplr.
🟩 Looks good on Keplr
🟩 Supports users signing with Ledger
🟥 Doesn't support signing these transactions:
The new way of signing transactions on cosmos-sdk, it's more efficient but still doesn't have Ledger support, so it's most recommended for usage in apps that don't require signing transactions with Ledger.
🟥 Looks bad on Keplr
🟥 Doesn't support users signing with Ledger
🟩 Supports signing transactions with all types of Msgs