This repository has been archived by the owner on May 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core-sdk examples for collections (#265)
* core-sdk examples for collections * linting issue * Linter fixes --------- Co-authored-by: Praveen Suluvai <[email protected]> Co-authored-by: coreyneal-immutable <[email protected]>
- Loading branch information
1 parent
a3e492d
commit 9666eb9
Showing
5 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { | ||
Config, | ||
ImmutableX, | ||
CollectionsApiListCollectionFiltersRequest, | ||
} from '@imtbl/core-sdk'; | ||
|
||
(async () => { | ||
try { | ||
// IMX class client | ||
const client = new ImmutableX(Config.PRODUCTION); | ||
|
||
const collectionListFiltersRequest: CollectionsApiListCollectionFiltersRequest = | ||
{ | ||
pageSize: 200, // max size 200 | ||
address: '', // collection address | ||
nextPageToken: '', // cursor | ||
}; | ||
|
||
const collectionListFiltersResponse = await client.listCollectionFilters( | ||
collectionListFiltersRequest, | ||
); | ||
|
||
console.log( | ||
'collectionListFiltersResponse', | ||
JSON.stringify(collectionListFiltersResponse, null, 4), | ||
); | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { | ||
Config, | ||
ImmutableX, | ||
CollectionsApiListCollectionsRequest, | ||
} from '@imtbl/core-sdk'; | ||
|
||
(async () => { | ||
try { | ||
// IMX class client | ||
const client = new ImmutableX(Config.SANDBOX); | ||
|
||
const collectionListRequest: CollectionsApiListCollectionsRequest = { | ||
pageSize: 200, | ||
orderBy: 'name', //'name' | 'address' | 'project_id' | 'created_at' | 'updated_at' | ||
direction: 'asc', // asc | desc | ||
blacklist: '', // list of collections to be excluded seperated by comma | ||
whitelist: '', // list of collections to be included seperated by comma | ||
keyword: '', // word to search for in description and collection name | ||
cursor: '', // cursor | ||
}; | ||
|
||
const collectionListResponse = await client.listCollections( | ||
collectionListRequest, | ||
); | ||
|
||
console.log( | ||
'collectionListResponse', | ||
JSON.stringify(collectionListResponse, null, 4), | ||
); | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Config, ImmutableX, UpdateCollectionRequest } from '@imtbl/core-sdk'; | ||
import { generateWalletConnection } from './libs/walletConnection'; | ||
|
||
(async () => { | ||
try { | ||
// IMX class client | ||
const client = new ImmutableX(Config.SANDBOX); | ||
|
||
const walletConnection = await generateWalletConnection('goerli'); | ||
|
||
const collectionAddress = ''; // collection address | ||
|
||
const collectionUpdateRequest: UpdateCollectionRequest = { | ||
collection_image_url: '', // must be valid url or request will fail | ||
description: '', // string | ||
icon_url: '', // must be valid url or request will fail | ||
metadata_api_url: '', // must be valid url or request will fail | ||
name: '', // string | ||
}; | ||
|
||
const collectionUpdateResponse = await client.updateCollection( | ||
walletConnection.ethSigner, | ||
collectionAddress, | ||
collectionUpdateRequest, | ||
); | ||
|
||
console.log( | ||
'collectionUpdateResponse', | ||
JSON.stringify(collectionUpdateResponse, null, 4), | ||
); | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
})(); |