@mysten/payment-kit 0.0.0-experimental-20251001205708

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 (72) hide show
  1. package/README.md +126 -0
  2. package/dist/cjs/client.d.ts +6 -0
  3. package/dist/cjs/client.js +62 -0
  4. package/dist/cjs/client.js.map +7 -0
  5. package/dist/cjs/constants.d.ts +6 -0
  6. package/dist/cjs/constants.js +31 -0
  7. package/dist/cjs/constants.js.map +7 -0
  8. package/dist/cjs/contracts/payment_kit/config.d.ts +14 -0
  9. package/dist/cjs/contracts/payment_kit/config.js +50 -0
  10. package/dist/cjs/contracts/payment_kit/config.js.map +7 -0
  11. package/dist/cjs/contracts/payment_kit/deps/std/type_name.d.ts +14 -0
  12. package/dist/cjs/contracts/payment_kit/deps/std/type_name.js +42 -0
  13. package/dist/cjs/contracts/payment_kit/deps/std/type_name.js.map +7 -0
  14. package/dist/cjs/contracts/payment_kit/deps/sui/object.d.ts +5 -0
  15. package/dist/cjs/contracts/payment_kit/deps/sui/object.js +33 -0
  16. package/dist/cjs/contracts/payment_kit/deps/sui/object.js.map +7 -0
  17. package/dist/cjs/contracts/payment_kit/deps/sui/vec_map.d.ts +27 -0
  18. package/dist/cjs/contracts/payment_kit/deps/sui/vec_map.js +45 -0
  19. package/dist/cjs/contracts/payment_kit/deps/sui/vec_map.js.map +7 -0
  20. package/dist/cjs/contracts/payment_kit/payment_kit.d.ts +233 -0
  21. package/dist/cjs/contracts/payment_kit/payment_kit.js +252 -0
  22. package/dist/cjs/contracts/payment_kit/payment_kit.js.map +7 -0
  23. package/dist/cjs/contracts/utils/index.d.ts +12 -0
  24. package/dist/cjs/contracts/utils/index.js +151 -0
  25. package/dist/cjs/contracts/utils/index.js.map +7 -0
  26. package/dist/cjs/error.d.ts +2 -0
  27. package/dist/cjs/error.js +26 -0
  28. package/dist/cjs/error.js.map +7 -0
  29. package/dist/cjs/index.d.ts +2 -0
  30. package/dist/cjs/index.js +25 -0
  31. package/dist/cjs/index.js.map +7 -0
  32. package/dist/cjs/package.json +5 -0
  33. package/dist/cjs/types.d.ts +10 -0
  34. package/dist/cjs/types.js +17 -0
  35. package/dist/cjs/types.js.map +7 -0
  36. package/dist/esm/client.d.ts +6 -0
  37. package/dist/esm/client.js +45 -0
  38. package/dist/esm/client.js.map +7 -0
  39. package/dist/esm/constants.d.ts +6 -0
  40. package/dist/esm/constants.js +11 -0
  41. package/dist/esm/constants.js.map +7 -0
  42. package/dist/esm/contracts/payment_kit/config.d.ts +14 -0
  43. package/dist/esm/contracts/payment_kit/config.js +20 -0
  44. package/dist/esm/contracts/payment_kit/config.js.map +7 -0
  45. package/dist/esm/contracts/payment_kit/deps/std/type_name.d.ts +14 -0
  46. package/dist/esm/contracts/payment_kit/deps/std/type_name.js +22 -0
  47. package/dist/esm/contracts/payment_kit/deps/std/type_name.js.map +7 -0
  48. package/dist/esm/contracts/payment_kit/deps/sui/object.d.ts +5 -0
  49. package/dist/esm/contracts/payment_kit/deps/sui/object.js +13 -0
  50. package/dist/esm/contracts/payment_kit/deps/sui/object.js.map +7 -0
  51. package/dist/esm/contracts/payment_kit/deps/sui/vec_map.d.ts +27 -0
  52. package/dist/esm/contracts/payment_kit/deps/sui/vec_map.js +25 -0
  53. package/dist/esm/contracts/payment_kit/deps/sui/vec_map.js.map +7 -0
  54. package/dist/esm/contracts/payment_kit/payment_kit.d.ts +233 -0
  55. package/dist/esm/contracts/payment_kit/payment_kit.js +222 -0
  56. package/dist/esm/contracts/payment_kit/payment_kit.js.map +7 -0
  57. package/dist/esm/contracts/utils/index.d.ts +12 -0
  58. package/dist/esm/contracts/utils/index.js +131 -0
  59. package/dist/esm/contracts/utils/index.js.map +7 -0
  60. package/dist/esm/error.d.ts +2 -0
  61. package/dist/esm/error.js +6 -0
  62. package/dist/esm/error.js.map +7 -0
  63. package/dist/esm/index.d.ts +2 -0
  64. package/dist/esm/index.js +5 -0
  65. package/dist/esm/index.js.map +7 -0
  66. package/dist/esm/package.json +5 -0
  67. package/dist/esm/types.d.ts +10 -0
  68. package/dist/esm/types.js +1 -0
  69. package/dist/esm/types.js.map +7 -0
  70. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  71. package/dist/tsconfig.tsbuildinfo +1 -0
  72. package/package.json +42 -0
package/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # `@mysten/payment-kit`
2
+
3
+ > ⚠️ **Warning** - This package is in active development. APIs are experimental and subject to
4
+ > breaking changes without notice. We recommend thoroughly testing any implementation before using
5
+ > in production environments.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install --save @mysten/payment-kit @mysten/sui
11
+ ```
12
+
13
+ ## Setup
14
+
15
+ In order to use the Payment Kit SDK you will first need to create an instance of SuiClient from the
16
+ Typescript SDK, and a client instance of the Payment Kit SDK.
17
+
18
+ ```ts
19
+ import { getFullnodeUrl, SuiClient } from '@mysten/sui/client';
20
+ import { PaymentKitClient } from '@mysten/payment-kit';
21
+
22
+ const suiClient = new SuiClient({
23
+ url: getFullnodeUrl('testnet'),
24
+ network: 'testnet',
25
+ });
26
+
27
+ const paymentKitClient = new PaymentKitClient({
28
+ suiClient,
29
+ });
30
+ ```
31
+
32
+ The Payment Kit SDK already includes all relevant package and object IDs to operate against
33
+ `mainnet` and `testnet`. No other environments are currently supported. By default, all registry
34
+ based payments are routed through a default payment registry, but more on that later.
35
+
36
+ ## SDK Overview
37
+
38
+ The Payment Kit SDK is designed to allow for direct interactions with the
39
+ [sui-payment-kit](https://github.com/MystenLabs/sui-payment-kit) Move Package. This includes:
40
+
41
+ - Processing payments
42
+ - Creating and managing `PaymentRegistry` instances
43
+ - Claiming `PaymentRecord` storage fees
44
+ - Querying the state of a `PaymentRecord`
45
+ - Constructing relevant Object IDs
46
+
47
+ These operations are exposed via a `PaymentKitClient` which provides relevant APIs so an application
48
+ doesn't need to know how payments are processed, receipts are created and registry configurations
49
+ are stored.
50
+
51
+ ### Payment Processing
52
+
53
+ There are two distinct ways in which payments are processed. Registry based payments and Ephemeral
54
+ payments.
55
+
56
+ #### Registry Processed Payments
57
+
58
+ When using a `PaymentRegistry` to process a payment a registry must always be specified. A registry
59
+ has the ability to specify where funds must be sent and how long a `PaymentRecord` can live before
60
+ being eligible for deletion. In addition to registry configurations, a `PaymentRecord` is always
61
+ created when using a registry to process a payment. A `PaymentRecord` enforces that a payment
62
+ request cannot be fulfilled more than once. The existence of a `PaymentRecord` also guarantees that
63
+ a payment has been made. Once a payment has been fulfilled a `PaymentReceipt` is emitted that can be
64
+ used as you please.
65
+
66
+ #### Ephemeral Payments
67
+
68
+ Unlike Registry processed payments, an ephemeral payment does not leverage a registry and does not
69
+ write a `PaymentRecord`. This means duplicate payments are not implicitly prevented. Although, a
70
+ `PaymentReceipt` is still emitted once completed, similar to registry based payments.
71
+
72
+ ### Payment Registries
73
+
74
+ At the core of Payment Kit is the `PaymentRegistry`. Currently, a registry is used to process
75
+ one-time payments, manage how funds are collected and specify the expiration of a `PaymentRecord`.
76
+ While there is a default registry to leverage, entities are encouraged to create and manage their
77
+ own registries. This enables easier indexing of relevant payments and reduces the potential for
78
+ object congestion. Registries are created via personalized name. This name is then used to derive an
79
+ Object ID. This means registry names must be unique.
80
+
81
+ #### Registry Configuration
82
+
83
+ Configurations are applied to an instance of a `PaymentRegistry`. There are currently two
84
+ configurations offered:
85
+
86
+ 1. Receipt Epoch Expiration: The number of epochs that must elapse before a `PaymentReceipt` is
87
+ eligible to be deleted. Deleting expired receipts is a permissionless operation that anyone can
88
+ perform and will result in a small storage rebate for each deleted record, incentivizing
89
+ automatic cleanup up of registries.
90
+
91
+ 2. Registry Managed Funds: A configuration that specifies if payment funds must be sent to the
92
+ registry itself. If a `PaymentRegistry` has set this configuration, the `receiver` must be the
93
+ registry itself. Funds can later be claimed by the registry admin. An added benefit to this
94
+ configuration is avoiding complicated coin merging, when dealing with high thoroughput payments.
95
+ This is because the destination is always the same coin object when the registry is set as the
96
+ fund manager.
97
+
98
+ ### Payment Records
99
+
100
+ As mentioned above, a `PaymentRecord` is only written when using a registry to process a payment.
101
+ This payment record is used to guarantee a payment has been made. But note records can be deleted
102
+ based on a registries epoch expiration duration (the default expiration is 30 epochs after
103
+ creation).
104
+
105
+ #### Payment Keys
106
+
107
+ A `PaymentRecord` is a Dynamic Field owned by the `PaymentRegistry`. This record is derived via a
108
+ `PaymentKey`. A `PaymentKey` is a hash of request payment. This includes the `PaymentID`,
109
+ `PaymentAmount`, `CoinType`, and `ReceiverAddress`.
110
+
111
+ ### Payment Receipts
112
+
113
+ When processing an ephemeral, or registry based, payment a `PaymentReceipt` is always emitted and
114
+ returned. This payment receipt can be stored, off-chain, for whateve purpose it may serve to your
115
+ application.
116
+
117
+ ```ts
118
+ type PaymentReceipt = {
119
+ paymentType: PaymentType;
120
+ paymentId: string;
121
+ amount: number;
122
+ receiver: string;
123
+ coinType: string;
124
+ timestampMs: number;
125
+ };
126
+ ```
@@ -0,0 +1,6 @@
1
+ import type { PaymentKitPackageConfig } from './types.js';
2
+ export declare class PaymentKitClient {
3
+ #private;
4
+ private constructor();
5
+ get packageConfig(): PaymentKitPackageConfig;
6
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __typeError = (msg) => {
7
+ throw TypeError(msg);
8
+ };
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
23
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
24
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
25
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
26
+ var client_exports = {};
27
+ __export(client_exports, {
28
+ PaymentKitClient: () => PaymentKitClient
29
+ });
30
+ module.exports = __toCommonJS(client_exports);
31
+ var import_error = require("./error.js");
32
+ var import_constants = require("./constants.js");
33
+ var _packageConfig, _suiClient;
34
+ class PaymentKitClient {
35
+ constructor(config) {
36
+ __privateAdd(this, _packageConfig);
37
+ // @ts-expect-error - suiClient will be used in a later PR
38
+ __privateAdd(this, _suiClient);
39
+ if (config.suiClient) {
40
+ __privateSet(this, _suiClient, config.suiClient);
41
+ } else {
42
+ throw new import_error.PaymentKitClientError("suiClient must be provided");
43
+ }
44
+ const network = config.suiClient.network;
45
+ switch (network) {
46
+ case "testnet":
47
+ __privateSet(this, _packageConfig, import_constants.TESTNET_PAYMENT_KIT_PACKAGE_CONFIG);
48
+ break;
49
+ case "mainnet":
50
+ __privateSet(this, _packageConfig, import_constants.MAINNET_PAYMENT_KIT_PACKAGE_CONFIG);
51
+ break;
52
+ default:
53
+ throw new import_error.PaymentKitClientError(`Unsupported network: ${network}`);
54
+ }
55
+ }
56
+ get packageConfig() {
57
+ return __privateGet(this, _packageConfig);
58
+ }
59
+ }
60
+ _packageConfig = new WeakMap();
61
+ _suiClient = new WeakMap();
62
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/client.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PaymentKitClientError } from './error.js';\n\nimport {\n\tMAINNET_PAYMENT_KIT_PACKAGE_CONFIG,\n\tTESTNET_PAYMENT_KIT_PACKAGE_CONFIG,\n} from './constants.js';\nimport type {\n\tPaymentKitClientConfig,\n\tPaymentKitCompatibleClient,\n\tPaymentKitPackageConfig,\n} from './types.js';\n\nexport class PaymentKitClient {\n\t#packageConfig: PaymentKitPackageConfig;\n\t// @ts-expect-error - suiClient will be used in a later PR\n\t#suiClient: PaymentKitCompatibleClient;\n\n\tprivate constructor(config: PaymentKitClientConfig) {\n\t\tif (config.suiClient) {\n\t\t\tthis.#suiClient = config.suiClient;\n\t\t} else {\n\t\t\tthrow new PaymentKitClientError('suiClient must be provided');\n\t\t}\n\n\t\tconst network = config.suiClient.network;\n\t\tswitch (network) {\n\t\t\tcase 'testnet':\n\t\t\t\tthis.#packageConfig = TESTNET_PAYMENT_KIT_PACKAGE_CONFIG;\n\t\t\t\tbreak;\n\t\t\tcase 'mainnet':\n\t\t\t\tthis.#packageConfig = MAINNET_PAYMENT_KIT_PACKAGE_CONFIG;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new PaymentKitClientError(`Unsupported network: ${network}`);\n\t\t}\n\t}\n\n\tget packageConfig() {\n\t\treturn this.#packageConfig;\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAsC;AAEtC,uBAGO;AARP;AAeO,MAAM,iBAAiB;AAAA,EAKrB,YAAY,QAAgC;AAJpD;AAEA;AAAA;AAGC,QAAI,OAAO,WAAW;AACrB,yBAAK,YAAa,OAAO;AAAA,IAC1B,OAAO;AACN,YAAM,IAAI,mCAAsB,4BAA4B;AAAA,IAC7D;AAEA,UAAM,UAAU,OAAO,UAAU;AACjC,YAAQ,SAAS;AAAA,MAChB,KAAK;AACJ,2BAAK,gBAAiB;AACtB;AAAA,MACD,KAAK;AACJ,2BAAK,gBAAiB;AACtB;AAAA,MACD;AACC,cAAM,IAAI,mCAAsB,wBAAwB,OAAO,EAAE;AAAA,IACnE;AAAA,EACD;AAAA,EAEA,IAAI,gBAAgB;AACnB,WAAO,mBAAK;AAAA,EACb;AACD;AA3BC;AAEA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ export declare const TESTNET_PAYMENT_KIT_PACKAGE_CONFIG: {
2
+ packageId: string;
3
+ };
4
+ export declare const MAINNET_PAYMENT_KIT_PACKAGE_CONFIG: {
5
+ packageId: string;
6
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var constants_exports = {};
20
+ __export(constants_exports, {
21
+ MAINNET_PAYMENT_KIT_PACKAGE_CONFIG: () => MAINNET_PAYMENT_KIT_PACKAGE_CONFIG,
22
+ TESTNET_PAYMENT_KIT_PACKAGE_CONFIG: () => TESTNET_PAYMENT_KIT_PACKAGE_CONFIG
23
+ });
24
+ module.exports = __toCommonJS(constants_exports);
25
+ const TESTNET_PAYMENT_KIT_PACKAGE_CONFIG = {
26
+ packageId: "0x6d40694388297e1fae93ddbb7ef575ca961af225727c2a389259b29903d0fced"
27
+ };
28
+ const MAINNET_PAYMENT_KIT_PACKAGE_CONFIG = {
29
+ packageId: "0x73cdadfc6c49df26d90055fd40a2b487fbe3021c8a8efed1696fb9cd51d23130"
30
+ };
31
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/constants.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { PaymentKitPackageConfig } from './types.js';\n\nexport const TESTNET_PAYMENT_KIT_PACKAGE_CONFIG = {\n\tpackageId: '0x6d40694388297e1fae93ddbb7ef575ca961af225727c2a389259b29903d0fced',\n} satisfies PaymentKitPackageConfig;\n\nexport const MAINNET_PAYMENT_KIT_PACKAGE_CONFIG = {\n\tpackageId: '0x73cdadfc6c49df26d90055fd40a2b487fbe3021c8a8efed1696fb9cd51d23130',\n} satisfies PaymentKitPackageConfig;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAM,qCAAqC;AAAA,EACjD,WAAW;AACZ;AAEO,MAAM,qCAAqC;AAAA,EACjD,WAAW;AACZ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ import { MoveEnum } from '../utils/index.js';
2
+ export declare const Value: MoveEnum<{
3
+ U64: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
4
+ Address: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
5
+ String: import("@mysten/sui/bcs").BcsType<string, string, "string">;
6
+ AsciiString: import("@mysten/sui/bcs").BcsType<string, string, "string">;
7
+ Bool: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
8
+ Bytes: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
9
+ length: number;
10
+ }, string>;
11
+ Type: import("../utils/index.js").MoveStruct<{
12
+ name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
13
+ }, "std::type_name::TypeName">;
14
+ }, "@local-pkg/payment-kit::config::Value">;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var config_exports = {};
30
+ __export(config_exports, {
31
+ Value: () => Value
32
+ });
33
+ module.exports = __toCommonJS(config_exports);
34
+ var import_utils = require("../utils/index.js");
35
+ var import_bcs = require("@mysten/sui/bcs");
36
+ var type_name = __toESM(require("./deps/std/type_name.js"));
37
+ const $moduleName = "@local-pkg/payment-kit::config";
38
+ const Value = new import_utils.MoveEnum({
39
+ name: `${$moduleName}::Value`,
40
+ fields: {
41
+ U64: import_bcs.bcs.u64(),
42
+ Address: import_bcs.bcs.Address,
43
+ String: import_bcs.bcs.string(),
44
+ AsciiString: import_bcs.bcs.string(),
45
+ Bool: import_bcs.bcs.bool(),
46
+ Bytes: import_bcs.bcs.vector(import_bcs.bcs.u8()),
47
+ Type: type_name.TypeName
48
+ }
49
+ });
50
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/contracts/payment_kit/config.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { MoveEnum } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport * as type_name from './deps/std/type_name.js';\nconst $moduleName = '@local-pkg/payment-kit::config';\nexport const Value = new MoveEnum({\n\tname: `${$moduleName}::Value`,\n\tfields: {\n\t\tU64: bcs.u64(),\n\t\tAddress: bcs.Address,\n\t\tString: bcs.string(),\n\t\tAsciiString: bcs.string(),\n\t\tBool: bcs.bool(),\n\t\tBytes: bcs.vector(bcs.u8()),\n\t\tType: type_name.TypeName,\n\t},\n});\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAyB;AACzB,iBAAoB;AACpB,gBAA2B;AAC3B,MAAM,cAAc;AACb,MAAM,QAAQ,IAAI,sBAAS;AAAA,EACjC,MAAM,GAAG,WAAW;AAAA,EACpB,QAAQ;AAAA,IACP,KAAK,eAAI,IAAI;AAAA,IACb,SAAS,eAAI;AAAA,IACb,QAAQ,eAAI,OAAO;AAAA,IACnB,aAAa,eAAI,OAAO;AAAA,IACxB,MAAM,eAAI,KAAK;AAAA,IACf,OAAO,eAAI,OAAO,eAAI,GAAG,CAAC;AAAA,IAC1B,MAAM,UAAU;AAAA,EACjB;AACD,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ /** Functionality for converting Move types into values. Use with care! */
2
+ import { MoveStruct } from '../../../utils/index.js';
3
+ export declare const TypeName: MoveStruct<{
4
+ /**
5
+ * String representation of the type. All types are represented using their source
6
+ * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
7
+ * Struct types are represented as fully qualified type names; e.g.
8
+ * `00000000000000000000000000000001::string::String` or
9
+ * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
10
+ * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
11
+ * 32 depending on the Move platform)
12
+ */
13
+ name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
14
+ }, "std::type_name::TypeName">;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var type_name_exports = {};
20
+ __export(type_name_exports, {
21
+ TypeName: () => TypeName
22
+ });
23
+ module.exports = __toCommonJS(type_name_exports);
24
+ var import_utils = require("../../../utils/index.js");
25
+ var import_bcs = require("@mysten/sui/bcs");
26
+ const $moduleName = "std::type_name";
27
+ const TypeName = new import_utils.MoveStruct({
28
+ name: `${$moduleName}::TypeName`,
29
+ fields: {
30
+ /**
31
+ * String representation of the type. All types are represented using their source
32
+ * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
33
+ * Struct types are represented as fully qualified type names; e.g.
34
+ * `00000000000000000000000000000001::string::String` or
35
+ * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
36
+ * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
37
+ * 32 depending on the Move platform)
38
+ */
39
+ name: import_bcs.bcs.string()
40
+ }
41
+ });
42
+ //# sourceMappingURL=type_name.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/contracts/payment_kit/deps/std/type_name.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAA2B;AAC3B,iBAAoB;AACpB,MAAM,cAAc;AACb,MAAM,WAAW,IAAI,wBAAW;AAAA,EACtC,MAAM,GAAG,WAAW;AAAA,EACpB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUP,MAAM,eAAI,OAAO;AAAA,EAClB;AACD,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ /** Sui object identifiers */
2
+ import { MoveStruct } from '../../../utils/index.js';
3
+ export declare const UID: MoveStruct<{
4
+ id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
5
+ }, "0x2::object::UID">;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var object_exports = {};
20
+ __export(object_exports, {
21
+ UID: () => UID
22
+ });
23
+ module.exports = __toCommonJS(object_exports);
24
+ var import_utils = require("../../../utils/index.js");
25
+ var import_bcs = require("@mysten/sui/bcs");
26
+ const $moduleName = "0x2::object";
27
+ const UID = new import_utils.MoveStruct({
28
+ name: `${$moduleName}::UID`,
29
+ fields: {
30
+ id: import_bcs.bcs.Address
31
+ }
32
+ });
33
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/contracts/payment_kit/deps/sui/object.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n/** Sui object identifiers */\n\nimport { MoveStruct } from '../../../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nconst $moduleName = '0x2::object';\nexport const UID = new MoveStruct({\n\tname: `${$moduleName}::UID`,\n\tfields: {\n\t\tid: bcs.Address,\n\t},\n});\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAA2B;AAC3B,iBAAoB;AACpB,MAAM,cAAc;AACb,MAAM,MAAM,IAAI,wBAAW;AAAA,EACjC,MAAM,GAAG,WAAW;AAAA,EACpB,QAAQ;AAAA,IACP,IAAI,eAAI;AAAA,EACT;AACD,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,27 @@
1
+ import type { BcsType } from '@mysten/sui/bcs';
2
+ import { MoveStruct } from '../../../utils/index.js';
3
+ /** An entry in the map */
4
+ export declare function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]): MoveStruct<{
5
+ key: K;
6
+ value: V;
7
+ }, `0x2::vec_map::Entry<${K["name"]}, ${V["name"]}>`>;
8
+ /**
9
+ * A map data structure backed by a vector. The map is guaranteed not to contain
10
+ * duplicate keys, but entries are _not_ sorted by key--entries are included in
11
+ * insertion order. All operations are O(N) in the size of the map--the intention
12
+ * of this data structure is only to provide the convenience of programming against
13
+ * a map API. Large maps should use handwritten parent/child relationships instead.
14
+ * Maps that need sorted iteration rather than insertion order iteration should
15
+ * also be handwritten.
16
+ */
17
+ export declare function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]): MoveStruct<{
18
+ contents: BcsType<{
19
+ key: K extends BcsType<infer U, any, string> ? U : never;
20
+ value: V extends BcsType<infer U, any, string> ? U : never;
21
+ }[], Iterable<{
22
+ key: K extends BcsType<any, infer U_1, string> ? U_1 : never;
23
+ value: V extends BcsType<any, infer U_1, string> ? U_1 : never;
24
+ }> & {
25
+ length: number;
26
+ }, string>;
27
+ }, `0x2::vec_map::VecMap<${K["name"]}, ${V["name"]}>`>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var vec_map_exports = {};
20
+ __export(vec_map_exports, {
21
+ Entry: () => Entry,
22
+ VecMap: () => VecMap
23
+ });
24
+ module.exports = __toCommonJS(vec_map_exports);
25
+ var import_bcs = require("@mysten/sui/bcs");
26
+ var import_utils = require("../../../utils/index.js");
27
+ const $moduleName = "0x2::vec_map";
28
+ function Entry(...typeParameters) {
29
+ return new import_utils.MoveStruct({
30
+ name: `${$moduleName}::Entry<${typeParameters[0].name}, ${typeParameters[1].name}>`,
31
+ fields: {
32
+ key: typeParameters[0],
33
+ value: typeParameters[1]
34
+ }
35
+ });
36
+ }
37
+ function VecMap(...typeParameters) {
38
+ return new import_utils.MoveStruct({
39
+ name: `${$moduleName}::VecMap<${typeParameters[0].name}, ${typeParameters[1].name}>`,
40
+ fields: {
41
+ contents: import_bcs.bcs.vector(Entry(typeParameters[0], typeParameters[1]))
42
+ }
43
+ });
44
+ }
45
+ //# sourceMappingURL=vec_map.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/contracts/payment_kit/deps/sui/vec_map.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { bcs } from '@mysten/sui/bcs';\nimport type { BcsType } 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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAoB;AAEpB,mBAA2B;AAC3B,MAAM,cAAc;AAEb,SAAS,SAAyD,gBAAwB;AAChG,SAAO,IAAI,wBAAW;AAAA,IACrB,MAAM,GAAG,WAAW,WAAW,eAAe,CAAC,EAAE,IAAiB,KAAK,eAAe,CAAC,EAAE,IAAiB;AAAA,IAC1G,QAAQ;AAAA,MACP,KAAK,eAAe,CAAC;AAAA,MACrB,OAAO,eAAe,CAAC;AAAA,IACxB;AAAA,EACD,CAAC;AACF;AAUO,SAAS,UAA0D,gBAAwB;AACjG,SAAO,IAAI,wBAAW;AAAA,IACrB,MAAM,GAAG,WAAW,YAAY,eAAe,CAAC,EAAE,IAAiB,KAAK,eAAe,CAAC,EAAE,IAAiB;AAAA,IAC3G,QAAQ;AAAA,MACP,UAAU,eAAI,OAAO,MAAM,eAAe,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;AAAA,IACjE;AAAA,EACD,CAAC;AACF;",
6
+ "names": []
7
+ }