-
Notifications
You must be signed in to change notification settings - Fork 44
feat(sdk): add NFT actions in the JS Dash SDK #2444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pshenmic
wants to merge
51
commits into
v2.0-dev
Choose a base branch
from
feat/wasm-dpp-nft
base: v2.0-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 44 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
f9a5f04
feat(wasm-dpp): add transfer transition to documents batch wip
pshenmic 1d7159a
feat(js-dash-sk): add transfer to document broadcast
pshenmic 1d1a505
fix(dpp): add missing import
pshenmic ad94fa6
feat(js-dash-sdk): add transfer function wip
pshenmic f3b04f2
feat(js-sdk): implement working document transfers
pshenmic 7011e09
chore(js-sdk): cleanup
pshenmic 0197581
chore(js-sdk): cleanup
pshenmic 9abbd8f
chore(wasm-dpp): cleanup
pshenmic 5ddc68c
chore(js-sdk): cleanup
pshenmic 7411a01
chore(js-sdk): revert
pshenmic 79842cd
chore(js-sdk): cleanup
pshenmic 995918f
chore(js-sdk): cleanup
pshenmic 1c2d730
chore(js-sdk): cleanup
pshenmic d23c2d3
chore(js-sdk): update doc
pshenmic ee75036
chore(wasm-dpp): cleanup
pshenmic 63cf68e
feat(wasm-dpp): add nft operations
pshenmic d14e296
feat(js-sdk): add transfer def in Platform.ts
pshenmic 94b60a7
feat(js-dash-sdk): uncomment
pshenmic b4181be
feat(wasm-dpp): move nft create state transition from extended docume…
pshenmic f195f87
fix(js-dash-sdk): fix types
pshenmic a704629
fix(js-dash-sdk): finalize nft transitions
pshenmic 03204f3
fix(wasm-dpp): lint fix
pshenmic 5484b65
chore(wasm-dpp): remove unused
pshenmic e96b20a
feat(js-dash-sdk): add NFT state transitions docs
pshenmic 7cdf3c6
fix(wasm-dpp): lint fix
pshenmic 9471b11
fix(js-dash-sdk): doc fix
pshenmic 5cc1922
fix(wasm-dpp): feature error
pshenmic db2cc9a
fix(wasm-dpp): lint fix
pshenmic 322a3e3
feat(wasm-dpp): implement document transition params
pshenmic 8831379
feat(wasm-dpp): fix cargo lint
pshenmic 8438237
chore(sdk): fix audit
pshenmic 134f86d
fix(rs-dpp): fmt lint fix
pshenmic e17ddda
fix(rs-dpp): clippy
pshenmic 0e207f7
fix(rs-dpp): fmt check
pshenmic 5704573
fix(rs-dpp): fix test
pshenmic 50b2a39
chore(sdk): cleanup
pshenmic 3b91adf
fix(wasm-dpp): fix unit test
pshenmic de035d5
fix(wasm-dpp): get back clone
pshenmic c225f9f
fix(rs-drive-abci): fix tests
pshenmic a579bd5
fix(rs-drive-abci): fix formatting
pshenmic 4ac03e1
fix(js-dash-sdk): fix test
pshenmic f19a9a4
fix(js-dash-sdk): fix broadcast condition
pshenmic 857a446
fix(platform-test-suite): fix e2e tests
pshenmic ae66fd2
Merge branch 'refs/heads/v2.0-dev' into feat/wasm-dpp-nft
pshenmic 5fc6eb4
fix(wasm-dpp): merge fixes
pshenmic 05b6f66
fix(rs-dpp): missing import
pshenmic fb363c9
fix(rs-dpp): fix features
pshenmic 9a75938
fix(rs-dpp): fix features
pshenmic c15202b
fix(rs-dpp): lint fix
pshenmic d4f62e7
fix(js-dash-sdk): fix logging name
pshenmic 51d1ee8
fix(dapi): fix unit test
pshenmic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,33 @@ | ||
| **Usage**: `client.platform.documents.broadcast(documents, identity, options)` | ||
| **Description**: This method will broadcast a purchase state transition that buys the given document from other Identity. | ||
|
|
||
| Parameters: | ||
|
|
||
| | parameters | type | required | Description | | ||
| |------------------------|---------|------------------ |-------------------------------------------------------------------| | ||
| | **documents.purchase** | ExtendedDocument[] | no | array of valid [created document](../documents/create.md) to buy | | ||
| | **identity** | Identity | yes | A valid [registered identity](../identities/register.md) | | ||
| | **options** | DocumentTransitionParams | no | An object with field `price` (BigInt) and `receiver` (Identifier) | | ||
|
|
||
| **Example**: | ||
| ```js | ||
| const identityId = '';// Your identity identifier | ||
| const receiverId = ''; // Receiver identity identifier | ||
| const documentId = '' // Your document id | ||
| const price = BigInt(1000000) | ||
|
|
||
| const identity = await client.platform.identities.get(identityId); | ||
| const receiverIdentity = await client.platform.identities.get(receiverId); | ||
|
|
||
| const identity = await client.platform.identities.get(identityId); | ||
|
|
||
| const [document] = await dash.platform.documents.get( | ||
| 'helloWorldContract.note', | ||
| { where: [['$id', '==', documentId]] }, | ||
| ); | ||
|
|
||
| await dash.platform.documents.broadcast({ purchase: [document], }, identity, { price, receiver: receiverIdentity.getId() }); | ||
| ``` | ||
| **Note**: This method will change the ownership of the document to your identity, and seller identity will be credited with the amount specified in the updatePrice deducted from your balance. | ||
|
|
||
| Returns: DocumentsBatchTransition |
This file contains hidden or 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 @@ | ||
| **Usage**: `client.platform.documents.broadcast(documents, identity, options)` | ||
| **Description**: This method will broadcast a document transfer | ||
|
|
||
| Parameters: | ||
|
|
||
| | parameters | type | required | Description | | ||
| |-------------------|---------|------------------ |-----------------------------------------------------------------------| | ||
| | **documents.transfer** | ExtendedDocument[] | no | array of valid [created document](../documents/create.md) to transfer | | ||
| | **identity** | Identity | yes | A valid [registered identity](../identities/register.md) | | ||
| | **options** | DocumentTransitionParams | no | An object with `receiver` field | | ||
|
|
||
| **Example**: | ||
| ```js | ||
| const identityId = '';// Your identity identifier | ||
| const receiverId = ''; // Receiver identity identifier | ||
| const documentId = '' // Your document id | ||
|
|
||
| const identity = await client.platform.identities.get(identityId); | ||
| const receiverIdentity = await client.platform.identities.get(receiverId); | ||
|
|
||
| const [document] = await dash.platform.documents.get( | ||
| 'helloWorldContract.note', | ||
| { where: [['$id', '==', documentId]] }, | ||
| ); | ||
|
|
||
| await dash.platform.documents.broadcast({ transfer: [document], }, identity, { receiver: receiverIdentity.getId() }); | ||
| ``` | ||
|
|
||
| **Note**: Transfer transition changes the ownership of the given document to the receiver identity | ||
|
|
||
| Returns: DocumentsBatchTransition |
29 changes: 29 additions & 0 deletions
29
packages/js-dash-sdk/docs/platform/documents/updatePrice.md
This file contains hidden or 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,29 @@ | ||
| **Usage**: `client.platform.documents.broadcast(documents, identity, options)` | ||
| **Description**: This method will broadcast an update price state transition that sets a price for the given document. | ||
|
|
||
| Parameters: | ||
|
|
||
| | parameters | type | required | Description | | ||
| |---------------------------|---------|------------------ |---------------------------------------------------------------------------| | ||
| | **documents.updatePrice** | ExtendedDocument[] | no | array of valid [created document](../documents/create.md) to update price | | ||
| | **identity** | Identity | yes | A valid [registered identity](../identities/register.md) | | ||
| | **options** | DocumentTransitionParams | no | An object with field `price` (BigInt) | | ||
|
|
||
| **Example**: | ||
| ```js | ||
| const identityId = '';// Your identity identifier | ||
| const documentId = '' // Your document id | ||
| const price = BigInt(1000000) | ||
|
|
||
| const identity = await client.platform.identities.get(identityId); | ||
|
|
||
| const [document] = await dash.platform.documents.get( | ||
| 'helloWorldContract.note', | ||
| { where: [['$id', '==', documentId]] }, | ||
| ); | ||
|
|
||
| await dash.platform.documents.broadcast({ updatePrice: [document], }, identity, { price }); | ||
| ``` | ||
| **Note**: This method sets the same price on all documents in the batch (only one is possible right now) | ||
|
|
||
| Returns: DocumentsBatchTransition |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.