Interact with Wallet
EVM Wallet
Sign Message
import { FSLAuthorization } from 'fsl-js-sdk';
//Univeral login initialization
fSLAuthorization
.callEvmSign({
chainId: 137,
msg: 'Your Sign Message',
})
.then((res) => {
console.log('signedTx', res);
const address = FSLAuthorization.evmVerifyMessage('Your Sign Message', res);
// Check whether the resolved address is the same as the user address
});
Types
interface IEvmSign {
msg: string;
rpc?: string;
chainId: number;
}
Sign transaction
import { FSLAuthorization } from 'fsl-authorization';
import { ethers } from 'ethers';
// Univeral login initialization
fSLAuthorization
.callEvmContract({
contractAddress: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F',
methodName: 'transfer',
params: ['0x...', ethers.BigNumber.from(Math.floor(10 * Math.pow(10, 6)))],
abi: [
{
constant: false,
inputs: [
{ name: '_to', type: 'address' },
{ name: '_value', type: 'uint256' },
],
name: 'transfer',
outputs: [{ name: '', type: 'bool' }],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
},
],
gasLimit: '100000',
to: '0x...',
chainId: 137,
})
.then((res) => {
console.log('TransactionReceipt', res);
});
Types
interface IEvmContract {
contractAddress: string;
methodName: string;
chainId: number;
abi?: any; // If the abi is not recognized, you can pass it in manually
value?: string;
amount?: string; // The number of tokens displayed on the page
gasLimit?: string;
params?: any[];
to?: string;
rpc?: string;
nonce?: number;
maxPriorityFeePerGasValue?: ethers.BigNumber;
maxFeePerGasValue?: ethers.BigNumber;
}
Last updated