-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orchestration API: add support for NFTs #33
Comments
Open Questions
|
Maybe we can take a look at how classDiagram
nft --> nft-kit
orchestration --> nft-kit
class nft
nft: -classesPeg Map
nft: +pegRemote(nftClass)
nft: +getIssuerKit(nftClassId) {brand, issuer}
class orchestration
orchestration: + provideICQConnection() icqConnection
orchestration: + makeAccount() account
class nft-kit
nft-kit: +getBalance(ownerAddr) int
nft-kit: +getNFTs(brand, ownerAddr) NFT []
nft-kit: +getNFT(brand, id) NFT
nft-kit: +getClass(brand) Class
nft-kit: +send(ica, receiverAddr, brand, id)
I thought we were going to extend |
Is there a specific reason we're not working on https://github.com/agoric-labs/orchestration-api-spec ? Are we sure the |
Yes, that's correct. The diagram was not updated accordingly (will do it today).
As you can see from that repo, it |
To build the updated Orchestration API spec, checkout to the branch jorge/orchestration-x/nft. Then run: yarn install && yarn build
cd packages/orchestration
yarn typedoc
open docs/index.html For more detail, see updates implemented on commit f7470aa. Note: required to update packages/cosmic-proto/dist/helpers.d.ts file |
Ref: #33 Note: update /packages/cosmic-proto/dist/helpers.d.ts to the following: export declare const toRequestQueryJson: (msg: QueryBalanceRequestProtoMsg | QueryNFTsRequestProtoMsg, opts?: RequestQueryOpts) => JsonSafe<RequestQuery>;
Ref: #33 Note: required to update packages/cosmic-proto/dist/helpers.d.ts file ` toRequestQueryJson: (msg: QueryBalanceRequestProtoMsg | QueryNFTsRequestProtoMsg, ...`
Objective
Extend the Agoric-sdk to support the
NFT
cosmos module while taking advantage of the AgoricOrchestration
package.Tasks
cosmos.nft.v1beta1
packagex/nft
moduleAvailable Documentation
x/bank
modulex/nft
modulecosmos.nft.v1beta1
Relevant Agoric issues:
Relevant Agoric PR:
Relevant Agoric tests:
Agoric implementation of
cosmos.nft.v1beta1
Similar to the protobuf spec of the
cosmos.bank.v1beta1
package from thex/bank
module, the current version of the agoric-sdk also the has the protobuf spec of thecosmos.nft.v1beta1
package from thex/nft
moduleagoric-sdk/packages/cosmic-proto/proto/cosmos/nft/v1beta1
Although, for the
x/nft
module there is NO implementation found on the application level, as we can confirm by the lack of this module on thecodegen/cosmos/
directoryagoric-sdk/packages/cosmic-proto/src/codegen/cosmos
Structure of ERTP representation
When we query an NFT class, the response expected will be an
QueryClassResponse
, with the following structure:When we query an NFT, the response expected will be an
QueryNFTResponse
, with the following structure:We should be able to convert the structure above into an ERTP asset, that can be interacted with via the ERTP API.
This conversion should be done via a method similar to asAmount .
Each NFT will be described via an
Amount
, which has aBrand
andValue
.Based on the
QueryNFTResponse
structure, it seems a possible approach would be to define:Handle remote NFT class and map with issuerKit
Usually, a
Brand
as a relationship of 1 - 1 withIssuer
andMint
.Considering that the Assets we will interact with are created via a contract held on a
host chain
, it seem to me that it is not expected to have theMint
representation on thecontroller chain
.Although, for the
Issuer
the same may not be true, since the issuer has a relevant purpose, we can then rely on them as the authority to validate an Payment of that BrandQuestion:How could we get a representation of an Issuer for this specific Brand?
One possible approach is based on the pattern implemented on the pegasus package, more specifically the
pegRemote
method.The diagram bellow represent an high level view of how an issuer could be associated with a NFT class issued on the host chain.
Question: How should we record the
Class data
?Two possible solutions that crossed my mind are:
DisplayInfo
parameter when callingmakeIssuerKit
Question: how to handle ERTP Data Types such as
AssetKind
?Based on the NFT class data, how can we infer if it should be declared as COPY_SET or COPY_BAG?
Plan exo kit for features related to the
x/nft
moduleBased on the approach described above, the first step before interacting with a remote NFT is to create and register a local representation of NFT Class in the shape of an ERTP asset.
That Class should then be mapped with an Issuer and Brand in a
durable storage
.Additionally, an
NftKit
should be created and imported by theOrchestrationKit
, which would expose the required methods to:How to make a local representation of the remote NFT Class on Agoric chain
Two different approaches are being discussed:
addAsset
of the vat-bank.jspegRemote
of the pegasus.jsThe representation bellow follows the same approach as the vat-bank handles new assets.
One remaining question is in what Vat should the NftManager live? Would it make sense in the long term to include it in the Orchestration-Vat?
The text was updated successfully, but these errors were encountered: