-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[Kiosk SDK] Support kiosk_lock_rule
and environments
#12287
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f6da53c
Decouple types, add royalty rule resolving, change purchase signature
manolisliolios d184f09
Update README to match new signature
manolisliolios bc28337
Make owned kiosk and ownedkioskCap part of an extra params, to suppor…
manolisliolios 975d1d3
Add changeset
manolisliolios 2811467
Add correct env resolving for royalty rule too
manolisliolios 1d1cb51
Remove unused import
manolisliolios 5620950
Add mainnet package address, fix naming
manolisliolios 6cc4830
move addresses to constants, fix types for kiosk file after review
manolisliolios f0d7f0a
Move rules to types and export
manolisliolios a19a823
export constants too
manolisliolios 245de44
Export predefined environments, update readme
manolisliolios 059f53d
Fix withdraw calls for transfer policy & kiosk, update readme
manolisliolios 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 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,5 @@ | ||
--- | ||
"@mysten/kiosk": minor | ||
--- | ||
|
||
Support kiosk_lock_rule and environment support for rules package. Breaks `purchaseAndResolvePolicies` as it changes signature and return format. |
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
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,10 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/** The Transer Policy Rules package address on testnet */ | ||
export const TESTNET_RULES_PACKAGE_ADDRESS = | ||
'bd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585'; | ||
|
||
/** The transfer policy rules package address on mainnet */ | ||
export const MAINNET_RULES_PACKAGE_ADDRESS = | ||
'0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879'; |
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
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 |
---|---|---|
|
@@ -2,10 +2,12 @@ | |
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { JsonRpcProvider } from '@mysten/sui.js'; | ||
import { TransferPolicy, bcs } from '../bcs'; | ||
|
||
/** Name of the event emitted when a TransferPolicy for T is created. */ | ||
export const TRANSFER_POLICY_CREATED_EVENT = `0x2::transfer_policy::TransferPolicyCreated`; | ||
import { bcs } from '../bcs'; | ||
import { | ||
TRANSFER_POLICY_CREATED_EVENT, | ||
TRANSFER_POLICY_TYPE, | ||
TransferPolicy, | ||
} from '../types'; | ||
|
||
/** | ||
* Searches the `TransferPolicy`-s for the given type. The seach is performed via | ||
|
@@ -44,15 +46,11 @@ export async function queryTransferPolicy( | |
); | ||
} | ||
|
||
let parsed = bcs.de( | ||
'0x2::transfer_policy::TransferPolicy', | ||
policy.bcs.bcsBytes, | ||
'base64', | ||
); | ||
let parsed = bcs.de(TRANSFER_POLICY_TYPE, policy.bcs.bcsBytes, 'base64'); | ||
|
||
return { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that we could help provide initialSharedVersion for shared transfer policy. That could help build arguments for the purchase flow. |
||
id: policy?.objectId, | ||
type: `0x2::transfer_policy::TransferPolicy<${type}>`, | ||
type: `${TRANSFER_POLICY_TYPE}<${type}>`, | ||
owner: policy?.owner!, | ||
rules: parsed.rules, | ||
balance: parsed.balance, | ||
|
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if we had a function to create generic events of kind: transferPolicyCreated(type):
0x2:....::Created<${type}>
. Wonder what you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@damirka Could you elaborate a bit on that?