@mysten/payment-kit 0.0.2 → 0.0.3
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.
- package/README.md +2 -2
- package/dist/cjs/calls.d.ts +26 -0
- package/dist/cjs/calls.js +90 -0
- package/dist/cjs/calls.js.map +7 -0
- package/dist/cjs/client.d.ts +15 -2
- package/dist/cjs/client.js +43 -3
- package/dist/cjs/client.js.map +3 -3
- package/dist/cjs/constants.d.ts +4 -0
- package/dist/cjs/constants.js +9 -2
- package/dist/cjs/constants.js.map +2 -2
- package/dist/cjs/contracts/payment_kit/config.d.ts +1 -1
- package/dist/cjs/contracts/payment_kit/config.js +1 -1
- package/dist/cjs/contracts/payment_kit/config.js.map +1 -1
- package/dist/cjs/contracts/payment_kit/payment_kit.d.ts +10 -10
- package/dist/cjs/contracts/payment_kit/payment_kit.js +10 -10
- package/dist/cjs/contracts/payment_kit/payment_kit.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/transactions.d.ts +28 -0
- package/dist/cjs/transactions.js +66 -0
- package/dist/cjs/transactions.js.map +7 -0
- package/dist/cjs/types.d.ts +27 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils.d.ts +1 -0
- package/dist/cjs/utils.js +33 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/esm/calls.d.ts +26 -0
- package/dist/esm/calls.js +73 -0
- package/dist/esm/calls.js.map +7 -0
- package/dist/esm/client.d.ts +15 -2
- package/dist/esm/client.js +43 -3
- package/dist/esm/client.js.map +2 -2
- package/dist/esm/constants.d.ts +4 -0
- package/dist/esm/constants.js +9 -2
- package/dist/esm/constants.js.map +2 -2
- package/dist/esm/contracts/payment_kit/config.d.ts +1 -1
- package/dist/esm/contracts/payment_kit/config.js +1 -1
- package/dist/esm/contracts/payment_kit/config.js.map +1 -1
- package/dist/esm/contracts/payment_kit/payment_kit.d.ts +10 -10
- package/dist/esm/contracts/payment_kit/payment_kit.js +10 -10
- package/dist/esm/contracts/payment_kit/payment_kit.js.map +1 -1
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/transactions.d.ts +28 -0
- package/dist/esm/transactions.js +46 -0
- package/dist/esm/transactions.js.map +7 -0
- package/dist/esm/types.d.ts +27 -0
- package/dist/esm/utils.d.ts +1 -0
- package/dist/esm/utils.js +13 -0
- package/dist/esm/utils.js.map +7 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import type { ProcessEphemeralPaymentParams, ProcessRegistryPaymentParams } from './types.js';
|
|
3
|
+
import type { PaymentKitCalls } from './calls.js';
|
|
4
|
+
export interface PaymentKitTransactionsOptions {
|
|
5
|
+
calls: PaymentKitCalls;
|
|
6
|
+
}
|
|
7
|
+
export declare class PaymentKitTransactions {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(options: PaymentKitTransactionsOptions);
|
|
10
|
+
/**
|
|
11
|
+
* Creates a `processRegistryPayment` transaction
|
|
12
|
+
*
|
|
13
|
+
* @usage
|
|
14
|
+
* ```ts
|
|
15
|
+
* const tx = client.paymentKit.tx.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
processRegistryPayment(params: ProcessRegistryPaymentParams): Transaction;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a `processEphemeralPayment` transaction
|
|
21
|
+
*
|
|
22
|
+
* @usage
|
|
23
|
+
* ```ts
|
|
24
|
+
* const tx = client.paymentKit.tx.const({ nonce, coinType, sender, amount, receiver });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
processEphemeralPayment(params: ProcessEphemeralPaymentParams): Transaction;
|
|
28
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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 transactions_exports = {};
|
|
27
|
+
__export(transactions_exports, {
|
|
28
|
+
PaymentKitTransactions: () => PaymentKitTransactions
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(transactions_exports);
|
|
31
|
+
var import_transactions = require("@mysten/sui/transactions");
|
|
32
|
+
var _calls;
|
|
33
|
+
class PaymentKitTransactions {
|
|
34
|
+
constructor(options) {
|
|
35
|
+
__privateAdd(this, _calls);
|
|
36
|
+
__privateSet(this, _calls, options.calls);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Creates a `processRegistryPayment` transaction
|
|
40
|
+
*
|
|
41
|
+
* @usage
|
|
42
|
+
* ```ts
|
|
43
|
+
* const tx = client.paymentKit.tx.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
processRegistryPayment(params) {
|
|
47
|
+
const tx = new import_transactions.Transaction();
|
|
48
|
+
tx.add(__privateGet(this, _calls).processRegistryPayment(params));
|
|
49
|
+
return tx;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Creates a `processEphemeralPayment` transaction
|
|
53
|
+
*
|
|
54
|
+
* @usage
|
|
55
|
+
* ```ts
|
|
56
|
+
* const tx = client.paymentKit.tx.const({ nonce, coinType, sender, amount, receiver });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
processEphemeralPayment(params) {
|
|
60
|
+
const tx = new import_transactions.Transaction();
|
|
61
|
+
tx.add(__privateGet(this, _calls).processEphemeralPayment(params));
|
|
62
|
+
return tx;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
_calls = new WeakMap();
|
|
66
|
+
//# sourceMappingURL=transactions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/transactions.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Transaction } from '@mysten/sui/transactions';\nimport type { ProcessEphemeralPaymentParams, ProcessRegistryPaymentParams } from './types.js';\nimport type { PaymentKitCalls } from './calls.js';\n\nexport interface PaymentKitTransactionsOptions {\n\tcalls: PaymentKitCalls;\n}\n\nexport class PaymentKitTransactions {\n\t#calls: PaymentKitCalls;\n\n\tconstructor(options: PaymentKitTransactionsOptions) {\n\t\tthis.#calls = options.calls;\n\t}\n\n\t/**\n\t * Creates a `processRegistryPayment` transaction\n\t *\n\t * @usage\n\t * ```ts\n\t * const tx = client.paymentKit.tx.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName });\n\t * ```\n\t */\n\tprocessRegistryPayment(params: ProcessRegistryPaymentParams) {\n\t\tconst tx = new Transaction();\n\t\ttx.add(this.#calls.processRegistryPayment(params));\n\n\t\treturn tx;\n\t}\n\n\t/**\n\t * Creates a `processEphemeralPayment` transaction\n\t *\n\t * @usage\n\t * ```ts\n\t * const tx = client.paymentKit.tx.const({ nonce, coinType, sender, amount, receiver });\n\t * ```\n\t */\n\tprocessEphemeralPayment(params: ProcessEphemeralPaymentParams) {\n\t\tconst tx = new Transaction();\n\t\ttx.add(this.#calls.processEphemeralPayment(params));\n\n\t\treturn tx;\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA4B;AAH5B;AAWO,MAAM,uBAAuB;AAAA,EAGnC,YAAY,SAAwC;AAFpD;AAGC,uBAAK,QAAS,QAAQ;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,uBAAuB,QAAsC;AAC5D,UAAM,KAAK,IAAI,gCAAY;AAC3B,OAAG,IAAI,mBAAK,QAAO,uBAAuB,MAAM,CAAC;AAEjD,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,wBAAwB,QAAuC;AAC9D,UAAM,KAAK,IAAI,gCAAY;AAC3B,OAAG,IAAI,mBAAK,QAAO,wBAAwB,MAAM,CAAC;AAElD,WAAO;AAAA,EACR;AACD;AAnCC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
import type { ClientWithCoreApi } from '@mysten/sui/experimental';
|
|
2
2
|
export type PaymentKitPackageConfig = {
|
|
3
3
|
packageId: string;
|
|
4
|
+
namespaceId: string;
|
|
4
5
|
};
|
|
5
6
|
export interface PaymentKitCompatibleClient extends ClientWithCoreApi {
|
|
6
7
|
}
|
|
7
8
|
export interface PaymentKitClientOptions {
|
|
8
9
|
client: PaymentKitCompatibleClient;
|
|
9
10
|
}
|
|
11
|
+
export type Registry = {
|
|
12
|
+
registryName: string;
|
|
13
|
+
registryId?: never;
|
|
14
|
+
} | {
|
|
15
|
+
registryName?: never;
|
|
16
|
+
registryId: string;
|
|
17
|
+
};
|
|
18
|
+
export type GetPaymentRecordParams = {
|
|
19
|
+
nonce: string;
|
|
20
|
+
amount: number | bigint;
|
|
21
|
+
receiver: string;
|
|
22
|
+
coinType: string;
|
|
23
|
+
} & Registry;
|
|
24
|
+
export interface GetPaymentRecordResponse {
|
|
25
|
+
key: string;
|
|
26
|
+
paymentTransactionDigest: string | null;
|
|
27
|
+
epochAtTimeOfRecord: string;
|
|
28
|
+
}
|
|
29
|
+
export type ProcessEphemeralPaymentParams = {
|
|
30
|
+
nonce: string;
|
|
31
|
+
coinType: string;
|
|
32
|
+
sender: string;
|
|
33
|
+
amount: number | bigint;
|
|
34
|
+
receiver: string;
|
|
35
|
+
};
|
|
36
|
+
export type ProcessRegistryPaymentParams = ProcessEphemeralPaymentParams & Registry;
|
package/dist/cjs/types.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ClientWithCoreApi } from '@mysten/sui/experimental';\n\nexport type PaymentKitPackageConfig = {\n\tpackageId: string;\n};\n\nexport interface PaymentKitCompatibleClient extends ClientWithCoreApi {}\n\nexport interface PaymentKitClientOptions {\n\tclient: PaymentKitCompatibleClient;\n}\n"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ClientWithCoreApi } from '@mysten/sui/experimental';\n\nexport type PaymentKitPackageConfig = {\n\tpackageId: string;\n\tnamespaceId: string;\n};\n\nexport interface PaymentKitCompatibleClient extends ClientWithCoreApi {}\n\nexport interface PaymentKitClientOptions {\n\tclient: PaymentKitCompatibleClient;\n}\n\nexport type Registry =\n\t| { registryName: string; registryId?: never }\n\t| { registryName?: never; registryId: string };\n\nexport type GetPaymentRecordParams = {\n\tnonce: string;\n\tamount: number | bigint;\n\treceiver: string;\n\tcoinType: string;\n} & Registry;\n\nexport interface GetPaymentRecordResponse {\n\tkey: string;\n\tpaymentTransactionDigest: string | null;\n\tepochAtTimeOfRecord: string;\n}\n\nexport type ProcessEphemeralPaymentParams = {\n\tnonce: string;\n\tcoinType: string;\n\tsender: string;\n\tamount: number | bigint;\n\treceiver: string;\n};\n\nexport type ProcessRegistryPaymentParams = ProcessEphemeralPaymentParams & Registry;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getRegistryIdFromName: (registryName: string, namespaceId: string) => string;
|
|
@@ -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 utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
getRegistryIdFromName: () => getRegistryIdFromName
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(utils_exports);
|
|
24
|
+
var import_bcs = require("@mysten/sui/bcs");
|
|
25
|
+
var import_utils = require("@mysten/sui/utils");
|
|
26
|
+
const getRegistryIdFromName = (registryName, namespaceId) => {
|
|
27
|
+
return (0, import_utils.deriveObjectID)(
|
|
28
|
+
namespaceId,
|
|
29
|
+
"0x1::ascii::String",
|
|
30
|
+
import_bcs.bcs.String.serialize(registryName).toBytes()
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bcs } from '@mysten/sui/bcs';\nimport { deriveObjectID } from '@mysten/sui/utils';\n\nexport const getRegistryIdFromName = (registryName: string, namespaceId: string) => {\n\treturn deriveObjectID(\n\t\tnamespaceId,\n\t\t'0x1::ascii::String',\n\t\tbcs.String.serialize(registryName).toBytes(),\n\t);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAAoB;AACpB,mBAA+B;AAExB,MAAM,wBAAwB,CAAC,cAAsB,gBAAwB;AACnF,aAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA,eAAI,OAAO,UAAU,YAAY,EAAE,QAAQ;AAAA,EAC5C;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PaymentKitPackageConfig, ProcessEphemeralPaymentParams, ProcessRegistryPaymentParams } from './types.js';
|
|
2
|
+
export interface PaymentKitCallOptions {
|
|
3
|
+
packageConfig: PaymentKitPackageConfig;
|
|
4
|
+
}
|
|
5
|
+
export declare class PaymentKitCalls {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(options: PaymentKitCallOptions);
|
|
8
|
+
/**
|
|
9
|
+
* Creates a `processRegistryPayment` transaction
|
|
10
|
+
*
|
|
11
|
+
* @usage
|
|
12
|
+
* ```ts
|
|
13
|
+
* tx.add(lient.paymentKit.call.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName }));
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
processRegistryPayment: (params: ProcessRegistryPaymentParams) => (tx: import("@mysten/sui/transactions").Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a `processRegistryPayment` transaction
|
|
19
|
+
*
|
|
20
|
+
* @usage
|
|
21
|
+
* ```ts
|
|
22
|
+
* tx.add(client.paymentKit.call.processEphemeralPayment({ nonce, coinType, sender, amount, receiver }));
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
processEphemeralPayment: (params: ProcessEphemeralPaymentParams) => (tx: import("@mysten/sui/transactions").Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
26
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __typeError = (msg) => {
|
|
2
|
+
throw TypeError(msg);
|
|
3
|
+
};
|
|
4
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
5
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6
|
+
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);
|
|
7
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
8
|
+
var _packageConfig;
|
|
9
|
+
import { coinWithBalance } from "@mysten/sui/transactions";
|
|
10
|
+
import {
|
|
11
|
+
processEphemeralPayment,
|
|
12
|
+
processRegistryPayment
|
|
13
|
+
} from "./contracts/payment_kit/payment_kit.js";
|
|
14
|
+
import { getRegistryIdFromName } from "./utils.js";
|
|
15
|
+
class PaymentKitCalls {
|
|
16
|
+
constructor(options) {
|
|
17
|
+
__privateAdd(this, _packageConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Creates a `processRegistryPayment` transaction
|
|
20
|
+
*
|
|
21
|
+
* @usage
|
|
22
|
+
* ```ts
|
|
23
|
+
* tx.add(lient.paymentKit.call.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName }));
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
this.processRegistryPayment = (params) => {
|
|
27
|
+
const { nonce, coinType, amount, receiver, registryName, registryId } = params;
|
|
28
|
+
const registryIdToUse = registryId ?? getRegistryIdFromName(registryName, __privateGet(this, _packageConfig).namespaceId);
|
|
29
|
+
return processRegistryPayment({
|
|
30
|
+
arguments: {
|
|
31
|
+
registry: registryIdToUse,
|
|
32
|
+
nonce,
|
|
33
|
+
paymentAmount: amount,
|
|
34
|
+
coin: coinWithBalance({
|
|
35
|
+
type: coinType,
|
|
36
|
+
balance: amount
|
|
37
|
+
}),
|
|
38
|
+
receiver
|
|
39
|
+
},
|
|
40
|
+
typeArguments: [coinType]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Creates a `processRegistryPayment` transaction
|
|
45
|
+
*
|
|
46
|
+
* @usage
|
|
47
|
+
* ```ts
|
|
48
|
+
* tx.add(client.paymentKit.call.processEphemeralPayment({ nonce, coinType, sender, amount, receiver }));
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
this.processEphemeralPayment = (params) => {
|
|
52
|
+
const { nonce, coinType, amount, receiver } = params;
|
|
53
|
+
return processEphemeralPayment({
|
|
54
|
+
arguments: {
|
|
55
|
+
nonce,
|
|
56
|
+
paymentAmount: amount,
|
|
57
|
+
coin: coinWithBalance({
|
|
58
|
+
type: coinType,
|
|
59
|
+
balance: amount
|
|
60
|
+
}),
|
|
61
|
+
receiver
|
|
62
|
+
},
|
|
63
|
+
typeArguments: [coinType]
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
__privateSet(this, _packageConfig, options.packageConfig);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
_packageConfig = new WeakMap();
|
|
70
|
+
export {
|
|
71
|
+
PaymentKitCalls
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=calls.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/calls.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { coinWithBalance } from '@mysten/sui/transactions';\nimport type {\n\tPaymentKitPackageConfig,\n\tProcessEphemeralPaymentParams,\n\tProcessRegistryPaymentParams,\n} from './types.js';\nimport {\n\tprocessEphemeralPayment,\n\tprocessRegistryPayment,\n} from './contracts/payment_kit/payment_kit.js';\nimport { getRegistryIdFromName } from './utils.js';\n\nexport interface PaymentKitCallOptions {\n\tpackageConfig: PaymentKitPackageConfig;\n}\n\nexport class PaymentKitCalls {\n\t#packageConfig: PaymentKitPackageConfig;\n\n\tconstructor(options: PaymentKitCallOptions) {\n\t\tthis.#packageConfig = options.packageConfig;\n\t}\n\n\t/**\n\t * Creates a `processRegistryPayment` transaction\n\t *\n\t * @usage\n\t * ```ts\n\t * tx.add(lient.paymentKit.call.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName }));\n\t * ```\n\t */\n\tprocessRegistryPayment = (params: ProcessRegistryPaymentParams) => {\n\t\tconst { nonce, coinType, amount, receiver, registryName, registryId } = params;\n\t\tconst registryIdToUse =\n\t\t\tregistryId ?? getRegistryIdFromName(registryName, this.#packageConfig.namespaceId);\n\n\t\treturn processRegistryPayment({\n\t\t\targuments: {\n\t\t\t\tregistry: registryIdToUse,\n\t\t\t\tnonce,\n\t\t\t\tpaymentAmount: amount,\n\t\t\t\tcoin: coinWithBalance({\n\t\t\t\t\ttype: coinType,\n\t\t\t\t\tbalance: amount,\n\t\t\t\t}),\n\t\t\t\treceiver,\n\t\t\t},\n\t\t\ttypeArguments: [coinType],\n\t\t});\n\t};\n\n\t/**\n\t * Creates a `processRegistryPayment` transaction\n\t *\n\t * @usage\n\t * ```ts\n\t * tx.add(client.paymentKit.call.processEphemeralPayment({ nonce, coinType, sender, amount, receiver }));\n\t * ```\n\t */\n\tprocessEphemeralPayment = (params: ProcessEphemeralPaymentParams) => {\n\t\tconst { nonce, coinType, amount, receiver } = params;\n\n\t\treturn processEphemeralPayment({\n\t\t\targuments: {\n\t\t\t\tnonce: nonce,\n\t\t\t\tpaymentAmount: amount,\n\t\t\t\tcoin: coinWithBalance({\n\t\t\t\t\ttype: coinType,\n\t\t\t\t\tbalance: amount,\n\t\t\t\t}),\n\t\t\t\treceiver,\n\t\t\t},\n\t\t\ttypeArguments: [coinType],\n\t\t});\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAAA;AAGA,SAAS,uBAAuB;AAMhC;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,6BAA6B;AAM/B,MAAM,gBAAgB;AAAA,EAG5B,YAAY,SAAgC;AAF5C;AAcA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAyB,CAAC,WAAyC;AAClE,YAAM,EAAE,OAAO,UAAU,QAAQ,UAAU,cAAc,WAAW,IAAI;AACxE,YAAM,kBACL,cAAc,sBAAsB,cAAc,mBAAK,gBAAe,WAAW;AAElF,aAAO,uBAAuB;AAAA,QAC7B,WAAW;AAAA,UACV,UAAU;AAAA,UACV;AAAA,UACA,eAAe;AAAA,UACf,MAAM,gBAAgB;AAAA,YACrB,MAAM;AAAA,YACN,SAAS;AAAA,UACV,CAAC;AAAA,UACD;AAAA,QACD;AAAA,QACA,eAAe,CAAC,QAAQ;AAAA,MACzB,CAAC;AAAA,IACF;AAUA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAA0B,CAAC,WAA0C;AACpE,YAAM,EAAE,OAAO,UAAU,QAAQ,SAAS,IAAI;AAE9C,aAAO,wBAAwB;AAAA,QAC9B,WAAW;AAAA,UACV;AAAA,UACA,eAAe;AAAA,UACf,MAAM,gBAAgB;AAAA,YACrB,MAAM;AAAA,YACN,SAAS;AAAA,UACV,CAAC;AAAA,UACD;AAAA,QACD;AAAA,QACA,eAAe,CAAC,QAAQ;AAAA,MACzB,CAAC;AAAA,IACF;AAtDC,uBAAK,gBAAiB,QAAQ;AAAA,EAC/B;AAsDD;AA1DC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import type { PaymentKitCompatibleClient,
|
|
1
|
+
import type { PaymentKitCompatibleClient, GetPaymentRecordParams, GetPaymentRecordResponse } from './types.js';
|
|
2
2
|
import type { SuiClientRegistration } from '@mysten/sui/experimental';
|
|
3
|
+
import { PaymentKitTransactions } from './transactions.js';
|
|
4
|
+
import { PaymentKitCalls } from './calls.js';
|
|
3
5
|
export declare class PaymentKitClient {
|
|
4
6
|
#private;
|
|
7
|
+
calls: PaymentKitCalls;
|
|
8
|
+
tx: PaymentKitTransactions;
|
|
5
9
|
private constructor();
|
|
6
10
|
static asClientExtension(): SuiClientRegistration<PaymentKitCompatibleClient, 'paymentKit', PaymentKitClient>;
|
|
7
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Query for a payment record in a registry.
|
|
13
|
+
* Returns the payment record data if it exists, null otherwise.
|
|
14
|
+
*
|
|
15
|
+
* @usage
|
|
16
|
+
* ```ts
|
|
17
|
+
* const paymentRecord = await client.getPaymentRecord({ registry, nonce, amount, receiver, coinType });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
getPaymentRecord(params: GetPaymentRecordParams): Promise<GetPaymentRecordResponse | null>;
|
|
8
21
|
}
|
package/dist/esm/client.js
CHANGED
|
@@ -11,10 +11,14 @@ import {
|
|
|
11
11
|
MAINNET_PAYMENT_KIT_PACKAGE_CONFIG,
|
|
12
12
|
TESTNET_PAYMENT_KIT_PACKAGE_CONFIG
|
|
13
13
|
} from "./constants.js";
|
|
14
|
+
import { PaymentKey, PaymentRecord } from "./contracts/payment_kit/payment_kit.js";
|
|
15
|
+
import { normalizeStructTag } from "@mysten/sui/utils";
|
|
16
|
+
import { PaymentKitTransactions } from "./transactions.js";
|
|
17
|
+
import { PaymentKitCalls } from "./calls.js";
|
|
18
|
+
import { getRegistryIdFromName } from "./utils.js";
|
|
14
19
|
const _PaymentKitClient = class _PaymentKitClient {
|
|
15
20
|
constructor(options) {
|
|
16
21
|
__privateAdd(this, _packageConfig);
|
|
17
|
-
// @ts-expect-error - suiClient will be used in a later PR
|
|
18
22
|
__privateAdd(this, _client);
|
|
19
23
|
if (options.client) {
|
|
20
24
|
__privateSet(this, _client, options.client);
|
|
@@ -32,6 +36,10 @@ const _PaymentKitClient = class _PaymentKitClient {
|
|
|
32
36
|
default:
|
|
33
37
|
throw new PaymentKitClientError(`Unsupported network: ${network}`);
|
|
34
38
|
}
|
|
39
|
+
this.calls = new PaymentKitCalls({ packageConfig: __privateGet(this, _packageConfig) });
|
|
40
|
+
this.tx = new PaymentKitTransactions({
|
|
41
|
+
calls: this.calls
|
|
42
|
+
});
|
|
35
43
|
}
|
|
36
44
|
static asClientExtension() {
|
|
37
45
|
return {
|
|
@@ -41,8 +49,40 @@ const _PaymentKitClient = class _PaymentKitClient {
|
|
|
41
49
|
}
|
|
42
50
|
};
|
|
43
51
|
}
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Query for a payment record in a registry.
|
|
54
|
+
* Returns the payment record data if it exists, null otherwise.
|
|
55
|
+
*
|
|
56
|
+
* @usage
|
|
57
|
+
* ```ts
|
|
58
|
+
* const paymentRecord = await client.getPaymentRecord({ registry, nonce, amount, receiver, coinType });
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
async getPaymentRecord(params) {
|
|
62
|
+
const { coinType, registryId, registryName, nonce, amount, receiver } = params;
|
|
63
|
+
const normalizedCoinType = normalizeStructTag(coinType);
|
|
64
|
+
const paymentKeyType = `${PaymentKey.name}<${normalizedCoinType}>`;
|
|
65
|
+
const registryIdToUse = registryId ?? getRegistryIdFromName(registryName, __privateGet(this, _packageConfig).namespaceId);
|
|
66
|
+
const result = await __privateGet(this, _client).core.getDynamicField({
|
|
67
|
+
parentId: registryIdToUse,
|
|
68
|
+
name: {
|
|
69
|
+
type: paymentKeyType,
|
|
70
|
+
bcs: PaymentKey.serialize({
|
|
71
|
+
nonce,
|
|
72
|
+
payment_amount: amount,
|
|
73
|
+
receiver
|
|
74
|
+
}).toBytes()
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
if (!result?.dynamicField) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const decoded = PaymentRecord.parse(result.dynamicField.value.bcs);
|
|
81
|
+
return {
|
|
82
|
+
key: result.dynamicField.id,
|
|
83
|
+
paymentTransactionDigest: result.dynamicField.previousTransaction,
|
|
84
|
+
epochAtTimeOfRecord: decoded.epoch_at_time_of_record
|
|
85
|
+
};
|
|
46
86
|
}
|
|
47
87
|
};
|
|
48
88
|
_packageConfig = new WeakMap();
|
package/dist/esm/client.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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';\
|
|
5
|
-
"mappings": ";;;;;;;AAAA;AAGA,SAAS,6BAA6B;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PaymentKitClientError } from './error.js';\nimport {\n\tMAINNET_PAYMENT_KIT_PACKAGE_CONFIG,\n\tTESTNET_PAYMENT_KIT_PACKAGE_CONFIG,\n} from './constants.js';\nimport { PaymentKey, PaymentRecord } from './contracts/payment_kit/payment_kit.js';\nimport type {\n\tPaymentKitCompatibleClient,\n\tPaymentKitPackageConfig,\n\tPaymentKitClientOptions,\n\tGetPaymentRecordParams,\n\tGetPaymentRecordResponse,\n} from './types.js';\nimport type { SuiClientRegistration } from '@mysten/sui/experimental';\nimport { normalizeStructTag } from '@mysten/sui/utils';\nimport { PaymentKitTransactions } from './transactions.js';\nimport { PaymentKitCalls } from './calls.js';\nimport { getRegistryIdFromName } from './utils.js';\n\nexport class PaymentKitClient {\n\t#packageConfig: PaymentKitPackageConfig;\n\t#client: PaymentKitCompatibleClient;\n\n\tcalls: PaymentKitCalls;\n\ttx: PaymentKitTransactions;\n\n\tprivate constructor(options: PaymentKitClientOptions) {\n\t\tif (options.client) {\n\t\t\tthis.#client = options.client;\n\t\t} else {\n\t\t\tthrow new PaymentKitClientError('suiClient must be provided');\n\t\t}\n\n\t\tconst network = options.client.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\n\t\tthis.calls = new PaymentKitCalls({ packageConfig: this.#packageConfig });\n\t\tthis.tx = new PaymentKitTransactions({\n\t\t\tcalls: this.calls,\n\t\t});\n\t}\n\n\tstatic asClientExtension(): SuiClientRegistration<\n\t\tPaymentKitCompatibleClient,\n\t\t'paymentKit',\n\t\tPaymentKitClient\n\t> {\n\t\treturn {\n\t\t\tname: 'paymentKit' as const,\n\t\t\tregister: (client) => {\n\t\t\t\treturn new PaymentKitClient({ client });\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Query for a payment record in a registry.\n\t * Returns the payment record data if it exists, null otherwise.\n\t *\n\t * @usage\n\t * ```ts\n\t * const paymentRecord = await client.getPaymentRecord({ registry, nonce, amount, receiver, coinType });\n\t * ```\n\t */\n\tasync getPaymentRecord(params: GetPaymentRecordParams): Promise<GetPaymentRecordResponse | null> {\n\t\tconst { coinType, registryId, registryName, nonce, amount, receiver } = params;\n\t\tconst normalizedCoinType = normalizeStructTag(coinType);\n\t\tconst paymentKeyType = `${PaymentKey.name}<${normalizedCoinType}>`;\n\n\t\tconst registryIdToUse =\n\t\t\tregistryId ?? getRegistryIdFromName(registryName, this.#packageConfig.namespaceId);\n\t\tconst result = await this.#client.core.getDynamicField({\n\t\t\tparentId: registryIdToUse,\n\t\t\tname: {\n\t\t\t\ttype: paymentKeyType,\n\t\t\t\tbcs: PaymentKey.serialize({\n\t\t\t\t\tnonce,\n\t\t\t\t\tpayment_amount: amount,\n\t\t\t\t\treceiver,\n\t\t\t\t}).toBytes(),\n\t\t\t},\n\t\t});\n\n\t\tif (!result?.dynamicField) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst decoded = PaymentRecord.parse(result.dynamicField.value.bcs);\n\n\t\treturn {\n\t\t\tkey: result.dynamicField.id,\n\t\t\tpaymentTransactionDigest: result.dynamicField.previousTransaction,\n\t\t\tepochAtTimeOfRecord: decoded.epoch_at_time_of_record,\n\t\t};\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAAA;AAGA,SAAS,6BAA6B;AACtC;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,YAAY,qBAAqB;AAS1C,SAAS,0BAA0B;AACnC,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AAE/B,MAAM,oBAAN,MAAM,kBAAiB;AAAA,EAOrB,YAAY,SAAkC;AANtD;AACA;AAMC,QAAI,QAAQ,QAAQ;AACnB,yBAAK,SAAU,QAAQ;AAAA,IACxB,OAAO;AACN,YAAM,IAAI,sBAAsB,4BAA4B;AAAA,IAC7D;AAEA,UAAM,UAAU,QAAQ,OAAO;AAC/B,YAAQ,SAAS;AAAA,MAChB,KAAK;AACJ,2BAAK,gBAAiB;AACtB;AAAA,MACD,KAAK;AACJ,2BAAK,gBAAiB;AACtB;AAAA,MACD;AACC,cAAM,IAAI,sBAAsB,wBAAwB,OAAO,EAAE;AAAA,IACnE;AAEA,SAAK,QAAQ,IAAI,gBAAgB,EAAE,eAAe,mBAAK,gBAAe,CAAC;AACvE,SAAK,KAAK,IAAI,uBAAuB;AAAA,MACpC,OAAO,KAAK;AAAA,IACb,CAAC;AAAA,EACF;AAAA,EAEA,OAAO,oBAIL;AACD,WAAO;AAAA,MACN,MAAM;AAAA,MACN,UAAU,CAAC,WAAW;AACrB,eAAO,IAAI,kBAAiB,EAAE,OAAO,CAAC;AAAA,MACvC;AAAA,IACD;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,iBAAiB,QAA0E;AAChG,UAAM,EAAE,UAAU,YAAY,cAAc,OAAO,QAAQ,SAAS,IAAI;AACxE,UAAM,qBAAqB,mBAAmB,QAAQ;AACtD,UAAM,iBAAiB,GAAG,WAAW,IAAI,IAAI,kBAAkB;AAE/D,UAAM,kBACL,cAAc,sBAAsB,cAAc,mBAAK,gBAAe,WAAW;AAClF,UAAM,SAAS,MAAM,mBAAK,SAAQ,KAAK,gBAAgB;AAAA,MACtD,UAAU;AAAA,MACV,MAAM;AAAA,QACL,MAAM;AAAA,QACN,KAAK,WAAW,UAAU;AAAA,UACzB;AAAA,UACA,gBAAgB;AAAA,UAChB;AAAA,QACD,CAAC,EAAE,QAAQ;AAAA,MACZ;AAAA,IACD,CAAC;AAED,QAAI,CAAC,QAAQ,cAAc;AAC1B,aAAO;AAAA,IACR;AAEA,UAAM,UAAU,cAAc,MAAM,OAAO,aAAa,MAAM,GAAG;AAEjE,WAAO;AAAA,MACN,KAAK,OAAO,aAAa;AAAA,MACzB,0BAA0B,OAAO,aAAa;AAAA,MAC9C,qBAAqB,QAAQ;AAAA,IAC9B;AAAA,EACD;AACD;AApFC;AACA;AAFM,IAAM,mBAAN;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/constants.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export declare const TESTNET_PAYMENT_KIT_PACKAGE_CONFIG: {
|
|
2
2
|
packageId: string;
|
|
3
|
+
namespaceId: string;
|
|
3
4
|
};
|
|
4
5
|
export declare const MAINNET_PAYMENT_KIT_PACKAGE_CONFIG: {
|
|
5
6
|
packageId: string;
|
|
7
|
+
namespaceId: string;
|
|
6
8
|
};
|
|
9
|
+
export declare const SUI_COIN_TYPE: string;
|
|
10
|
+
export declare const DEFAULT_REGISTRY_NAME = "default-payment-registry";
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { SUI_TYPE_ARG, normalizeStructTag } from "@mysten/sui/utils";
|
|
1
2
|
const TESTNET_PAYMENT_KIT_PACKAGE_CONFIG = {
|
|
2
|
-
packageId: "
|
|
3
|
+
packageId: "0x7e069abe383e80d32f2aec17b3793da82aabc8c2edf84abbf68dd7b719e71497",
|
|
4
|
+
namespaceId: "0xa5016862fdccba7cc576b56cc5a391eda6775200aaa03a6b3c97d512312878db"
|
|
3
5
|
};
|
|
4
6
|
const MAINNET_PAYMENT_KIT_PACKAGE_CONFIG = {
|
|
5
|
-
packageId: "
|
|
7
|
+
packageId: "0xbc126f1535fba7d641cb9150ad9eae93b104972586ba20f3c60bfe0e53b69bc6",
|
|
8
|
+
namespaceId: "0xccd3e4c7802921991cd9ce488c4ca0b51334ba75483702744242284ccf3ae7c2"
|
|
6
9
|
};
|
|
10
|
+
const SUI_COIN_TYPE = normalizeStructTag(SUI_TYPE_ARG);
|
|
11
|
+
const DEFAULT_REGISTRY_NAME = "default-payment-registry";
|
|
7
12
|
export {
|
|
13
|
+
DEFAULT_REGISTRY_NAME,
|
|
8
14
|
MAINNET_PAYMENT_KIT_PACKAGE_CONFIG,
|
|
15
|
+
SUI_COIN_TYPE,
|
|
9
16
|
TESTNET_PAYMENT_KIT_PACKAGE_CONFIG
|
|
10
17
|
};
|
|
11
18
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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: '
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PaymentKitPackageConfig } from './types.js';\nimport { SUI_TYPE_ARG, normalizeStructTag } from '@mysten/sui/utils';\n\nexport const TESTNET_PAYMENT_KIT_PACKAGE_CONFIG = {\n\tpackageId: '0x7e069abe383e80d32f2aec17b3793da82aabc8c2edf84abbf68dd7b719e71497',\n\tnamespaceId: '0xa5016862fdccba7cc576b56cc5a391eda6775200aaa03a6b3c97d512312878db',\n} satisfies PaymentKitPackageConfig;\n\nexport const MAINNET_PAYMENT_KIT_PACKAGE_CONFIG = {\n\tpackageId: '0xbc126f1535fba7d641cb9150ad9eae93b104972586ba20f3c60bfe0e53b69bc6',\n\tnamespaceId: '0xccd3e4c7802921991cd9ce488c4ca0b51334ba75483702744242284ccf3ae7c2',\n} satisfies PaymentKitPackageConfig;\n\nexport const SUI_COIN_TYPE = normalizeStructTag(SUI_TYPE_ARG);\nexport const DEFAULT_REGISTRY_NAME = 'default-payment-registry';\n"],
|
|
5
|
+
"mappings": "AAIA,SAAS,cAAc,0BAA0B;AAE1C,MAAM,qCAAqC;AAAA,EACjD,WAAW;AAAA,EACX,aAAa;AACd;AAEO,MAAM,qCAAqC;AAAA,EACjD,WAAW;AAAA,EACX,aAAa;AACd;AAEO,MAAM,gBAAgB,mBAAmB,YAAY;AACrD,MAAM,wBAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,4 +11,4 @@ export declare const Value: MoveEnum<{
|
|
|
11
11
|
Type: import("../utils/index.js").MoveStruct<{
|
|
12
12
|
name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
13
13
|
}, "std::type_name::TypeName">;
|
|
14
|
-
}, "@
|
|
14
|
+
}, "@mysten/payment-kit::config::Value">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MoveEnum } from "../utils/index.js";
|
|
2
2
|
import { bcs } from "@mysten/sui/bcs";
|
|
3
3
|
import * as type_name from "./deps/std/type_name.js";
|
|
4
|
-
const $moduleName = "@
|
|
4
|
+
const $moduleName = "@mysten/payment-kit::config";
|
|
5
5
|
const Value = new MoveEnum({
|
|
6
6
|
name: `${$moduleName}::Value`,
|
|
7
7
|
fields: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 = '@
|
|
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 = '@mysten/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
5
|
"mappings": "AAEA,SAAS,gBAAgB;AACzB,SAAS,WAAW;AACpB,YAAY,eAAe;AAC3B,MAAM,cAAc;AACb,MAAM,QAAQ,IAAI,SAAS;AAAA,EACjC,MAAM,GAAG,WAAW;AAAA,EACpB,QAAQ;AAAA,IACP,KAAK,IAAI,IAAI;AAAA,IACb,SAAS,IAAI;AAAA,IACb,QAAQ,IAAI,OAAO;AAAA,IACnB,aAAa,IAAI,OAAO;AAAA,IACxB,MAAM,IAAI,KAAK;AAAA,IACf,OAAO,IAAI,OAAO,IAAI,GAAG,CAAC;AAAA,IAC1B,MAAM,UAAU;AAAA,EACjB;AACD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,7 @@ export declare const Namespace: MoveStruct<{
|
|
|
5
5
|
id: MoveStruct<{
|
|
6
6
|
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
7
7
|
}, "0x2::object::UID">;
|
|
8
|
-
}, "@
|
|
8
|
+
}, "@mysten/payment-kit::payment_kit::Namespace">;
|
|
9
9
|
export declare const PaymentRegistry: MoveStruct<{
|
|
10
10
|
id: MoveStruct<{
|
|
11
11
|
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
@@ -43,15 +43,15 @@ export declare const PaymentRegistry: MoveStruct<{
|
|
|
43
43
|
}> & {
|
|
44
44
|
length: number;
|
|
45
45
|
}, string>;
|
|
46
|
-
}, "0x2::vec_map::VecMap<string, @
|
|
46
|
+
}, "0x2::vec_map::VecMap<string, @mysten/payment-kit::config::Value>">;
|
|
47
47
|
version: import("@mysten/sui/bcs").BcsType<number, number, "u16">;
|
|
48
|
-
}, "@
|
|
48
|
+
}, "@mysten/payment-kit::payment_kit::PaymentRegistry">;
|
|
49
49
|
export declare const RegistryAdminCap: MoveStruct<{
|
|
50
50
|
id: MoveStruct<{
|
|
51
51
|
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
52
52
|
}, "0x2::object::UID">;
|
|
53
53
|
registry_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
54
|
-
}, "@
|
|
54
|
+
}, "@mysten/payment-kit::payment_kit::RegistryAdminCap">;
|
|
55
55
|
/**
|
|
56
56
|
* Enum representing the type of payment: Ephemeral (one-time) or Registry (tracked
|
|
57
57
|
* in a registry).
|
|
@@ -59,27 +59,27 @@ export declare const RegistryAdminCap: MoveStruct<{
|
|
|
59
59
|
export declare const PaymentType: MoveEnum<{
|
|
60
60
|
Ephemeral: null;
|
|
61
61
|
Registry: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
62
|
-
}, "@
|
|
62
|
+
}, "@mysten/payment-kit::payment_kit::PaymentType">;
|
|
63
63
|
export declare const PaymentReceipt: MoveStruct<{
|
|
64
64
|
payment_type: MoveEnum<{
|
|
65
65
|
Ephemeral: null;
|
|
66
66
|
Registry: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
67
|
-
}, "@
|
|
67
|
+
}, "@mysten/payment-kit::payment_kit::PaymentType">;
|
|
68
68
|
nonce: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
69
69
|
payment_amount: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
70
70
|
receiver: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
71
71
|
coin_type: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
72
72
|
timestamp_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
73
|
-
}, "@
|
|
73
|
+
}, "@mysten/payment-kit::payment_kit::PaymentReceipt">;
|
|
74
74
|
export declare const PaymentKey: MoveStruct<{
|
|
75
75
|
nonce: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
76
76
|
payment_amount: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
77
77
|
receiver: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
78
|
-
}, "@
|
|
78
|
+
}, "@mysten/payment-kit::payment_kit::PaymentKey">;
|
|
79
79
|
export declare const PaymentRecord: MoveStruct<{
|
|
80
80
|
epoch_at_time_of_record: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
81
|
-
}, "@
|
|
82
|
-
export declare const BalanceKey: MoveTuple<import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">[], "@
|
|
81
|
+
}, "@mysten/payment-kit::payment_kit::PaymentRecord">;
|
|
82
|
+
export declare const BalanceKey: MoveTuple<import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">[], "@mysten/payment-kit::payment_kit::BalanceKey">;
|
|
83
83
|
export interface CreateRegistryArguments {
|
|
84
84
|
namespace: RawTransactionArgument<string>;
|
|
85
85
|
name: RawTransactionArgument<string>;
|