如何获取徽章的讨论地址

发布于 2025-02-01 09:14:23 字数 1047 浏览 2 评论 0原文

我正在尝试基于Scrypto SmartContract构建拍卖Web应用程序。

我有一个寄存器函数返回徽章,我可以从中构建证据以调用其他需要身份验证的方法。

要建立证据,我需要徽章的地址;使用PTE-SDK,这将如何可能?

我使用:

 const manifestRegistration = new ManifestBuilder()
    //call the register function
    .callMethod(auction.auctionId, "register", [])
    //deposit the resource into my account
    .callMethodWithAllResources(accountAddress, "deposit_batch")
    .build()
    .toString()

    const receiptRegistration = await signTransaction(manifestRegistration);
    console.log(receiptRegistrationt)

这是收据:

{
    "transactionHash": "b737899a3b78692d2ba49d83ccedeacd66f6168d107a2962828d621d6c73cb37",
    "status": "Success",
    "outputs": [
        "{\"type\":\"Bucket\",\"value\":\"Bucket(1027u32)\"}",
        "{\"type\":\"Unit\"}"
    ],
    "logs": [],
    "newPackages": [],
    "newComponents": [],
    "newResources": []
}

我怎么知道返回的存储桶中的资源是什么?

谢谢

I'm trying to build an Auction web application based on a scrypto smartcontract.

I have a register function that return a badge, from which I can build proof to call other methods that need authentication.

To build the proof, I need the address of the badge; using the pte-sdk, how would that be possible ?

I use :

 const manifestRegistration = new ManifestBuilder()
    //call the register function
    .callMethod(auction.auctionId, "register", [])
    //deposit the resource into my account
    .callMethodWithAllResources(accountAddress, "deposit_batch")
    .build()
    .toString()

    const receiptRegistration = await signTransaction(manifestRegistration);
    console.log(receiptRegistrationt)

here is receipt :

{
    "transactionHash": "b737899a3b78692d2ba49d83ccedeacd66f6168d107a2962828d621d6c73cb37",
    "status": "Success",
    "outputs": [
        "{\"type\":\"Bucket\",\"value\":\"Bucket(1027u32)\"}",
        "{\"type\":\"Unit\"}"
    ],
    "logs": [],
    "newPackages": [],
    "newComponents": [],
    "newResources": []
}

How do I know what is the resource in the returned bucket ?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱花落人离去 2025-02-08 09:14:23

弹出我解决此问题的第一件事是将地址返回,因为字符串

pub fn register() -> (Bucket, String) -> {
  ...
  (badge, badge.resource_address().to_string())
}

应该弹出outputs array

The first thing that pops into my head of solving this is returning the address as a string

pub fn register() -> (Bucket, String) -> {
  ...
  (badge, badge.resource_address().to_string())
}

This should pop up in the outputs array

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文