Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit d042d97

Browse files
tanjiehuiJie Hui Tan
andauthored
Add get mint and list mints examples (#243)
Co-authored-by: Jie Hui Tan <[email protected]>
1 parent 4d2dc28 commit d042d97

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed

examples/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ Update [mint.ts](./mint.ts#L9) with your minting details then run
8686
yarn mint
8787
```
8888

89+
## List mints
90+
91+
Update [listMints.ts](./listMints.ts#L13) with your mint query details then run
92+
93+
```sh
94+
yarn list-mints
95+
```
96+
97+
## Get mint
98+
99+
Update [getMint.ts](./getMint.ts#L13) with your mint id then run
100+
101+
```sh
102+
yarn get-mint
103+
```
104+
89105
## Create order
90106

91107
Update [createOrder.ts](./createOrder.ts#L9) with your order details then run

examples/getMint.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Config, ImmutableX } from '@imtbl/core-sdk';
2+
import { generateWalletConnection } from './libs/walletConnection';
3+
4+
(async () => {
5+
try {
6+
const walletConnection = await generateWalletConnection('goerli');
7+
8+
// IMX class client
9+
const client = new ImmutableX(Config.SANDBOX);
10+
11+
// Get details of a mint with the mint ID (transaction_id returned from listMints)
12+
const getMintResponse = await client.getMint({
13+
id: ''
14+
});
15+
16+
console.log('getMintResponse', JSON.stringify(getMintResponse));
17+
} catch (err) {
18+
console.error(err);
19+
process.exit(1);
20+
}
21+
})();

examples/listMints.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { Config, ImmutableX } from '@imtbl/core-sdk';
2+
import { generateWalletConnection } from './libs/walletConnection';
3+
4+
(async () => {
5+
try {
6+
const walletConnection = await generateWalletConnection('goerli');
7+
8+
// IMX class client
9+
const client = new ImmutableX(Config.SANDBOX);
10+
11+
// Get a list of mints
12+
const listMintsResponse = await client.listMints({
13+
//pageSize: 100,
14+
//cursor: '',
15+
//orderBy: '',
16+
//direction: '',
17+
//user: '',
18+
//status: '',
19+
//minTimestamp: '',
20+
//maxTimestamp: '',
21+
//tokenType: '',
22+
//tokenId: '',
23+
//assetId: '',
24+
//tokenName: '',
25+
//tokenAddress: '',
26+
//minQuantity: '',
27+
//maxQuantity: '',
28+
//metadata: ''
29+
});
30+
31+
console.log('listMintsResponse', JSON.stringify(listMintsResponse));
32+
} catch (err) {
33+
console.error(err);
34+
process.exit(1);
35+
}
36+
})();

examples/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"create-project": "ts-node -r dotenv/config createProject.ts",
1717
"create-collection": "ts-node -r dotenv/config createCollection.ts",
1818
"mint": "ts-node -r dotenv/config mint.ts",
19+
"list-mints": "ts-node -r dotenv/config listMints.ts",
20+
"get-mint": "ts-node -r dotenv/config getMint.ts",
1921
"transfer-nfts": "ts-node -r dotenv/config transferNfts.ts",
2022
"transfer-eth": "ts-node -r dotenv/config transferEth.ts",
2123
"transfer-erc20": "ts-node -r dotenv/config transferErc20.ts"

0 commit comments

Comments
 (0)