Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustomSigner #33

Open
5bngr opened this issue Apr 26, 2022 · 0 comments
Open

CustomSigner #33

5bngr opened this issue Apr 26, 2022 · 0 comments

Comments

@5bngr
Copy link

5bngr commented Apr 26, 2022

Hi,
I'm trying to implement a CustomSigner as per example provided in the docs and get the following error:
error_msg: 'unauthorized: signature verification failed; please verify account number (xxxxx) and chain-id (columbus-5): unauthorized'
Everything else seems to be working, as long as I don't try to use a CustomSigner.

  • I can instantiate an account object
  • I can instantiate an AnchorEarn object using account object above
  • I can check balance on account
  • I can send from account to another wallet (using built in signer)

Any help would be greatly appreciated.
Thanks!

// vars
const terraWalltAddrTest = '...' //address of test wallet I'm using to test anchor earn api
const kucointerraWalletAddr = '...' //terra deposit address on kucoin.
const kucoinmemo = '...' //required memo ID for deposits to kucoin terra address
const sendAmnt = 1 //sending 1 UST to kucoin address.

// CustomSigner Code:
const testWalletSigner = async (tx) => {
const anchoracct = new anchor.MnemonicKey({
mnemonic: '...',
});

const terra = new LCDClient({
URL: 'https://lcd.terra.dev',
chainId: 'columbus-5',
});

const wallet = terra.wallet(anchoracct);

return await wallet.createAndSignTx({
msgs: tx,
// gasAdjustment: 2,
// gasPrices: { uusd: 0.15 },
memo: kucoinmemo,
});
};

// Instantiate Anchor Object:
const anchorEarn = new anchor.AnchorEarn({
chain: anchor.CHAINS.TERRA,
network: anchor.NETWORKS.COLUMBUS_5,
address: terraWalltAddrTest,
});

// Anchor Send Code:
const sendUst = await anchorEarn.send({
currency: anchor.DENOMS.UST,
recipient: kucointerraWalletAddr,
amount: sendAmnt,
log: (data) => {
console.log(data);
},
customSigner: testWalletSigner,
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant