DEV Community

AJTECH0001
AJTECH0001

Posted on

Aptosで最初のNFTを作成する (Developers Guide)

このチュートリアルでは、Aptos ブロックチェーン上で非混合資産を作成および転送する方法について説明します。

このチュートリアルでは、TypeScript SDKを使用しています。

Git クローン https://github.com/AJTECH0001/AptosNft.git
cd aptos-ts-sdk
pnpm install
pnpm build

Typescript ESM サンプル ディレクトリに移動する:

cd examples/typescript-esm

必要な依存性をインストールし、それを構築する:

pnpm install
pnpm build

TypeScript simple_digital_asset を起動する

pnpm run simple_digital_asset

あなたのコードはこんな感じで

`=== Addresses ===

Alice's address is: 0x770dbeb6101056eac5a19de9a73ad72fac512e0de909e7bcb13a9d9241d1d162

=== Create the collection ===

Alice's collection: {
"collection_id": "0x23ece6c35415f5c5a720dc4de2820cabece0a6f1768095db479f657ad2c05753",
"collection_name": "Example Collection",
"creator_address": "0x770dbeb6101056eac5a19de9a73ad72fac512e0de909e7bcb13a9d9241d1d162",
"current_supply": 0,
"description": "Example description.",
"last_transaction_timestamp": "2023-11-29T21:26:03.204874",
"last_transaction_version": 8001101,
"max_supply": 18446744073709552000,
"mutable_description": true,
"mutable_uri": true,
"table_handle_v1": null,
"token_standard": "v2",
"total_minted_v2": 0,
"uri": "aptos.dev"
}

=== Alice Mints the digital asset ===

Alice's digital assets balance: 1
Alice's digital asset: {
"token_standard": "v2",
"token_properties_mutated_v1": null,
"token_data_id": "0x9f4460e29a66b4e41cef1671767dc8a5e8c52a2291e36f84b8596e0d1205fd8c",
"table_type_v1": null,
"storage_id": "0x9f4460e29a66b4e41cef1671767dc8a5e8c52a2291e36f84b8596e0d1205fd8c",
"property_version_v1": 0,
"owner_address": "0x770dbeb6101056eac5a19de9a73ad72fac512e0de909e7bcb13a9d9241d1d162",
"last_transaction_version": 8001117,
"last_transaction_timestamp": "2023-11-29T21:26:04.521624",
"is_soulbound_v2": false,
"is_fungible_v2": false,
"amount": 1,
"current_token_data": {
"collection_id": "0x23ece6c35415f5c5a720dc4de2820cabece0a6f1768095db479f657ad2c05753",
"description": "Example asset description.",
"is_fungible_v2": false,
"largest_property_version_v1": null,
"last_transaction_timestamp": "2023-11-29T21:26:04.521624",
"last_transaction_version": 8001117,
"maximum": null,
"supply": 0,
"token_data_id": "0x9f4460e29a66b4e41cef1671767dc8a5e8c52a2291e36f84b8596e0d1205fd8c",
"token_name": "Example Asset",
"token_properties": {},
"token_standard": "v2",
"token_uri": "aptos.dev/asset",
"current_collection": {
"collection_id": "0x23ece6c35415f5c5a720dc4de2820cabece0a6f1768095db479f657ad2c05753",
"collection_name": "Example Collection",
"creator_address": "0x770dbeb6101056eac5a19de9a73ad72fac512e0de909e7bcb13a9d9241d1d162",
"current_supply": 1,
"description": "Example description.",
"last_transaction_timestamp": "2023-11-29T21:26:04.521624",
"last_transaction_version": 8001117,
"max_supply": 18446744073709552000,
"mutable_description": true,
"mutable_uri": true,
"table_handle_v1": null,
"token_standard": "v2",
"total_minted_v2": 1,
"uri": "aptos.dev"
}
}
}

=== Transfer the digital asset to Bob ===

Alice's digital assets balance: 0
Bob's digital assets balance: 1`

コードを理解する:

アドレス:トランザクションの送信と受信に使用されるAptosブロックチェーン上のユーザーアカウントを表します。

Collection Data:以下を含むコレクションの詳細を定義します。
collection_id: コレクションのユニークな識別子。
collection_name: コレクションの読みやすい名前。
creator_address: コレクションを作成したアカウントのアドレス。
current_supply: コレクション内の暗号化されたデジタル資産の現在の数。
説明:コレクションのオプションの説明。
last_transaction_timestamp: 収集を含む最後の取引のタイムスタンプ。
last_transaction_version: 収集を含む最後の取引のバージョン番号。
max_supply: コレクションで許容されるデジタル資産の最大数 (can be unlimited).
mutable_description: コレクションの説明を変更できるかどうかを示す旗。
mutable_uri: コレクションの URI を変更できるかどうかを示すフラグ。
table_handle_v1: (オプション) コレクションに関連付けられたカスタムテーブルの処理 (not used in this example).
token_standard: 使用されている NFT 標準のバージョン ("v2" in this case).
total_minted_v2 : v2 標準を使用してコレクション内の暗号化されたデジタル資産の合計数。
uri: URI は、コレクションのメタデータを指します。 (optional).
Digital Asset Data: 特定のデジタル資産の詳細をキャプチャします。
token_standard:使用されている NFT 標準のバージョン。
token_properties_mutated_v1: (オプション) V1 標準で修正された属性の配列 (not used here).
token_data_id:デジタルアセットのユニークな識別子。
table_type_v1: (オプション) アセットに関連付けられたカスタムテーブルの種類 (not used here).
storage_id: token_data_id. property_version_v1: 資産の属性のバージョン番号 (always 0 for newly minted assets).
owner_address:現在資産を所有しているアカウントのアドレス。
last_transaction_version は、資産を含む最後の取引のバージョン番号です。
last_transaction_timestamp: 資産を含む最後の取引のタイムスタンプ。
is_soulbound_v2: 資産が soulbound であるかどうかを示す旗 (non-transferrable).
is_fungible_v2: Flag indicating whether the asset is fungible. 資産が fungibleかどうかを示すフラグ (like currency).
金額:資産の単位数 (always 1 for non-fungible assets).
current_token_data: 資産そのものに関する情報を保有する統合データ構造: Nested data structure holding information about the asset itself:
collection_id: この資産が所属するコレクションを参照します。
説明:資産の任意の説明。
is_fungible_v2: は、トップレベルで is_ fungible_ v2 と同じです。
last_transaction_timestamp: トップレベルで last_ transaction_timeestamp と同じです。
last_transaction_version: トップレベルで last_Transaction_Version と同じです。
最大: (オプション) この資産タイプで許容される最大単位数。
供給:この資産タイプの引換された単位の合計数 (always 0 for newly minted assets).
token_data_id: は、トップレベルでトークン_data _id と同じです。

コードがどのように機能するかを理解できたので、次の章では、aptos でクライアントを初期化する方法を学びます。

Top comments (0)