【发布时间】:2022-07-20 18:13:32
【问题描述】:
我正在尝试使用 NextJS 中的 near-api-js 库在 2 个测试网钱包之间转移 NEAR 代币
运行账户的汇款功能,我收到以下错误
import { connect, keyStores } from \"near-api-js\";
export const NearConfig = async () => {
const config = {
networkId: \"testnet\",
keyStore: new keyStores.BrowserLocalStorageKeyStore(),
nodeUrl: \"https://rpc.testnet.near.org\",
walletUrl: \"https://wallet.testnet.near.org\",
helperUrl: \"https://helper.testnet.near.org\",
explorerUrl: \"https://explorer.testnet.near.org\",
};
return await connect(config);
};
setNear(await NearConfig());
const sendTokens = async () => {
try {
const account = await near.account(account_id);
await account.sendMoney(
\"itissandeep98.testnet\", // receiver account
\"100000000\" // amount in yoctoNEAR
);
} catch (error) {
console.log(error);
showAlert(error.message, \"error\");
}
};
在运行account.getAccessKeys(); 时,有完整的访问密钥和功能访问密钥可用,那么为什么我无法发送令牌?
此外,我不明白文档中的以下屏幕截图(https://docs.near.org/docs/develop/front-end/introduction);为什么不允许?
标签: next.js nearprotocol near-api-js