Skip to content

Commit

Permalink
Rename token to digitalAsset and add digital asset built in tra…
Browse files Browse the repository at this point in the history
…nsaction generation functions (#222)

* add mint soul bound txn function

* add digital asset functions and rename to digital asset

* update changelog
  • Loading branch information
0xmaayan authored Dec 7, 2023
1 parent 36f38ff commit 5fddc0f
Show file tree
Hide file tree
Showing 6 changed files with 989 additions and 263 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to the Aptos TypeScript SDK will be captured in this file. T

- Add release automation, so version updates can be made with simply `pnpm update-version`
- Rename custom request header to `aptos-typescript-sdk`
- [`Breaking`] Rename `token` to `digitalAsset` and add digital asset built in transaction generation functions

## 0.0.8 (2023-11-29)

Expand Down
10 changes: 5 additions & 5 deletions examples/typescript-esm/simple_digital_asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const example = async () => {

console.log("\n=== Alice Mints the digital asset ===\n");

const mintTokenTransaction = await aptos.mintTokenTransaction({
const mintTokenTransaction = await aptos.mintDigitalAssetTransaction({
creator: alice,
collection: collectionName,
description: tokenDescription,
Expand All @@ -78,7 +78,7 @@ const example = async () => {
committedTxn = await aptos.signAndSubmitTransaction({ signer: alice, transaction: mintTokenTransaction });
pendingTxn = await aptos.waitForTransaction({ transactionHash: committedTxn.hash });

const alicesDigitalAsset = await aptos.getOwnedTokens({
const alicesDigitalAsset = await aptos.getOwnedDigitalAssets({
ownerAddress: alice.accountAddress,
minimumLedgerVersion: BigInt(pendingTxn.version),
});
Expand All @@ -88,21 +88,21 @@ const example = async () => {

console.log("\n=== Transfer the digital asset to Bob ===\n");

const transferTransaction = await aptos.transferDigitalAsset({
const transferTransaction = await aptos.transferDigitalAssetTransaction({
sender: alice,
digitalAssetAddress: alicesDigitalAsset[0].token_data_id,
recipient: bob.accountAddress,
});
committedTxn = await aptos.signAndSubmitTransaction({ signer: alice, transaction: transferTransaction });
pendingTxn = await aptos.waitForTransaction({ transactionHash: committedTxn.hash });

const alicesDigitalAssetsAfter = await aptos.getOwnedTokens({
const alicesDigitalAssetsAfter = await aptos.getOwnedDigitalAssets({
ownerAddress: alice.accountAddress,
minimumLedgerVersion: BigInt(pendingTxn.version),
});
console.log(`Alices's digital assets balance: ${alicesDigitalAssetsAfter.length}`);

const bobDigitalAssetsAfter = await aptos.getOwnedTokens({
const bobDigitalAssetsAfter = await aptos.getOwnedDigitalAssets({
ownerAddress: bob.accountAddress,
minimumLedgerVersion: BigInt(pendingTxn.version),
});
Expand Down
Loading

0 comments on commit 5fddc0f

Please sign in to comment.