首页
欢迎来到Move社区论坛
新文章
- Sui 赞助交易-基本集成示例文章Oct 31, 2023
传统上,使用去中心化应用程序(dApps)的用户面临着一个共同的障碍:汽油费. 就我们而言,这些 Sui 汽油费是在区块链上执行交易所必需的,通常会阻止新用户完全拥抱Web3的潜力. 但是,Sui创新的赞助交易功能消除了这一障碍,使开发者能够为其应用程序交易支付汽油费. 这种革命性的功能为无缝的用户体验铺平了道路,鼓励分散式应用程序的更广泛采用. -themoveDev GitHub; -SuiQL GitHub 存储库; 如果你有任何问题,可以问他们 这里. 赞助交易工作流程 Sui 的赞助交易工作流程是一个精心策划的流程,可确保最终用户顺利进行无汽油费的交易. 以下是所涉步骤的明细. 用户启动操作 该过程在用户初始化GasLessTransactionData交易时启动,这表明他们打算在 dApp 中执行特定操作. dApp 创建 Sui 交易区块 赞助交易工作流程的核心是dApp创建交易区块的能力. 该块封装了所有必要的数据,包括用户的意图、要执行的操作以及任何关联的参数. 的传输 GasLessTransactionData 将GasLessTransactionData发送给发起人,即赞助交易框架的关键参与者,并附上签名请求. 这些数据是即将进行的交易的基础. 验证和交易数据构建 发起人验证收到的交易和结构TransactionData,包括必要的汽油费. 此步骤可确保交易获得适当的资金,以便在Sui区块链上执行. 交易签名 发起人签TransactionData署,表示他们批准并承诺进行交易. 此签名所需的私钥安全地存储在 AWS Secrets Manager 中,从而确保了最大的安全性. 用户的验证和双重签名 签名的TransactionData内容以及赞助商的签名将发回给用户. 用户验证交易细节并TransactionData再次签名,从而创建准备执行的双签名交易. 在 Sui 上执行交易 双重签名的交易通过Sui节点(全节点)或发起人提交给Sui网络. Sui处理交易,在DApp中执行指定的操作,所有这些都不需要用户支付任何汽油费. 用户通知 最后,dApp 会通知用户该交易已获得赞助和发送. 实施 Sui 赞助的交易:开发者的视角 为了实现赞助交易,开发人员使用 sui-sign-sponsored-transactionLambda 函数与 Sui API 或赞助交易 API 进行交互. 以下是促进此过程的客户端代码一览: const response = await fetch('http://localhost:5000/blockchain/sui-sign-sponsored-transaction', { method: 'POST', headers: { Accept: 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ sender: wallet.address, module: libName, action, arguments: data, }), }); const sponsorSignedTransaction = await response.json(); const transactionBlock = TransactionBlock.from(sponsorSignedTransaction?.transactionBlockBytes); const senderSignedTransaction = await wallet.signTransactionBlock({ transactionBlock, }); const executeResponse = await provider.executeTransactionBlock({ transactionBlock: sponsorSignedTransaction?.transactionBlockBytes, signature: [sponsorSignedTransaction?.signatureBytes, senderSignedTransaction.signature], options: { showEffects: true }, requestType: 'WaitForLocalExecution', }); 该客户端代码充当用户、赞助商和Sui区块链之间的桥梁,可无缝执行无汽油费交易. 结论 Sui 的赞助交易功能代表了去中心化应用程序世界的模式转变,为用户消除了重要的进入壁垒. 通过对这一创新功能的探索,我们获得了宝贵的见解,这些见解塑造了我们构建用户友好型 dApp 的方法. 随意 这里 留下你的问题.
0 - Sui Move 事件监听器和网络挂钩-基本集成示例文章Oct 31, 2023
对于企业和开发人员而言,与Sui这样的连锁店整合为创新和创建变革性解决方案提供了难得的机会. 在本系列中,我们将深入探讨我们在Sui基础上构建的旅程,阐明集成的复杂性,重点关注事件侦听器和网络挂钩,它们一直是Peeranha开发的Sui索引GraphQL事件API的ThemoveDev和SuiQL不可或缺的组成部分. -themoveDev GitHub; -SuiQL GitHub 存储库; 如果你有任何问题,可以问他们 这里. 该代码在 TypeScript ��实现,并使用无服务器技术在 AWS 云环境中运行. 无服务器 用于部署. 无服务器离线 用于在本地运行代码. Sui 事件监听器和 Webhook:简要概述 区块链网络本质上是去中心化的,这使得实时数据集成成为一项具有挑战性的壮举. 这就是事件监听器和网络挂钩发挥作用的地方. 事件监听器是持续监控区块链活动、识别和捕获感兴趣的特定事件的机制. 另一方面,Webhooks是由这些事件触发的 HTTP 回调,允许不同应用程序之间的无缝通信. Sui 集成架构 我们与 Sui 的整合之旅涉及一个由多个关键组件组成的综合架构. 事件监听器 事件监听器是一项强大的 ECS Fargate 任务,在我们的集成设置中起着关键作用. 它不断轮询来自Sui节点(Sui全节点)的新事件,确保我们的系统与最新的区块链活动保持同步. Sui 事件监听器队列 事件侦听器识别的事件将添加到Sui 侦听器队列(一个 FIFO SQS 队列)中. 该队列充当中间存储,可实现高效的事件处理和管理. Webhook 调用器 Webhook 调用器是一个 Lambda 函数,负责调用 webhook,可确保我们的系统和外部应用程序之间的无缝通信. 它充当桥梁,便于将事件数据传输到指定端点. 事件桥 事件桥是我们架构的关键组成部分,每当有新项目添加到Sui侦听器队列时,它都会调用Webhook调用器Lambda. 这种实时触发机制可确保及时调用 webhook. Webhook Webhook作为 AWS Lambda 函数实现,用于处理从 Sui 区块链接收到的单个事件. 该组件在解释事件数据和根据事件类型执行特定操作方面起着至关重要的作用. 工作流程:这一切是如何融合在一起的 了解工作流程对于掌握我们集成架构的无缝操作至关重要. 事件监听器操作 -事件监听器连续循环运行,调用 RPC API suix_queryEvents以检索与已配置的软件包 ID 关联的新事件. -事件监听器在 DynamoDB 中保留游标值,确保它按时间顺序读取事件. 向 Sui 监听器队列添加事件 -每当事件监听器发现新事件时,它都会将它们添加到 Sui 侦听器队列中以进行进一步处理. 事件桥触发器 -AWS 事件桥监控 Sui 侦听器队列,并在添加新项目后立即触发 Webhook 调用器 Lambda. 这确保了实时事件处理. 调用 Webhook -Webhook 调用器一旦触发,就会为队列中存在的每个事件调用 Webhook Lambda 函数. 在本地运行-开发游乐场 -无服务器离线插件用于在本地运行解决方案. 监听器在云端的 ECS 任务中运行. ECS 不适用于无服务器离线. 出于这个原因,取消注释 serverless.yml sui-events-listener中的 lambda 函数. 此函数将每分钟从区块链读取一次新事件. -安装依赖项: npm install -安装 DynamoDB: npm run dynamodb:install 如果您Error getting DynamoDb local latest tar.gz location undefined: 403在此步骤中遇到错误,则表示无服务器 dynamodb-local 中仍然存在已知问题. 此处 对此进行了讨论,或者你可以在 Sui Move 问答 上留下你的问题. -输入node_modules/dynamodb-localhost/dynamodb/config.json URL to https://s3.us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz(将 s 添加到http); -node_modules/dynamodb-localhost/dynamodb/installer.j 改http为https; -要启动服务,请运行: npm run dev 将事件侦听器部署到 AWS 安装 AWS CLI; 配置 AWS CLI; aws configure 修改stages\test.yml和中的值stages\prod.yml; 开始部署; npm run deploy:test 要么 npm run deploy:prod 待续... 在我们关于Sui集成系列的第一部分中,我们探讨了事件监听器和网络挂钩的基本概念,揭示了我们与Sui区块链集成背后的复杂架构. 请继续关注即将到来的部分,我们将更深入地了解我们的旅程,分享见解、挑战和塑造我们体验的创新解决方案. 随意 这里 留下你的问题.
1
帖子
98- 专家问答hohm40Feb 17, 2025
How to fix 'UnusedValueWithoutDrop' error in PTB function?
I'm trying to create a contract interaction function similar to a given transaction hash but face an error during execution. The error message is UnusedValueWithoutDrop { result_idx: 0, secondary_idx: 0 }. It appears in the dry run result of the PTB function. I suspect it might be due to an object not being properly handled by the end of the transaction. I attempted to use MoveCall, but I'm not sure if my approach is correct. Can someone advise me on correctly handling this issue?
- Move CLI
- Move
11 - 专家问答mssoni30Feb 17, 2025
How to resolve CommandArgumentError with tx failed issue?
I've been trying to execute a transaction using the CommandArgumentError { arg_idx: 1, kind: InvalidBCSBytes } error. Here's the snippet I used: const tx = new Transaction(); const [newCoin] = tx.splitCoins( tx.object(coinObjectId), [1000] ); tx.transferObjects([newCoin], tx.pure.string(wallet.address || "")); tx.setGasBudget(750000); const result = await wallet.signAndExecuteTransaction({ transaction: tx, }); I've tried using tx.pure.u64 but it didn't help. Any solutions?
- Move CLI
11 - 专家问答doodee37Feb 17, 2025
How to properly pass BCS serialized struct parameters in Sui?
I've been trying to pass BCS serialized struct parameters to a move module in the Sui blockchain, but I'm hitting an InvalidUsageOfPureArg error. Can Sui handle BCS serialized struct parameters directly, or do I need to create a struct object first and pass it to the move module? How should I structure my code to achieve this?
- Move CLI
12 - 专家问答mssoni30Feb 17, 2025
How to call a function from another Move contract?
I've deployed a contract with an address 0x3df... and a public function 'coll'. Now, I'm trying to write another contract that calls this 'coll' function, but I'm getting an error saying 'use 0x3df...::coll; use is invalid. Unbound module'. I've seen suggestions about using a dependencies file but I'm not sure how to implement this properly. What steps should I take to resolve the error and successfully call the function?
- Move CLI
- Move
12 - 专家问答Feb 14, 2025
How to call `public fun`s from Sui framework using CLI?
Hey folks, I'm trying to call public functions from the Sui framework using the Sui CLI. For instance, if someone transfers an object to me and I don't want it, how can I freeze it? I thought about using sui client call, but I'm having trouble with the module identifier. Is publishing a wrapper package the only way, or is there a CLI command I'm missing?
- Move CLI
- Move
02 - 讨论Theoremus162Feb 14, 2025
我可以通过 Move 中的地址访问对象吗?
我正在使用Move编程语言,我很好奇是否有任何方法可以直接使用其地址访问对象. 我知道在某些语言中你可以操作指针或引用,但我不确定在 Move 中如何或是否可能. 有任何想法吗?
- Move CLI
01 - 讨论andreweth.106Feb 13, 2025
如何使用 JavaScript 代码发布软件包?
我一直想知道我是否可以直接从我的JavaScript代码中发布一个软件包. 我听说过使用 tx.publish 来做这件事. 有人能解释它的工作原理或提供任何指导链接吗?
- Move Bug
12 - 专家问答farshad122Feb 13, 2025
How to handle function signature changes in SUI Move Package
I'm working on a SUI Move package and encountered an error when I tried to change a function signature. The error message is 'PackageUpgradeError { upgrade_error: IncompatibleUpgrade }'. How can I upgrade the package with the new function signature without causing errors?
- Move CLI
01 - 讨论Aliabee15Feb 13, 2025
如何检查钱包在售货亭中是否拥有NFT?
大家好,我想弄清楚如何验证一个特定的钱包地址是否拥有存储在售货亭中的特定 NFT 集合中的 NFT. 从我读到的内容来看,当 NFT 存放在自助服务终端时,这并不简单. 有人有进行此验证的技巧或方法吗?
- Move Prover
01 - 专家问答Feb 13, 2025
Can I assign a specific ID to a shared object in Move?
I'm trying to create a shared object within the init function of a Move module and want to assign it a specific predetermined ID like 0x123. Is this possible, or do I need to follow another approach?
- Move CLI
11
- 174
- 162
- 160
- 134
- 130
- 122
- 110
- 110
- 106
- 100
- Move CLI
- Move
- Move Bug
- Move Module
- Smart Contract
- Move Script
- Move Prover
- Feature Request