@mysten/pas 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +1 -0
  2. package/dist/client.d.mts +117 -0
  3. package/dist/client.d.mts.map +1 -0
  4. package/dist/client.mjs +89 -0
  5. package/dist/client.mjs.map +1 -0
  6. package/dist/constants.mjs +9 -0
  7. package/dist/constants.mjs.map +1 -0
  8. package/dist/contracts/pas/deps/std/type_name.mjs +17 -0
  9. package/dist/contracts/pas/deps/std/type_name.mjs.map +1 -0
  10. package/dist/contracts/pas/deps/sui/vec_map.mjs +37 -0
  11. package/dist/contracts/pas/deps/sui/vec_map.mjs.map +1 -0
  12. package/dist/contracts/pas/deps/sui/vec_set.mjs +26 -0
  13. package/dist/contracts/pas/deps/sui/vec_set.mjs.map +1 -0
  14. package/dist/contracts/pas/policy.mjs +33 -0
  15. package/dist/contracts/pas/policy.mjs.map +1 -0
  16. package/dist/contracts/pas/versioning.mjs +25 -0
  17. package/dist/contracts/pas/versioning.mjs.map +1 -0
  18. package/dist/contracts/ptb/ptb.mjs +162 -0
  19. package/dist/contracts/ptb/ptb.mjs.map +1 -0
  20. package/dist/contracts/sui/dynamic_field.mjs +22 -0
  21. package/dist/contracts/sui/dynamic_field.mjs.map +1 -0
  22. package/dist/contracts/utils/index.mjs +37 -0
  23. package/dist/contracts/utils/index.mjs.map +1 -0
  24. package/dist/derivation.mjs +70 -0
  25. package/dist/derivation.mjs.map +1 -0
  26. package/dist/error.d.mts +16 -0
  27. package/dist/error.d.mts.map +1 -0
  28. package/dist/error.mjs +26 -0
  29. package/dist/error.mjs.map +1 -0
  30. package/dist/index.d.mts +4 -0
  31. package/dist/index.mjs +4 -0
  32. package/dist/intents.mjs +494 -0
  33. package/dist/intents.mjs.map +1 -0
  34. package/dist/resolution.mjs +185 -0
  35. package/dist/resolution.mjs.map +1 -0
  36. package/dist/types.d.mts +34 -0
  37. package/dist/types.d.mts.map +1 -0
  38. package/package.json +59 -0
  39. package/src/client.ts +173 -0
  40. package/src/constants.ts +15 -0
  41. package/src/contracts/pas/account.ts +343 -0
  42. package/src/contracts/pas/clawback_funds.ts +114 -0
  43. package/src/contracts/pas/deps/std/type_name.ts +24 -0
  44. package/src/contracts/pas/deps/sui/vec_map.ts +33 -0
  45. package/src/contracts/pas/deps/sui/vec_set.ts +22 -0
  46. package/src/contracts/pas/keys.ts +90 -0
  47. package/src/contracts/pas/namespace.ts +207 -0
  48. package/src/contracts/pas/policy.ts +212 -0
  49. package/src/contracts/pas/request.ts +87 -0
  50. package/src/contracts/pas/send_funds.ts +174 -0
  51. package/src/contracts/pas/templates.ts +101 -0
  52. package/src/contracts/pas/unlock_funds.ts +155 -0
  53. package/src/contracts/pas/versioning.ts +69 -0
  54. package/src/contracts/ptb/ptb.ts +821 -0
  55. package/src/contracts/sui/dynamic_field.ts +171 -0
  56. package/src/contracts/utils/index.ts +235 -0
  57. package/src/derivation.ts +107 -0
  58. package/src/error.ts +29 -0
  59. package/src/index.ts +6 -0
  60. package/src/intents.ts +852 -0
  61. package/src/resolution.ts +294 -0
  62. package/src/types.ts +34 -0
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # Permissioned Assets Standard SDK
@@ -0,0 +1,117 @@
1
+ import { PASClientConfig, PASOptions, PASPackageConfig } from "./types.mjs";
2
+ import * as _mysten_sui_transactions0 from "@mysten/sui/transactions";
3
+ import { ClientWithCoreApi } from "@mysten/sui/client";
4
+
5
+ //#region src/client.d.ts
6
+ declare function pas<const Name extends string = 'pas'>({
7
+ packageConfig,
8
+ name,
9
+ ...options
10
+ }?: PASOptions<Name>): {
11
+ name: Name;
12
+ register: (client: ClientWithCoreApi) => PASClient;
13
+ };
14
+ declare class PASClient {
15
+ #private;
16
+ constructor(config: PASClientConfig);
17
+ /**
18
+ * Get the package configuration
19
+ */
20
+ getPackageConfig(): PASPackageConfig;
21
+ /**
22
+ * Derives the account address for a given owner address.
23
+ *
24
+ * @param owner - The owner address (can be a user address or object address)
25
+ * @returns The derived account object ID
26
+ */
27
+ deriveAccountAddress(owner: string): string;
28
+ /**
29
+ * Derives the policy address for a given asset type T.
30
+ * By default wraps with `Balance<T>` to match the on-chain convention.
31
+ *
32
+ * @param assetType - The full type of the asset (e.g., "0x2::sui::SUI")
33
+ * @returns The derived policy object ID
34
+ */
35
+ derivePolicyAddress(assetType: string): string;
36
+ /**
37
+ * Derives the templates object address for a given package configuration.
38
+ *
39
+ * @returns The derived templates object ID
40
+ */
41
+ deriveTemplateRegistryAddress(): string;
42
+ /**
43
+ * Derives the template DF address for a given approval type name.
44
+ *
45
+ * @param approvalTypeName - The fully qualified approval type name
46
+ * @returns The derived dynamic field object ID
47
+ */
48
+ deriveTemplateAddress(approvalTypeName: string): string;
49
+ /**
50
+ * Intent-based transaction builders. Each method returns a synchronous closure
51
+ * that registers a `$Intent` placeholder in the transaction. The actual PTB commands
52
+ * are resolved lazily at `tx.build()` time via the shared PAS resolver plugin.
53
+ */
54
+ get call(): {
55
+ /**
56
+ * Creates a transfer funds intent. At build time, it auto-resolves the issuer's
57
+ * approval template commands by reading the Policy and Templates objects on-chain.
58
+ * If the recipient account does not exist, it will be created and shared automatically.
59
+ *
60
+ * @param options - Transfer options
61
+ * @param options.from - The sender's address (owner of the source account)
62
+ * @param options.to - The receiver's address (owner of the destination account)
63
+ * @param options.amount - The amount to transfer
64
+ * @param options.assetType - The full asset type (e.g., "0x2::sui::SUI")
65
+ * @returns A sync closure `(tx: Transaction) => TransactionResult`
66
+ */
67
+ sendBalance: (options: {
68
+ from: string;
69
+ to: string;
70
+ amount: number | bigint;
71
+ assetType: string;
72
+ }) => (tx: _mysten_sui_transactions0.Transaction) => _mysten_sui_transactions0.TransactionResult;
73
+ /**
74
+ * Creates an unlock balance intent. At build time, it resolves the issuer's
75
+ * approval template commands. This will fail if the issuer has not configured
76
+ * unlock approvals for the asset type.
77
+ *
78
+ * @param options - Unlock options
79
+ * @param options.from - The sender's address (owner of the source account)
80
+ * @param options.amount - The amount to unlock
81
+ * @param options.assetType - The full asset type (e.g., "0x2::sui::SUI")
82
+ * @returns A sync closure `(tx: Transaction) => TransactionResult`
83
+ */
84
+ unlockBalance: (options: {
85
+ from: string;
86
+ amount: number | bigint;
87
+ assetType: string;
88
+ }) => (tx: _mysten_sui_transactions0.Transaction) => _mysten_sui_transactions0.TransactionResult;
89
+ /**
90
+ * Creates an unlock balance intent for unrestricted (non-managed) assets.
91
+ * Use this when no Policy exists for the asset type (e.g., SUI).
92
+ *
93
+ * @param options - Unlock options
94
+ * @param options.from - The sender's address (owner of the source account)
95
+ * @param options.amount - The amount to unlock
96
+ * @param options.assetType - The full asset type (e.g., "0x2::sui::SUI")
97
+ * @returns A sync closure `(tx: Transaction) => TransactionResult`
98
+ */
99
+ unlockUnrestrictedBalance: (options: {
100
+ from: string;
101
+ amount: number | bigint;
102
+ assetType: string;
103
+ }) => (tx: _mysten_sui_transactions0.Transaction) => _mysten_sui_transactions0.TransactionResult;
104
+ /**
105
+ * Returns a account object for the given address. At build time, if the account
106
+ * already exists on-chain it resolves to an object reference; otherwise it
107
+ * creates the account and shares it.
108
+ *
109
+ * @param owner - The owner address
110
+ * @returns A sync closure `(tx: Transaction) => TransactionResult` (the account)
111
+ */
112
+ accountForAddress: (owner: string) => (tx: _mysten_sui_transactions0.Transaction) => _mysten_sui_transactions0.TransactionResult;
113
+ };
114
+ }
115
+ //#endregion
116
+ export { PASClient, pas };
117
+ //# sourceMappingURL=client.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;;;iBAqBgB;;;;IAIb,WAAW;QACP;qBACa,sBAAsB;AAN1C,CAAA;AACC,cAcY,SAAA,CAdZ;EACA,CAAA,OAAA;EAEa,WAAA,CAAA,MAAA,EAcO,eAdP;EAAX;;;EAEuC,gBAAA,CAAA,CAAA,EA4CzB,gBA5CyB;EAAS;AASnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAmCiB,yBAAA,CAAA"}
@@ -0,0 +1,89 @@
1
+ import { TESTNET_PAS_PACKAGE_CONFIG } from "./constants.mjs";
2
+ import { deriveAccountAddress, derivePolicyAddress, deriveTemplateAddress, deriveTemplateRegistryAddress } from "./derivation.mjs";
3
+ import { PASClientError } from "./error.mjs";
4
+ import { accountForAddressIntent, sendBalanceIntent, unlockBalanceIntent, unlockUnrestrictedBalanceIntent } from "./intents.mjs";
5
+
6
+ //#region src/client.ts
7
+ function pas({ packageConfig, name = "pas", ...options } = {}) {
8
+ return {
9
+ name,
10
+ register: (client) => new PASClient({
11
+ packageConfig,
12
+ suiClient: client,
13
+ ...options
14
+ })
15
+ };
16
+ }
17
+ var PASClient = class {
18
+ #packageConfig;
19
+ constructor(config) {
20
+ const network = config.suiClient.network;
21
+ if (network === "mainnet" && config.packageConfig) throw new PASClientError("Custom package configuration is not allowed on mainnet. Use the built-in mainnet config when mainnet is supported.");
22
+ if (config.packageConfig) {
23
+ this.#packageConfig = config.packageConfig;
24
+ return;
25
+ }
26
+ if (!network || network !== "mainnet" && network !== "testnet") throw new PASClientError("PAS client requires a known network (mainnet, testnet) or a custom package configuration.");
27
+ if (network === "mainnet") throw new PASClientError("Mainnet is not supported yet.");
28
+ this.#packageConfig = TESTNET_PAS_PACKAGE_CONFIG;
29
+ }
30
+ /**
31
+ * Get the package configuration
32
+ */
33
+ getPackageConfig() {
34
+ return this.#packageConfig;
35
+ }
36
+ /**
37
+ * Derives the account address for a given owner address.
38
+ *
39
+ * @param owner - The owner address (can be a user address or object address)
40
+ * @returns The derived account object ID
41
+ */
42
+ deriveAccountAddress(owner) {
43
+ return deriveAccountAddress(owner, this.#packageConfig);
44
+ }
45
+ /**
46
+ * Derives the policy address for a given asset type T.
47
+ * By default wraps with `Balance<T>` to match the on-chain convention.
48
+ *
49
+ * @param assetType - The full type of the asset (e.g., "0x2::sui::SUI")
50
+ * @returns The derived policy object ID
51
+ */
52
+ derivePolicyAddress(assetType) {
53
+ return derivePolicyAddress(assetType, this.#packageConfig);
54
+ }
55
+ /**
56
+ * Derives the templates object address for a given package configuration.
57
+ *
58
+ * @returns The derived templates object ID
59
+ */
60
+ deriveTemplateRegistryAddress() {
61
+ return deriveTemplateRegistryAddress(this.#packageConfig);
62
+ }
63
+ /**
64
+ * Derives the template DF address for a given approval type name.
65
+ *
66
+ * @param approvalTypeName - The fully qualified approval type name
67
+ * @returns The derived dynamic field object ID
68
+ */
69
+ deriveTemplateAddress(approvalTypeName) {
70
+ return deriveTemplateAddress(this.deriveTemplateRegistryAddress(), approvalTypeName);
71
+ }
72
+ /**
73
+ * Intent-based transaction builders. Each method returns a synchronous closure
74
+ * that registers a `$Intent` placeholder in the transaction. The actual PTB commands
75
+ * are resolved lazily at `tx.build()` time via the shared PAS resolver plugin.
76
+ */
77
+ get call() {
78
+ return {
79
+ sendBalance: sendBalanceIntent(this.#packageConfig),
80
+ unlockBalance: unlockBalanceIntent(this.#packageConfig),
81
+ unlockUnrestrictedBalance: unlockUnrestrictedBalanceIntent(this.#packageConfig),
82
+ accountForAddress: accountForAddressIntent(this.#packageConfig)
83
+ };
84
+ }
85
+ };
86
+
87
+ //#endregion
88
+ export { PASClient, pas };
89
+ //# sourceMappingURL=client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.mjs","names":["#packageConfig"],"sources":["../src/client.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ClientWithCoreApi } from '@mysten/sui/client';\n\nimport { TESTNET_PAS_PACKAGE_CONFIG } from './constants.js';\nimport {\n\tderiveAccountAddress,\n\tderivePolicyAddress,\n\tderiveTemplateAddress,\n\tderiveTemplateRegistryAddress,\n} from './derivation.js';\nimport { PASClientError } from './error.js';\nimport {\n\taccountForAddressIntent,\n\tsendBalanceIntent,\n\tunlockBalanceIntent,\n\tunlockUnrestrictedBalanceIntent,\n} from './intents.js';\nimport type { PASClientConfig, PASOptions, PASPackageConfig } from './types.js';\n\nexport function pas<const Name extends string = 'pas'>({\n\tpackageConfig,\n\tname = 'pas' as Name,\n\t...options\n}: PASOptions<Name> = {}): {\n\tname: Name;\n\tregister: (client: ClientWithCoreApi) => PASClient;\n} {\n\treturn {\n\t\tname,\n\t\tregister: (client: ClientWithCoreApi) =>\n\t\t\tnew PASClient({ packageConfig, suiClient: client, ...options }),\n\t};\n}\n\nexport class PASClient {\n\t#packageConfig: PASPackageConfig;\n\n\tconstructor(config: PASClientConfig) {\n\t\tconst network = config.suiClient.network;\n\n\t\t// Mainnet: no custom config allowed (avoid accidental republishing).\n\t\tif (network === 'mainnet' && config.packageConfig) {\n\t\t\tthrow new PASClientError(\n\t\t\t\t'Custom package configuration is not allowed on mainnet. Use the built-in mainnet config when mainnet is supported.',\n\t\t\t);\n\t\t}\n\n\t\tif (config.packageConfig) {\n\t\t\tthis.#packageConfig = config.packageConfig;\n\t\t\treturn;\n\t\t}\n\n\t\tif (!network || (network !== 'mainnet' && network !== 'testnet')) {\n\t\t\tthrow new PASClientError(\n\t\t\t\t'PAS client requires a known network (mainnet, testnet) or a custom package configuration.',\n\t\t\t);\n\t\t}\n\n\t\t// TODO: Remove when we add mainnet data\n\t\tif (network === 'mainnet') {\n\t\t\tthrow new PASClientError('Mainnet is not supported yet.');\n\t\t}\n\n\t\tthis.#packageConfig = TESTNET_PAS_PACKAGE_CONFIG;\n\t}\n\n\t/**\n\t * Get the package configuration\n\t */\n\tgetPackageConfig() {\n\t\treturn this.#packageConfig;\n\t}\n\n\t/**\n\t * Derives the account address for a given owner address.\n\t *\n\t * @param owner - The owner address (can be a user address or object address)\n\t * @returns The derived account object ID\n\t */\n\tderiveAccountAddress(owner: string): string {\n\t\treturn deriveAccountAddress(owner, this.#packageConfig);\n\t}\n\n\t/**\n\t * Derives the policy address for a given asset type T.\n\t * By default wraps with `Balance<T>` to match the on-chain convention.\n\t *\n\t * @param assetType - The full type of the asset (e.g., \"0x2::sui::SUI\")\n\t * @returns The derived policy object ID\n\t */\n\tderivePolicyAddress(assetType: string): string {\n\t\treturn derivePolicyAddress(assetType, this.#packageConfig);\n\t}\n\n\t/**\n\t * Derives the templates object address for a given package configuration.\n\t *\n\t * @returns The derived templates object ID\n\t */\n\tderiveTemplateRegistryAddress(): string {\n\t\treturn deriveTemplateRegistryAddress(this.#packageConfig);\n\t}\n\n\t/**\n\t * Derives the template DF address for a given approval type name.\n\t *\n\t * @param approvalTypeName - The fully qualified approval type name\n\t * @returns The derived dynamic field object ID\n\t */\n\tderiveTemplateAddress(approvalTypeName: string): string {\n\t\treturn deriveTemplateAddress(this.deriveTemplateRegistryAddress(), approvalTypeName);\n\t}\n\n\t/**\n\t * Intent-based transaction builders. Each method returns a synchronous closure\n\t * that registers a `$Intent` placeholder in the transaction. The actual PTB commands\n\t * are resolved lazily at `tx.build()` time via the shared PAS resolver plugin.\n\t */\n\tget call() {\n\t\treturn {\n\t\t\t/**\n\t\t\t * Creates a transfer funds intent. At build time, it auto-resolves the issuer's\n\t\t\t * approval template commands by reading the Policy and Templates objects on-chain.\n\t\t\t * If the recipient account does not exist, it will be created and shared automatically.\n\t\t\t *\n\t\t\t * @param options - Transfer options\n\t\t\t * @param options.from - The sender's address (owner of the source account)\n\t\t\t * @param options.to - The receiver's address (owner of the destination account)\n\t\t\t * @param options.amount - The amount to transfer\n\t\t\t * @param options.assetType - The full asset type (e.g., \"0x2::sui::SUI\")\n\t\t\t * @returns A sync closure `(tx: Transaction) => TransactionResult`\n\t\t\t */\n\t\t\tsendBalance: sendBalanceIntent(this.#packageConfig),\n\n\t\t\t/**\n\t\t\t * Creates an unlock balance intent. At build time, it resolves the issuer's\n\t\t\t * approval template commands. This will fail if the issuer has not configured\n\t\t\t * unlock approvals for the asset type.\n\t\t\t *\n\t\t\t * @param options - Unlock options\n\t\t\t * @param options.from - The sender's address (owner of the source account)\n\t\t\t * @param options.amount - The amount to unlock\n\t\t\t * @param options.assetType - The full asset type (e.g., \"0x2::sui::SUI\")\n\t\t\t * @returns A sync closure `(tx: Transaction) => TransactionResult`\n\t\t\t */\n\t\t\tunlockBalance: unlockBalanceIntent(this.#packageConfig),\n\n\t\t\t/**\n\t\t\t * Creates an unlock balance intent for unrestricted (non-managed) assets.\n\t\t\t * Use this when no Policy exists for the asset type (e.g., SUI).\n\t\t\t *\n\t\t\t * @param options - Unlock options\n\t\t\t * @param options.from - The sender's address (owner of the source account)\n\t\t\t * @param options.amount - The amount to unlock\n\t\t\t * @param options.assetType - The full asset type (e.g., \"0x2::sui::SUI\")\n\t\t\t * @returns A sync closure `(tx: Transaction) => TransactionResult`\n\t\t\t */\n\t\t\tunlockUnrestrictedBalance: unlockUnrestrictedBalanceIntent(this.#packageConfig),\n\n\t\t\t/**\n\t\t\t * Returns a account object for the given address. At build time, if the account\n\t\t\t * already exists on-chain it resolves to an object reference; otherwise it\n\t\t\t * creates the account and shares it.\n\t\t\t *\n\t\t\t * @param owner - The owner address\n\t\t\t * @returns A sync closure `(tx: Transaction) => TransactionResult` (the account)\n\t\t\t */\n\t\t\taccountForAddress: accountForAddressIntent(this.#packageConfig),\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;AAqBA,SAAgB,IAAuC,EACtD,eACA,OAAO,OACP,GAAG,YACkB,EAAE,EAGtB;AACD,QAAO;EACN;EACA,WAAW,WACV,IAAI,UAAU;GAAE;GAAe,WAAW;GAAQ,GAAG;GAAS,CAAC;EAChE;;AAGF,IAAa,YAAb,MAAuB;CACtB;CAEA,YAAY,QAAyB;EACpC,MAAM,UAAU,OAAO,UAAU;AAGjC,MAAI,YAAY,aAAa,OAAO,cACnC,OAAM,IAAI,eACT,qHACA;AAGF,MAAI,OAAO,eAAe;AACzB,SAAKA,gBAAiB,OAAO;AAC7B;;AAGD,MAAI,CAAC,WAAY,YAAY,aAAa,YAAY,UACrD,OAAM,IAAI,eACT,4FACA;AAIF,MAAI,YAAY,UACf,OAAM,IAAI,eAAe,gCAAgC;AAG1D,QAAKA,gBAAiB;;;;;CAMvB,mBAAmB;AAClB,SAAO,MAAKA;;;;;;;;CASb,qBAAqB,OAAuB;AAC3C,SAAO,qBAAqB,OAAO,MAAKA,cAAe;;;;;;;;;CAUxD,oBAAoB,WAA2B;AAC9C,SAAO,oBAAoB,WAAW,MAAKA,cAAe;;;;;;;CAQ3D,gCAAwC;AACvC,SAAO,8BAA8B,MAAKA,cAAe;;;;;;;;CAS1D,sBAAsB,kBAAkC;AACvD,SAAO,sBAAsB,KAAK,+BAA+B,EAAE,iBAAiB;;;;;;;CAQrF,IAAI,OAAO;AACV,SAAO;GAaN,aAAa,kBAAkB,MAAKA,cAAe;GAanD,eAAe,oBAAoB,MAAKA,cAAe;GAYvD,2BAA2B,gCAAgC,MAAKA,cAAe;GAU/E,mBAAmB,wBAAwB,MAAKA,cAAe;GAC/D"}
@@ -0,0 +1,9 @@
1
+ //#region src/constants.ts
2
+ const TESTNET_PAS_PACKAGE_CONFIG = {
3
+ packageId: "0x7e77592474ea9759b46ca5c6515ed4840952cd80d60ee54a1614382811d46730",
4
+ namespaceId: "0xf7c77ac8bbbdf47f7b1cf8ac8aa489cfc4dff25847f3e2e1db53bde5c454be2b"
5
+ };
6
+
7
+ //#endregion
8
+ export { TESTNET_PAS_PACKAGE_CONFIG };
9
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PASPackageConfig } from './types.js';\n\nexport const TESTNET_PAS_PACKAGE_CONFIG: PASPackageConfig = {\n\tpackageId: '0x7e77592474ea9759b46ca5c6515ed4840952cd80d60ee54a1614382811d46730',\n\tnamespaceId: '0xf7c77ac8bbbdf47f7b1cf8ac8aa489cfc4dff25847f3e2e1db53bde5c454be2b',\n};\n\n// TODO: also update `client.ts` when adding these variables\nexport const MAINNET_PAS_PACKAGE_CONFIG: PASPackageConfig = {\n\tpackageId: '', // TODO: Replace with actual mainnet package ID\n\tnamespaceId: '', // TODO: Replace with actual mainnet namespace ID\n};\n"],"mappings":";AAKA,MAAa,6BAA+C;CAC3D,WAAW;CACX,aAAa;CACb"}
@@ -0,0 +1,17 @@
1
+ import { MoveStruct } from "../../../utils/index.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/contracts/pas/deps/std/type_name.ts
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ /** Functionality for converting Move types into values. Use with care! */
9
+ const $moduleName = "std::type_name";
10
+ const TypeName = new MoveStruct({
11
+ name: `${$moduleName}::TypeName`,
12
+ fields: { name: bcs.string() }
13
+ });
14
+
15
+ //#endregion
16
+ export { TypeName };
17
+ //# sourceMappingURL=type_name.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type_name.mjs","names":[],"sources":["../../../../../src/contracts/pas/deps/std/type_name.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/** Functionality for converting Move types into values. Use with care! */\n\nimport { MoveStruct } from '../../../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nconst $moduleName = 'std::type_name';\nexport const TypeName = new MoveStruct({\n\tname: `${$moduleName}::TypeName`,\n\tfields: {\n\t\t/**\n\t\t * String representation of the type. All types are represented using their source\n\t\t * syntax: \"u8\", \"u64\", \"bool\", \"address\", \"vector\", and so on for primitive types.\n\t\t * Struct types are represented as fully qualified type names; e.g.\n\t\t * `00000000000000000000000000000001::string::String` or\n\t\t * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`\n\t\t * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or\n\t\t * 32 depending on the Move platform)\n\t\t */\n\t\tname: bcs.string(),\n\t},\n});\n"],"mappings":";;;;;;;;AAQA,MAAM,cAAc;AACpB,MAAa,WAAW,IAAI,WAAW;CACtC,MAAM,GAAG,YAAY;CACrB,QAAQ,EAUP,MAAM,IAAI,QAAQ,EAClB;CACD,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { MoveStruct } from "../../../utils/index.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/contracts/pas/deps/sui/vec_map.ts
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ const $moduleName = "0x2::vec_map";
9
+ /** An entry in the map */
10
+ function Entry(...typeParameters) {
11
+ return new MoveStruct({
12
+ name: `${$moduleName}::Entry<${typeParameters[0].name}, ${typeParameters[1].name}>`,
13
+ fields: {
14
+ key: typeParameters[0],
15
+ value: typeParameters[1]
16
+ }
17
+ });
18
+ }
19
+ /**
20
+ * A map data structure backed by a vector. The map is guaranteed not to contain
21
+ * duplicate keys, but entries are _not_ sorted by key--entries are included in
22
+ * insertion order. All operations are O(N) in the size of the map--the intention
23
+ * of this data structure is only to provide the convenience of programming against
24
+ * a map API. Large maps should use handwritten parent/child relationships instead.
25
+ * Maps that need sorted iteration rather than insertion order iteration should
26
+ * also be handwritten.
27
+ */
28
+ function VecMap(...typeParameters) {
29
+ return new MoveStruct({
30
+ name: `${$moduleName}::VecMap<${typeParameters[0].name}, ${typeParameters[1].name}>`,
31
+ fields: { contents: bcs.vector(Entry(typeParameters[0], typeParameters[1])) }
32
+ });
33
+ }
34
+
35
+ //#endregion
36
+ export { VecMap };
37
+ //# sourceMappingURL=vec_map.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vec_map.mjs","names":[],"sources":["../../../../../src/contracts/pas/deps/sui/vec_map.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\nimport { type BcsType, bcs } from '@mysten/sui/bcs';\nimport { MoveStruct } from '../../../utils/index.js';\nconst $moduleName = '0x2::vec_map';\n/** An entry in the map */\nexport function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {\n\treturn new MoveStruct({\n\t\tname: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,\n\t\tfields: {\n\t\t\tkey: typeParameters[0],\n\t\t\tvalue: typeParameters[1],\n\t\t},\n\t});\n}\n/**\n * A map data structure backed by a vector. The map is guaranteed not to contain\n * duplicate keys, but entries are _not_ sorted by key--entries are included in\n * insertion order. All operations are O(N) in the size of the map--the intention\n * of this data structure is only to provide the convenience of programming against\n * a map API. Large maps should use handwritten parent/child relationships instead.\n * Maps that need sorted iteration rather than insertion order iteration should\n * also be handwritten.\n */\nexport function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {\n\treturn new MoveStruct({\n\t\tname: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,\n\t\tfields: {\n\t\t\tcontents: bcs.vector(Entry(typeParameters[0], typeParameters[1])),\n\t\t},\n\t});\n}\n"],"mappings":";;;;;;;AAKA,MAAM,cAAc;;AAEpB,SAAgB,MAAsD,GAAG,gBAAwB;AAChG,QAAO,IAAI,WAAW;EACrB,MAAM,GAAG,YAAY,UAAU,eAAe,GAAG,KAAkB,IAAI,eAAe,GAAG,KAAkB;EAC3G,QAAQ;GACP,KAAK,eAAe;GACpB,OAAO,eAAe;GACtB;EACD,CAAC;;;;;;;;;;;AAWH,SAAgB,OAAuD,GAAG,gBAAwB;AACjG,QAAO,IAAI,WAAW;EACrB,MAAM,GAAG,YAAY,WAAW,eAAe,GAAG,KAAkB,IAAI,eAAe,GAAG,KAAkB;EAC5G,QAAQ,EACP,UAAU,IAAI,OAAO,MAAM,eAAe,IAAI,eAAe,GAAG,CAAC,EACjE;EACD,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { MoveStruct } from "../../../utils/index.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/contracts/pas/deps/sui/vec_set.ts
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ const $moduleName = "0x2::vec_set";
9
+ /**
10
+ * A set data structure backed by a vector. The set is guaranteed not to contain
11
+ * duplicate keys. All operations are O(N) in the size of the set
12
+ *
13
+ * - the intention of this data structure is only to provide the convenience of
14
+ * programming against a set API. Sets that need sorted iteration rather than
15
+ * insertion order iteration should be handwritten.
16
+ */
17
+ function VecSet(...typeParameters) {
18
+ return new MoveStruct({
19
+ name: `${$moduleName}::VecSet<${typeParameters[0].name}>`,
20
+ fields: { contents: bcs.vector(typeParameters[0]) }
21
+ });
22
+ }
23
+
24
+ //#endregion
25
+ export { VecSet };
26
+ //# sourceMappingURL=vec_set.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vec_set.mjs","names":[],"sources":["../../../../../src/contracts/pas/deps/sui/vec_set.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\nimport { type BcsType, bcs } from '@mysten/sui/bcs';\nimport { MoveStruct } from '../../../utils/index.js';\nconst $moduleName = '0x2::vec_set';\n/**\n * A set data structure backed by a vector. The set is guaranteed not to contain\n * duplicate keys. All operations are O(N) in the size of the set\n *\n * - the intention of this data structure is only to provide the convenience of\n * programming against a set API. Sets that need sorted iteration rather than\n * insertion order iteration should be handwritten.\n */\nexport function VecSet<K extends BcsType<any>>(...typeParameters: [K]) {\n\treturn new MoveStruct({\n\t\tname: `${$moduleName}::VecSet<${typeParameters[0].name as K['name']}>`,\n\t\tfields: {\n\t\t\tcontents: bcs.vector(typeParameters[0]),\n\t\t},\n\t});\n}\n"],"mappings":";;;;;;;AAKA,MAAM,cAAc;;;;;;;;;AASpB,SAAgB,OAA+B,GAAG,gBAAqB;AACtE,QAAO,IAAI,WAAW;EACrB,MAAM,GAAG,YAAY,WAAW,eAAe,GAAG,KAAkB;EACpE,QAAQ,EACP,UAAU,IAAI,OAAO,eAAe,GAAG,EACvC;EACD,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { MoveStruct, MoveTuple } from "../utils/index.mjs";
2
+ import { TypeName } from "./deps/std/type_name.mjs";
3
+ import { VecMap } from "./deps/sui/vec_map.mjs";
4
+ import { VecSet } from "./deps/sui/vec_set.mjs";
5
+ import { Versioning } from "./versioning.mjs";
6
+ import { bcs } from "@mysten/sui/bcs";
7
+
8
+ //#region src/contracts/pas/policy.ts
9
+ /**************************************************************
10
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
11
+ **************************************************************/
12
+ const $moduleName = "@mysten/pas::policy";
13
+ const Policy = new MoveStruct({
14
+ name: `${$moduleName}::Policy<phantom T>`,
15
+ fields: {
16
+ id: bcs.Address,
17
+ required_approvals: VecMap(bcs.string(), VecSet(TypeName)),
18
+ versioning: Versioning,
19
+ clawback_allowed: bcs.bool()
20
+ }
21
+ });
22
+ const PolicyCap = new MoveStruct({
23
+ name: `${$moduleName}::PolicyCap<phantom T>`,
24
+ fields: { id: bcs.Address }
25
+ });
26
+ const PolicyCapKey = new MoveTuple({
27
+ name: `${$moduleName}::PolicyCapKey`,
28
+ fields: [bcs.bool()]
29
+ });
30
+
31
+ //#endregion
32
+ export { Policy };
33
+ //# sourceMappingURL=policy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.mjs","names":["vec_map.VecMap","vec_set.VecSet","type_name.TypeName","versioning.Versioning"],"sources":["../../../src/contracts/pas/policy.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\nimport {\n\tMoveStruct,\n\tMoveTuple,\n\tnormalizeMoveArguments,\n\ttype RawTransactionArgument,\n} from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction } from '@mysten/sui/transactions';\nimport * as vec_map from './deps/sui/vec_map.js';\nimport * as vec_set from './deps/sui/vec_set.js';\nimport * as type_name from './deps/std/type_name.js';\nimport * as versioning from './versioning.js';\nconst $moduleName = '@mysten/pas::policy';\nexport const Policy = new MoveStruct({\n\tname: `${$moduleName}::Policy<phantom T>`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\t/**\n\t\t * The required approvals per request type. The key must be one of the request\n\t\t * types (e.g. `send_funds`, `unlock_funds` or `clawback_funds`).\n\t\t *\n\t\t * The value is a vector of approvals that need to be gather to resolve the\n\t\t * request.\n\t\t */\n\t\trequired_approvals: vec_map.VecMap(bcs.string(), vec_set.VecSet(type_name.TypeName)),\n\t\t/**\n\t\t * Block versions to break backwards compatibility -- only used in case of\n\t\t * emergency.\n\t\t */\n\t\tversioning: versioning.Versioning,\n\t\t/** Whether clawback is allowed for this policy. */\n\t\tclawback_allowed: bcs.bool(),\n\t},\n});\nexport const PolicyCap = new MoveStruct({\n\tname: `${$moduleName}::PolicyCap<phantom T>`,\n\tfields: {\n\t\tid: bcs.Address,\n\t},\n});\nexport const PolicyCapKey = new MoveTuple({\n\tname: `${$moduleName}::PolicyCapKey`,\n\tfields: [bcs.bool()],\n});\nexport interface NewForCurrencyArguments {\n\tnamespace: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n\tclawbackAllowed: RawTransactionArgument<boolean>;\n}\nexport interface NewForCurrencyOptions {\n\tpackage?: string;\n\targuments:\n\t\t| NewForCurrencyArguments\n\t\t| [\n\t\t\t\tnamespace: RawTransactionArgument<string>,\n\t\t\t\tCap: RawTransactionArgument<string>,\n\t\t\t\tclawbackAllowed: RawTransactionArgument<boolean>,\n\t\t ];\n\ttypeArguments: [string];\n}\nexport function newForCurrency(options: NewForCurrencyOptions) {\n\tconst packageAddress = options.package ?? '@mysten/pas';\n\tconst argumentsTypes = [null, null, 'bool'] satisfies (string | null)[];\n\tconst parameterNames = ['namespace', 'Cap', 'clawbackAllowed'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'policy',\n\t\t\tfunction: 'new_for_currency',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface ShareArguments {\n\tpolicy: RawTransactionArgument<string>;\n}\nexport interface ShareOptions {\n\tpackage?: string;\n\targuments: ShareArguments | [policy: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\nexport function share(options: ShareOptions) {\n\tconst packageAddress = options.package ?? '@mysten/pas';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['policy'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'policy',\n\t\t\tfunction: 'share',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface RequiredApprovalsArguments {\n\tpolicy: RawTransactionArgument<string>;\n\tactionType: RawTransactionArgument<string>;\n}\nexport interface RequiredApprovalsOptions {\n\tpackage?: string;\n\targuments:\n\t\t| RequiredApprovalsArguments\n\t\t| [policy: RawTransactionArgument<string>, actionType: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/** Get the set of required approvals for a given action. */\nexport function requiredApprovals(options: RequiredApprovalsOptions) {\n\tconst packageAddress = options.package ?? '@mysten/pas';\n\tconst argumentsTypes = [null, '0x1::string::String'] satisfies (string | null)[];\n\tconst parameterNames = ['policy', 'actionType'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'policy',\n\t\t\tfunction: 'required_approvals',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface SetRequiredApprovalArguments {\n\tpolicy: RawTransactionArgument<string>;\n\tcap: RawTransactionArgument<string>;\n\taction: RawTransactionArgument<string>;\n}\nexport interface SetRequiredApprovalOptions {\n\tpackage?: string;\n\targuments:\n\t\t| SetRequiredApprovalArguments\n\t\t| [\n\t\t\t\tpolicy: RawTransactionArgument<string>,\n\t\t\t\tcap: RawTransactionArgument<string>,\n\t\t\t\taction: RawTransactionArgument<string>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\nexport function setRequiredApproval(options: SetRequiredApprovalOptions) {\n\tconst packageAddress = options.package ?? '@mysten/pas';\n\tconst argumentsTypes = [null, null, '0x1::string::String'] satisfies (string | null)[];\n\tconst parameterNames = ['policy', 'cap', 'action'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'policy',\n\t\t\tfunction: 'set_required_approval',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface RemoveActionApprovalArguments {\n\tpolicy: RawTransactionArgument<string>;\n\t_: RawTransactionArgument<string>;\n\taction: RawTransactionArgument<string>;\n}\nexport interface RemoveActionApprovalOptions {\n\tpackage?: string;\n\targuments:\n\t\t| RemoveActionApprovalArguments\n\t\t| [\n\t\t\t\tpolicy: RawTransactionArgument<string>,\n\t\t\t\t_: RawTransactionArgument<string>,\n\t\t\t\taction: RawTransactionArgument<string>,\n\t\t ];\n\ttypeArguments: [string];\n}\n/**\n * Remove the action approval for a given action (this will make all requests not\n * resolve).\n */\nexport function removeActionApproval(options: RemoveActionApprovalOptions) {\n\tconst packageAddress = options.package ?? '@mysten/pas';\n\tconst argumentsTypes = [null, null, '0x1::string::String'] satisfies (string | null)[];\n\tconst parameterNames = ['policy', '_', 'action'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'policy',\n\t\t\tfunction: 'remove_action_approval',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface SyncVersioningArguments {\n\tpolicy: RawTransactionArgument<string>;\n\tnamespace: RawTransactionArgument<string>;\n}\nexport interface SyncVersioningOptions {\n\tpackage?: string;\n\targuments:\n\t\t| SyncVersioningArguments\n\t\t| [policy: RawTransactionArgument<string>, namespace: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/**\n * Allows syncing the versioning of a policy to the namespace's versioning. This is\n * permission-less and can be done by anyone.\n */\nexport function syncVersioning(options: SyncVersioningOptions) {\n\tconst packageAddress = options.package ?? '@mysten/pas';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['policy', 'namespace'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'policy',\n\t\t\tfunction: 'sync_versioning',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;AAeA,MAAM,cAAc;AACpB,MAAa,SAAS,IAAI,WAAW;CACpC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,IAAI,IAAI;EAQR,oBAAoBA,OAAe,IAAI,QAAQ,EAAEC,OAAeC,SAAmB,CAAC;EAKpF,YAAYC;EAEZ,kBAAkB,IAAI,MAAM;EAC5B;CACD,CAAC;AACF,MAAa,YAAY,IAAI,WAAW;CACvC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,IAAI,IAAI,SACR;CACD,CAAC;AACF,MAAa,eAAe,IAAI,UAAU;CACzC,MAAM,GAAG,YAAY;CACrB,QAAQ,CAAC,IAAI,MAAM,CAAC;CACpB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { MoveStruct } from "../utils/index.mjs";
2
+ import { VecSet } from "./deps/sui/vec_set.mjs";
3
+ import { bcs } from "@mysten/sui/bcs";
4
+
5
+ //#region src/contracts/pas/versioning.ts
6
+ /**************************************************************
7
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
8
+ **************************************************************/
9
+ /**
10
+ * Versioning module.
11
+ *
12
+ * This module is responsible for managing the versioning of the package.
13
+ *
14
+ * It allows for blocking specific versions of the package in case of emergency, or
15
+ * to slowly deprecate an earlier feature.
16
+ */
17
+ const $moduleName = "@mysten/pas::versioning";
18
+ const Versioning = new MoveStruct({
19
+ name: `${$moduleName}::Versioning`,
20
+ fields: { blocked_versions: VecSet(bcs.u64()) }
21
+ });
22
+
23
+ //#endregion
24
+ export { Versioning };
25
+ //# sourceMappingURL=versioning.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versioning.mjs","names":["vec_set.VecSet"],"sources":["../../../src/contracts/pas/versioning.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Versioning module.\n *\n * This module is responsible for managing the versioning of the package.\n *\n * It allows for blocking specific versions of the package in case of emergency, or\n * to slowly deprecate an earlier feature.\n */\n\nimport { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction } from '@mysten/sui/transactions';\nimport * as vec_set from './deps/sui/vec_set.js';\nconst $moduleName = '@mysten/pas::versioning';\nexport const Versioning = new MoveStruct({\n\tname: `${$moduleName}::Versioning`,\n\tfields: {\n\t\tblocked_versions: vec_set.VecSet(bcs.u64()),\n\t},\n});\nexport interface IsValidVersionArguments {\n\tversioning: RawTransactionArgument<string>;\n\tversion: RawTransactionArgument<number | bigint>;\n}\nexport interface IsValidVersionOptions {\n\tpackage?: string;\n\targuments:\n\t\t| IsValidVersionArguments\n\t\t| [\n\t\t\t\tversioning: RawTransactionArgument<string>,\n\t\t\t\tversion: RawTransactionArgument<number | bigint>,\n\t\t ];\n}\n/** Verify that a version is not part of the blocked version list. */\nexport function isValidVersion(options: IsValidVersionOptions) {\n\tconst packageAddress = options.package ?? '@mysten/pas';\n\tconst argumentsTypes = [null, 'u64'] satisfies (string | null)[];\n\tconst parameterNames = ['versioning', 'version'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'versioning',\n\t\t\tfunction: 'is_valid_version',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface AssertIsValidVersionArguments {\n\tversioning: RawTransactionArgument<string>;\n}\nexport interface AssertIsValidVersionOptions {\n\tpackage?: string;\n\targuments: AssertIsValidVersionArguments | [versioning: RawTransactionArgument<string>];\n}\nexport function assertIsValidVersion(options: AssertIsValidVersionOptions) {\n\tconst packageAddress = options.package ?? '@mysten/pas';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['versioning'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'versioning',\n\t\t\tfunction: 'assert_is_valid_version',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,cAAc;AACpB,MAAa,aAAa,IAAI,WAAW;CACxC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,kBAAkBA,OAAe,IAAI,KAAK,CAAC,EAC3C;CACD,CAAC"}
@@ -0,0 +1,162 @@
1
+ import { MoveEnum, MoveStruct, MoveTuple } from "../utils/index.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/contracts/ptb/ptb.ts
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ /** Module: ptb */
9
+ const $moduleName = "@mysten/ptb::ptb";
10
+ const Command = new MoveTuple({
11
+ name: `${$moduleName}::Command`,
12
+ fields: [bcs.u8(), bcs.vector(bcs.u8())]
13
+ });
14
+ const Transaction = new MoveStruct({
15
+ name: `${$moduleName}::Transaction`,
16
+ fields: { commands: bcs.vector(Command) }
17
+ });
18
+ /**
19
+ * Defines a simplified `ObjectArg` type for the `Transaction`.
20
+ *
21
+ * Differences with canonical Sui `ObjectArg` type:
22
+ *
23
+ * - Uses `address` type as a fixed-length sequence of bytes without length prefix.
24
+ * - Extends the number of variants to support off-chain resolution.
25
+ */
26
+ const ObjectArg = new MoveEnum({
27
+ name: `${$moduleName}::ObjectArg`,
28
+ fields: {
29
+ ImmOrOwnedObject: new MoveStruct({
30
+ name: `ObjectArg.ImmOrOwnedObject`,
31
+ fields: {
32
+ object_id: bcs.Address,
33
+ sequence_number: bcs.u64(),
34
+ digest: bcs.Address
35
+ }
36
+ }),
37
+ SharedObject: new MoveStruct({
38
+ name: `ObjectArg.SharedObject`,
39
+ fields: {
40
+ object_id: bcs.Address,
41
+ initial_shared_version: bcs.u64(),
42
+ is_mutable: bcs.bool()
43
+ }
44
+ }),
45
+ Receiving: new MoveStruct({
46
+ name: `ObjectArg.Receiving`,
47
+ fields: {
48
+ object_id: bcs.Address,
49
+ sequence_number: bcs.u64(),
50
+ digest: bcs.Address
51
+ }
52
+ }),
53
+ Ext: bcs.string()
54
+ }
55
+ });
56
+ const WithdrawFrom = new MoveEnum({
57
+ name: `${$moduleName}::WithdrawFrom`,
58
+ fields: {
59
+ Sender: null,
60
+ Sponsor: null
61
+ }
62
+ });
63
+ /**
64
+ * Defines a simplified `CallArg` type for `Transaction`.
65
+ *
66
+ * Differences with canonical Sui `CallArg` type:
67
+ *
68
+ * - ObjectArg is a simplified, unresolved representation of Object arguments;
69
+ * - Ext(...) is a custom extension for the `CallArg` which allows off-chain
70
+ * resolvers to convert them into the appropriate values for context.
71
+ */
72
+ const CallArg = new MoveEnum({
73
+ name: `${$moduleName}::CallArg`,
74
+ fields: {
75
+ Pure: bcs.vector(bcs.u8()),
76
+ Object: ObjectArg,
77
+ FundsWithdrawal: new MoveStruct({
78
+ name: `CallArg.FundsWithdrawal`,
79
+ fields: {
80
+ amount: bcs.u64(),
81
+ type_name: bcs.string(),
82
+ withdraw_from: WithdrawFrom
83
+ }
84
+ }),
85
+ Ext: new MoveTuple({
86
+ name: `CallArg.Ext`,
87
+ fields: [bcs.string(), bcs.string()]
88
+ })
89
+ }
90
+ });
91
+ /** Defines a simplified `Argument` type for the `Transaction`. */
92
+ const Argument = new MoveEnum({
93
+ name: `${$moduleName}::Argument`,
94
+ fields: {
95
+ GasCoin: null,
96
+ Input: CallArg,
97
+ Result: bcs.u16(),
98
+ NestedResult: new MoveTuple({
99
+ name: `Argument.NestedResult`,
100
+ fields: [bcs.u16(), bcs.u16()]
101
+ }),
102
+ Ext: bcs.vector(bcs.u8())
103
+ }
104
+ });
105
+ const MoveCall = new MoveStruct({
106
+ name: `${$moduleName}::MoveCall`,
107
+ fields: {
108
+ package_id: bcs.string(),
109
+ module_name: bcs.string(),
110
+ function: bcs.string(),
111
+ arguments: bcs.vector(Argument),
112
+ type_arguments: bcs.vector(bcs.string())
113
+ }
114
+ });
115
+ const TransferObjects = new MoveStruct({
116
+ name: `${$moduleName}::TransferObjects`,
117
+ fields: {
118
+ objects: bcs.vector(Argument),
119
+ to: Argument
120
+ }
121
+ });
122
+ const SplitCoins = new MoveStruct({
123
+ name: `${$moduleName}::SplitCoins`,
124
+ fields: {
125
+ coin: Argument,
126
+ amounts: bcs.vector(Argument)
127
+ }
128
+ });
129
+ const MergeCoins = new MoveStruct({
130
+ name: `${$moduleName}::MergeCoins`,
131
+ fields: {
132
+ coin: Argument,
133
+ coins: bcs.vector(Argument)
134
+ }
135
+ });
136
+ const Publish = new MoveStruct({
137
+ name: `${$moduleName}::Publish`,
138
+ fields: {
139
+ modules_bytes: bcs.vector(bcs.vector(bcs.u8())),
140
+ dependencies: bcs.vector(bcs.Address)
141
+ }
142
+ });
143
+ const MakeMoveVec = new MoveStruct({
144
+ name: `${$moduleName}::MakeMoveVec`,
145
+ fields: {
146
+ element_type: bcs.option(bcs.string()),
147
+ elements: bcs.vector(Argument)
148
+ }
149
+ });
150
+ const Upgrade = new MoveStruct({
151
+ name: `${$moduleName}::Upgrade`,
152
+ fields: {
153
+ modules_bytes: bcs.vector(bcs.vector(bcs.u8())),
154
+ dependencies: bcs.vector(bcs.Address),
155
+ object_id: bcs.Address,
156
+ upgrade_ticket: Argument
157
+ }
158
+ });
159
+
160
+ //#endregion
161
+ export { Command, MoveCall };
162
+ //# sourceMappingURL=ptb.mjs.map