Authentication Flow

Create a temporary (or "session") wallet with your Ethereum Wallet to get access to your funds on Dexilon Chain

Create permissions for a temporary account - aka Authorization

Step 1: Create a temporary Wallet

const granteeWallet = await getRandomCosmosAddress();

await api.faucet(granteeWallet.address);

const granteeClient = new DexilonClient(granteeWallet.wallet, api, config);
await granteeClient.init();

Step 2: Create a web3 Wallet instance

To create an ECDSA signature with your Ethereum Wallet, you need to create an instance of it in the code:

const ethNetwork = 80001; // Polygon mumbai is used as L1 for Dexilon Testnet 
const etherWallet = ethWalletFromMnemonic("<your ether mnemonic here>");
const ethAddress = etherWallet.address;

Step 3: Create an ECDSA signature with your Ethereum Wallet

const dataStructure = ['string'];
const timestamp = Math.floor((new Date().getTime() + 3 * 60 * 1000) / 1000.0);
const signedMessage = `${timestamp}#${granteeWallet.address}`;
const granterSinature = await getSignature(etherWallet, [signedMessage], dataStructure);

Step 4: Send a Grant Permission transaction to Dexilon

Here you can see an example of grantee account creation and giving it the grants to control the fund of your primary account

After that you can use the granteeClient to control you funds on Dexilon using the methods of the SDK

Next steps

Sending Dexilon Transactions

Last updated