接近能够让个人用户从 NEAR 的前端部署他们自己的智能合约,但我遇到了一个错误。首先,代码:
const account = await near.account('polluterofminds.testnet');
const res = await axios.get("/api/contract");
const contractRaw = res.data;
const uint8 = new Uint8Array(Buffer.from(contractRaw))
const result = await account.deployContract(uint8);
console.log(result);
执行此操作时,我收到以下错误:Error: The transaction contains more then one action, but it was signed with an access key which allows transaction to apply only one specific action. To apply more then one actions TX must be signed with a full access key
不知道如何解决这个问题。据我所知我的polluterofminds.testnet
帐户具有完整的访问 key ,并且我已使用该帐户登录。有人成功做到这一点吗?
最佳答案
在这里,来自不久前创建的一个示例,该示例演示了将契约(Contract)部署到用户帐户作为通信协议(protocol)的一部分
https://github.com/metanear/metanear-web/blob/master/src/Home.js#L96
更新
(解决对此答案的评论)
@JustinHunter 有两种访问 key :FullAccess
这使您可以使用所有 8 个支持的操作和 FunctionCall
签署交易。仅允许您使用一种类型签署交易的访问 key ,FunctionCall
行动。
你可以在这里看到更多关于事务和操作、键等的信息:
以及此视频中有关此限制的一些相关词语:
https://youtu.be/ZM7TCONx9BI?t=2127
关于javascript - 如何让用户在前端部署 NEAR 协议(protocol)智能合约?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67777745/