|
| 1 | +import { |
| 2 | + ImmutableX, |
| 3 | + Config, |
| 4 | + AssetsApiListAssetsRequest, |
| 5 | +} from '@imtbl/core-sdk'; |
| 6 | + |
| 7 | +(async () => { |
| 8 | + const imxClient = new ImmutableX(Config.SANDBOX); |
| 9 | + |
| 10 | + const assetParams: AssetsApiListAssetsRequest = { |
| 11 | + collection: '', // Collection contract address, |
| 12 | + name: '', // Name of the asset to search |
| 13 | + user: '', // Ethereum address of the user who owns these assets |
| 14 | + pageSize: 200, // Page size of the result |
| 15 | + auxiliaryFeePercentages: '', // Comma separated string of fee percentages that are to be paired with auxiliary_fee_recipients |
| 16 | + auxiliaryFeeRecipients: '', // Comma separated string of fee recipients that are to be paired with auxiliary_fee_percentages |
| 17 | + buyOrders: false, //Set flag to true to fetch an array of buy order details with accepted status associated with the asset |
| 18 | + cursor: '', // Cursor for pagination |
| 19 | + direction: '', // Direction to sort (asc/desc) |
| 20 | + includeFees: false, // Set flag to include fees associated with the asset |
| 21 | + metadata: '', // URL JSON-encoded metadata filters for these assets. Javascript example: encodeURI(JSON.stringify({'proto':['1147'],'quality':['Meteorite']})) |
| 22 | + orderBy: 'name', // Property to sort by | Allowed values: updated_at, name |
| 23 | + sellOrders: false, // Set flag to true to fetch an array of sell order details with accepted status associated with the asset |
| 24 | + status: 'imx', // Status of these assets | Allowed values: eth, imx, preparing_withdrawal, withdrawable, burned |
| 25 | + updatedMaxTimestamp: '', // Maximum timestamp for when these assets were last updated, in ISO 8601 UTC format. Example: '2022-05-27T00:10:22Z' |
| 26 | + updatedMinTimestamp: '', // Minimum timestamp for when these assets were last updated, in ISO 8601 UTC format. Example: '2022-05-27T00:10:22Z' |
| 27 | + }; |
| 28 | + |
| 29 | + try { |
| 30 | + const assetResponse = await imxClient.listAssets(assetParams); |
| 31 | + |
| 32 | + console.log('assetResponse', assetResponse); |
| 33 | + } catch (error) { |
| 34 | + console.error(error); |
| 35 | + process.exit(1); |
| 36 | + } |
| 37 | +})(); |
0 commit comments