@mysten/payment-kit 0.0.3 → 0.0.5
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/dist/cjs/calls.d.ts +50 -5
- package/dist/cjs/calls.js +123 -6
- package/dist/cjs/calls.js.map +2 -2
- package/dist/cjs/client.d.ts +3 -3
- package/dist/cjs/client.js +3 -3
- package/dist/cjs/client.js.map +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/transactions.d.ts +51 -6
- package/dist/cjs/transactions.js +72 -7
- package/dist/cjs/transactions.js.map +2 -2
- package/dist/cjs/types.d.ts +24 -9
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/calls.d.ts +50 -5
- package/dist/esm/calls.js +130 -7
- package/dist/esm/calls.js.map +2 -2
- package/dist/esm/client.d.ts +3 -3
- package/dist/esm/client.js +3 -3
- package/dist/esm/client.js.map +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/transactions.d.ts +51 -6
- package/dist/esm/transactions.js +72 -7
- package/dist/esm/transactions.js.map +2 -2
- package/dist/esm/types.d.ts +24 -9
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
package/dist/cjs/calls.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PaymentKitPackageConfig,
|
|
1
|
+
import type { CreateRegistryOptions, DeletePaymentRecordOptions, PaymentKitPackageConfig, ProcessEphemeralPaymentOptions, ProcessRegistryPaymentOptions, SetEpochExpirationDurationOptions, SetRegistryManagedFundsOptions, WithdrawFromRegistryOptions } from './types.js';
|
|
2
2
|
export interface PaymentKitCallOptions {
|
|
3
3
|
packageConfig: PaymentKitPackageConfig;
|
|
4
4
|
}
|
|
@@ -8,19 +8,64 @@ export declare class PaymentKitCalls {
|
|
|
8
8
|
/**
|
|
9
9
|
* Creates a `processRegistryPayment` transaction
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @example
|
|
12
12
|
* ```ts
|
|
13
13
|
* tx.add(lient.paymentKit.call.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName }));
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
|
-
processRegistryPayment: (
|
|
16
|
+
processRegistryPayment: (options: ProcessRegistryPaymentOptions) => (tx: import("@mysten/sui/transactions").Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
17
17
|
/**
|
|
18
18
|
* Creates a `processRegistryPayment` transaction
|
|
19
19
|
*
|
|
20
|
-
* @
|
|
20
|
+
* @example
|
|
21
21
|
* ```ts
|
|
22
22
|
* tx.add(client.paymentKit.call.processEphemeralPayment({ nonce, coinType, sender, amount, receiver }));
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
processEphemeralPayment: (
|
|
25
|
+
processEphemeralPayment: (options: ProcessEphemeralPaymentOptions) => (tx: import("@mysten/sui/transactions").Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a `createRegistry` transaction
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* tx.add(client.paymentKit.call.createRegistry(registryName));
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
createRegistry: ({ registryName }: CreateRegistryOptions) => (tx: import("@mysten/sui/transactions").Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a `setConfigEpochExpirationDuration` transaction
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* tx.add(client.paymentKit.call.setConfigEpochExpirationDuration({registryName, epochExpirationDuration, adminCapId}));
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
setConfigEpochExpirationDuration: ({ registryName, registryId, epochExpirationDuration, adminCapId, }: SetEpochExpirationDurationOptions) => (tx: import("@mysten/sui/transactions").Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a `setConfigRegistryManagedFunds` transaction
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* tx.add(client.paymentKit.call.setConfigRegistryManagedFunds({registryName, registryManagedFunds, adminCapId}));
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
setConfigRegistryManagedFunds: ({ registryName, registryId, registryManagedFunds, adminCapId, }: SetRegistryManagedFundsOptions) => (tx: import("@mysten/sui/transactions").Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a `withdrawFromRegistry` transaction
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* tx.add(client.paymentKit.call.withdrawFromRegistry({coinType, registryName, adminCapId}));
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
withdrawFromRegistry: ({ coinType, registryName, registryId, adminCapId, }: WithdrawFromRegistryOptions) => (tx: import("@mysten/sui/transactions").Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a `deletePaymentRecord` transaction
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* tx.add(client.paymentKit.call.deletePaymentRecord({coinType, nonce, amount, receiver, registryName}));
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
deletePaymentRecord: ({ coinType, nonce, amount, receiver, registryName, registryId, }: DeletePaymentRecordOptions) => (tx: import("@mysten/sui/transactions").Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
26
71
|
}
|
package/dist/cjs/calls.js
CHANGED
|
@@ -38,13 +38,13 @@ class PaymentKitCalls {
|
|
|
38
38
|
/**
|
|
39
39
|
* Creates a `processRegistryPayment` transaction
|
|
40
40
|
*
|
|
41
|
-
* @
|
|
41
|
+
* @example
|
|
42
42
|
* ```ts
|
|
43
43
|
* tx.add(lient.paymentKit.call.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName }));
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
|
-
this.processRegistryPayment = (
|
|
47
|
-
const { nonce, coinType, amount, receiver, registryName, registryId } =
|
|
46
|
+
this.processRegistryPayment = (options) => {
|
|
47
|
+
const { nonce, coinType, amount, receiver, registryName, registryId } = options;
|
|
48
48
|
const registryIdToUse = registryId ?? (0, import_utils.getRegistryIdFromName)(registryName, __privateGet(this, _packageConfig).namespaceId);
|
|
49
49
|
return (0, import_payment_kit.processRegistryPayment)({
|
|
50
50
|
arguments: {
|
|
@@ -63,13 +63,13 @@ class PaymentKitCalls {
|
|
|
63
63
|
/**
|
|
64
64
|
* Creates a `processRegistryPayment` transaction
|
|
65
65
|
*
|
|
66
|
-
* @
|
|
66
|
+
* @example
|
|
67
67
|
* ```ts
|
|
68
68
|
* tx.add(client.paymentKit.call.processEphemeralPayment({ nonce, coinType, sender, amount, receiver }));
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
|
-
this.processEphemeralPayment = (
|
|
72
|
-
const { nonce, coinType, amount, receiver } =
|
|
71
|
+
this.processEphemeralPayment = (options) => {
|
|
72
|
+
const { nonce, coinType, amount, receiver } = options;
|
|
73
73
|
return (0, import_payment_kit.processEphemeralPayment)({
|
|
74
74
|
arguments: {
|
|
75
75
|
nonce,
|
|
@@ -83,6 +83,123 @@ class PaymentKitCalls {
|
|
|
83
83
|
typeArguments: [coinType]
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Creates a `createRegistry` transaction
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* tx.add(client.paymentKit.call.createRegistry(registryName));
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
this.createRegistry = ({ registryName }) => {
|
|
95
|
+
return (0, import_payment_kit.createRegistry)({
|
|
96
|
+
arguments: {
|
|
97
|
+
namespace: __privateGet(this, _packageConfig).namespaceId,
|
|
98
|
+
name: registryName
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Creates a `setConfigEpochExpirationDuration` transaction
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* tx.add(client.paymentKit.call.setConfigEpochExpirationDuration({registryName, epochExpirationDuration, adminCapId}));
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
this.setConfigEpochExpirationDuration = ({
|
|
111
|
+
registryName,
|
|
112
|
+
registryId,
|
|
113
|
+
epochExpirationDuration,
|
|
114
|
+
adminCapId
|
|
115
|
+
}) => {
|
|
116
|
+
const registryIdToUse = registryId ?? (0, import_utils.getRegistryIdFromName)(registryName, __privateGet(this, _packageConfig).namespaceId);
|
|
117
|
+
return (0, import_payment_kit.setConfigEpochExpirationDuration)({
|
|
118
|
+
arguments: {
|
|
119
|
+
registry: registryIdToUse,
|
|
120
|
+
epochExpirationDuration,
|
|
121
|
+
cap: adminCapId
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Creates a `setConfigRegistryManagedFunds` transaction
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* tx.add(client.paymentKit.call.setConfigRegistryManagedFunds({registryName, registryManagedFunds, adminCapId}));
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
this.setConfigRegistryManagedFunds = ({
|
|
134
|
+
registryName,
|
|
135
|
+
registryId,
|
|
136
|
+
registryManagedFunds,
|
|
137
|
+
adminCapId
|
|
138
|
+
}) => {
|
|
139
|
+
const registryIdToUse = registryId ?? (0, import_utils.getRegistryIdFromName)(registryName, __privateGet(this, _packageConfig).namespaceId);
|
|
140
|
+
return (0, import_payment_kit.setConfigRegistryManagedFunds)({
|
|
141
|
+
arguments: {
|
|
142
|
+
registry: registryIdToUse,
|
|
143
|
+
registryManagedFunds,
|
|
144
|
+
cap: adminCapId
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Creates a `withdrawFromRegistry` transaction
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* tx.add(client.paymentKit.call.withdrawFromRegistry({coinType, registryName, adminCapId}));
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
this.withdrawFromRegistry = ({
|
|
157
|
+
coinType,
|
|
158
|
+
registryName,
|
|
159
|
+
registryId,
|
|
160
|
+
adminCapId
|
|
161
|
+
}) => {
|
|
162
|
+
const registryIdToUse = registryId ?? (0, import_utils.getRegistryIdFromName)(registryName, __privateGet(this, _packageConfig).namespaceId);
|
|
163
|
+
return (0, import_payment_kit.withdrawFromRegistry)({
|
|
164
|
+
arguments: {
|
|
165
|
+
registry: registryIdToUse,
|
|
166
|
+
cap: adminCapId
|
|
167
|
+
},
|
|
168
|
+
typeArguments: [coinType]
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Creates a `deletePaymentRecord` transaction
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* tx.add(client.paymentKit.call.deletePaymentRecord({coinType, nonce, amount, receiver, registryName}));
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
this.deletePaymentRecord = ({
|
|
180
|
+
coinType,
|
|
181
|
+
nonce,
|
|
182
|
+
amount,
|
|
183
|
+
receiver,
|
|
184
|
+
registryName,
|
|
185
|
+
registryId
|
|
186
|
+
}) => {
|
|
187
|
+
const registryIdToUse = registryId ?? (0, import_utils.getRegistryIdFromName)(registryName, __privateGet(this, _packageConfig).namespaceId);
|
|
188
|
+
return (0, import_payment_kit.deletePaymentRecord)({
|
|
189
|
+
arguments: {
|
|
190
|
+
registry: registryIdToUse,
|
|
191
|
+
paymentKey: (0, import_payment_kit.createPaymentKey)({
|
|
192
|
+
arguments: {
|
|
193
|
+
nonce,
|
|
194
|
+
paymentAmount: amount,
|
|
195
|
+
receiver
|
|
196
|
+
},
|
|
197
|
+
typeArguments: [coinType]
|
|
198
|
+
})
|
|
199
|
+
},
|
|
200
|
+
typeArguments: [coinType]
|
|
201
|
+
});
|
|
202
|
+
};
|
|
86
203
|
__privateSet(this, _packageConfig, options.packageConfig);
|
|
87
204
|
}
|
|
88
205
|
}
|
package/dist/cjs/calls.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAgC;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { coinWithBalance } from '@mysten/sui/transactions';\nimport type {\n\tCreateRegistryOptions,\n\tDeletePaymentRecordOptions,\n\tPaymentKitPackageConfig,\n\tProcessEphemeralPaymentOptions,\n\tProcessRegistryPaymentOptions,\n\tSetEpochExpirationDurationOptions,\n\tSetRegistryManagedFundsOptions,\n\tWithdrawFromRegistryOptions,\n} from './types.js';\nimport {\n\tcreatePaymentKey,\n\tcreateRegistry,\n\tdeletePaymentRecord,\n\tprocessEphemeralPayment,\n\tprocessRegistryPayment,\n\tsetConfigEpochExpirationDuration,\n\tsetConfigRegistryManagedFunds,\n\twithdrawFromRegistry,\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 * @example\n\t * ```ts\n\t * tx.add(lient.paymentKit.call.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName }));\n\t * ```\n\t */\n\tprocessRegistryPayment = (options: ProcessRegistryPaymentOptions) => {\n\t\tconst { nonce, coinType, amount, receiver, registryName, registryId } = options;\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 * @example\n\t * ```ts\n\t * tx.add(client.paymentKit.call.processEphemeralPayment({ nonce, coinType, sender, amount, receiver }));\n\t * ```\n\t */\n\tprocessEphemeralPayment = (options: ProcessEphemeralPaymentOptions) => {\n\t\tconst { nonce, coinType, amount, receiver } = options;\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\t/**\n\t * Creates a `createRegistry` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * tx.add(client.paymentKit.call.createRegistry(registryName));\n\t * ```\n\t */\n\tcreateRegistry = ({ registryName }: CreateRegistryOptions) => {\n\t\treturn createRegistry({\n\t\t\targuments: {\n\t\t\t\tnamespace: this.#packageConfig.namespaceId,\n\t\t\t\tname: registryName,\n\t\t\t},\n\t\t});\n\t};\n\n\t/**\n\t * Creates a `setConfigEpochExpirationDuration` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * tx.add(client.paymentKit.call.setConfigEpochExpirationDuration({registryName, epochExpirationDuration, adminCapId}));\n\t * ```\n\t */\n\tsetConfigEpochExpirationDuration = ({\n\t\tregistryName,\n\t\tregistryId,\n\t\tepochExpirationDuration,\n\t\tadminCapId,\n\t}: SetEpochExpirationDurationOptions) => {\n\t\tconst registryIdToUse =\n\t\t\tregistryId ?? getRegistryIdFromName(registryName, this.#packageConfig.namespaceId);\n\n\t\treturn setConfigEpochExpirationDuration({\n\t\t\targuments: {\n\t\t\t\tregistry: registryIdToUse,\n\t\t\t\tepochExpirationDuration,\n\t\t\t\tcap: adminCapId,\n\t\t\t},\n\t\t});\n\t};\n\n\t/**\n\t * Creates a `setConfigRegistryManagedFunds` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * tx.add(client.paymentKit.call.setConfigRegistryManagedFunds({registryName, registryManagedFunds, adminCapId}));\n\t * ```\n\t */\n\tsetConfigRegistryManagedFunds = ({\n\t\tregistryName,\n\t\tregistryId,\n\t\tregistryManagedFunds,\n\t\tadminCapId,\n\t}: SetRegistryManagedFundsOptions) => {\n\t\tconst registryIdToUse =\n\t\t\tregistryId ?? getRegistryIdFromName(registryName, this.#packageConfig.namespaceId);\n\n\t\treturn setConfigRegistryManagedFunds({\n\t\t\targuments: {\n\t\t\t\tregistry: registryIdToUse,\n\t\t\t\tregistryManagedFunds,\n\t\t\t\tcap: adminCapId,\n\t\t\t},\n\t\t});\n\t};\n\n\t/**\n\t * Creates a `withdrawFromRegistry` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * tx.add(client.paymentKit.call.withdrawFromRegistry({coinType, registryName, adminCapId}));\n\t * ```\n\t */\n\twithdrawFromRegistry = ({\n\t\tcoinType,\n\t\tregistryName,\n\t\tregistryId,\n\t\tadminCapId,\n\t}: WithdrawFromRegistryOptions) => {\n\t\tconst registryIdToUse =\n\t\t\tregistryId ?? getRegistryIdFromName(registryName, this.#packageConfig.namespaceId);\n\n\t\treturn withdrawFromRegistry({\n\t\t\targuments: {\n\t\t\t\tregistry: registryIdToUse,\n\t\t\t\tcap: adminCapId,\n\t\t\t},\n\t\t\ttypeArguments: [coinType],\n\t\t});\n\t};\n\n\t/**\n\t * Creates a `deletePaymentRecord` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * tx.add(client.paymentKit.call.deletePaymentRecord({coinType, nonce, amount, receiver, registryName}));\n\t * ```\n\t */\n\tdeletePaymentRecord = ({\n\t\tcoinType,\n\t\tnonce,\n\t\tamount,\n\t\treceiver,\n\t\tregistryName,\n\t\tregistryId,\n\t}: DeletePaymentRecordOptions) => {\n\t\tconst registryIdToUse =\n\t\t\tregistryId ?? getRegistryIdFromName(registryName, this.#packageConfig.namespaceId);\n\n\t\treturn deletePaymentRecord({\n\t\t\targuments: {\n\t\t\t\tregistry: registryIdToUse,\n\t\t\t\tpaymentKey: createPaymentKey({\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tnonce,\n\t\t\t\t\t\tpaymentAmount: amount,\n\t\t\t\t\t\treceiver,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [coinType],\n\t\t\t\t}),\n\t\t\t},\n\t\t\ttypeArguments: [coinType],\n\t\t});\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAgC;AAWhC,yBASO;AACP,mBAAsC;AAxBtC;AA8BO,MAAM,gBAAgB;AAAA,EAG5B,YAAY,SAAgC;AAF5C;AA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AAK,gBAAiB,QAAQ;AAAA,EAC/B;AAwLD;AA5LC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PaymentKitCompatibleClient,
|
|
1
|
+
import type { PaymentKitCompatibleClient, GetPaymentRecordOptions, GetPaymentRecordResponse } from './types.js';
|
|
2
2
|
import type { SuiClientRegistration } from '@mysten/sui/experimental';
|
|
3
3
|
import { PaymentKitTransactions } from './transactions.js';
|
|
4
4
|
import { PaymentKitCalls } from './calls.js';
|
|
@@ -12,10 +12,10 @@ export declare class PaymentKitClient {
|
|
|
12
12
|
* Query for a payment record in a registry.
|
|
13
13
|
* Returns the payment record data if it exists, null otherwise.
|
|
14
14
|
*
|
|
15
|
-
* @
|
|
15
|
+
* @example
|
|
16
16
|
* ```ts
|
|
17
17
|
* const paymentRecord = await client.getPaymentRecord({ registry, nonce, amount, receiver, coinType });
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
getPaymentRecord(
|
|
20
|
+
getPaymentRecord(options: GetPaymentRecordOptions): Promise<GetPaymentRecordResponse | null>;
|
|
21
21
|
}
|
package/dist/cjs/client.js
CHANGED
|
@@ -73,13 +73,13 @@ const _PaymentKitClient = class _PaymentKitClient {
|
|
|
73
73
|
* Query for a payment record in a registry.
|
|
74
74
|
* Returns the payment record data if it exists, null otherwise.
|
|
75
75
|
*
|
|
76
|
-
* @
|
|
76
|
+
* @example
|
|
77
77
|
* ```ts
|
|
78
78
|
* const paymentRecord = await client.getPaymentRecord({ registry, nonce, amount, receiver, coinType });
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
async getPaymentRecord(
|
|
82
|
-
const { coinType, registryId, registryName, nonce, amount, receiver } =
|
|
81
|
+
async getPaymentRecord(options) {
|
|
82
|
+
const { coinType, registryId, registryName, nonce, amount, receiver } = options;
|
|
83
83
|
const normalizedCoinType = (0, import_utils.normalizeStructTag)(coinType);
|
|
84
84
|
const paymentKeyType = `${import_payment_kit.PaymentKey.name}<${normalizedCoinType}>`;
|
|
85
85
|
const registryIdToUse = registryId ?? (0, import_utils2.getRegistryIdFromName)(registryName, __privateGet(this, _packageConfig).namespaceId);
|
package/dist/cjs/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';\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\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAsC;AACtC,uBAGO;AACP,yBAA0C;AAS1C,mBAAmC;AACnC,0BAAuC;AACvC,mBAAgC;AAChC,IAAAA,gBAAsC;AApBtC;AAsBO,MAAM,oBAAN,MAAM,kBAAiB;AAAA,EAOrB,YAAY,SAAkC;AANtD;AACA;AAMC,QAAI,QAAQ,QAAQ;AACnB,yBAAK,SAAU,QAAQ;AAAA,IACxB,OAAO;AACN,YAAM,IAAI,mCAAsB,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,mCAAsB,wBAAwB,OAAO,EAAE;AAAA,IACnE;AAEA,SAAK,QAAQ,IAAI,6BAAgB,EAAE,eAAe,mBAAK,gBAAe,CAAC;AACvE,SAAK,KAAK,IAAI,2CAAuB;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,
|
|
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\tGetPaymentRecordOptions,\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 * @example\n\t * ```ts\n\t * const paymentRecord = await client.getPaymentRecord({ registry, nonce, amount, receiver, coinType });\n\t * ```\n\t */\n\tasync getPaymentRecord(\n\t\toptions: GetPaymentRecordOptions,\n\t): Promise<GetPaymentRecordResponse | null> {\n\t\tconst { coinType, registryId, registryName, nonce, amount, receiver } = options;\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;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAsC;AACtC,uBAGO;AACP,yBAA0C;AAS1C,mBAAmC;AACnC,0BAAuC;AACvC,mBAAgC;AAChC,IAAAA,gBAAsC;AApBtC;AAsBO,MAAM,oBAAN,MAAM,kBAAiB;AAAA,EAOrB,YAAY,SAAkC;AANtD;AACA;AAMC,QAAI,QAAQ,QAAQ;AACnB,yBAAK,SAAU,QAAQ;AAAA,IACxB,OAAO;AACN,YAAM,IAAI,mCAAsB,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,mCAAsB,wBAAwB,OAAO,EAAE;AAAA,IACnE;AAEA,SAAK,QAAQ,IAAI,6BAAgB,EAAE,eAAe,mBAAK,gBAAe,CAAC;AACvE,SAAK,KAAK,IAAI,2CAAuB;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,iBACL,SAC2C;AAC3C,UAAM,EAAE,UAAU,YAAY,cAAc,OAAO,QAAQ,SAAS,IAAI;AACxE,UAAM,yBAAqB,iCAAmB,QAAQ;AACtD,UAAM,iBAAiB,GAAG,8BAAW,IAAI,IAAI,kBAAkB;AAE/D,UAAM,kBACL,kBAAc,qCAAsB,cAAc,mBAAK,gBAAe,WAAW;AAClF,UAAM,SAAS,MAAM,mBAAK,SAAQ,KAAK,gBAAgB;AAAA,MACtD,UAAU;AAAA,MACV,MAAM;AAAA,QACL,MAAM;AAAA,QACN,KAAK,8BAAW,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,iCAAc,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;AAtFC;AACA;AAFM,IAAM,mBAAN;",
|
|
6
6
|
"names": ["import_utils"]
|
|
7
7
|
}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { PaymentKitClient } from './client.js';
|
|
2
|
-
export type { PaymentKitCompatibleClient, PaymentKitClientOptions, PaymentKitPackageConfig,
|
|
2
|
+
export type { PaymentKitCompatibleClient, PaymentKitClientOptions, PaymentKitPackageConfig, GetPaymentRecordOptions, ProcessRegistryPaymentOptions, ProcessEphemeralPaymentOptions, GetPaymentRecordResponse, CreateRegistryOptions, SetEpochExpirationDurationOptions, SetRegistryManagedFundsOptions, WithdrawFromRegistryOptions, DeletePaymentRecordOptions, } from './types.js';
|
|
3
3
|
export { PaymentKitClientError } from './error.js';
|
|
4
4
|
export { DEFAULT_REGISTRY_NAME } from './constants.js';
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport { PaymentKitClient } from './client.js';\nexport type {\n\tPaymentKitCompatibleClient,\n\tPaymentKitClientOptions,\n\tPaymentKitPackageConfig,\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAiC;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport { PaymentKitClient } from './client.js';\nexport type {\n\tPaymentKitCompatibleClient,\n\tPaymentKitClientOptions,\n\tPaymentKitPackageConfig,\n\tGetPaymentRecordOptions,\n\tProcessRegistryPaymentOptions,\n\tProcessEphemeralPaymentOptions,\n\tGetPaymentRecordResponse,\n\tCreateRegistryOptions,\n\tSetEpochExpirationDurationOptions,\n\tSetRegistryManagedFundsOptions,\n\tWithdrawFromRegistryOptions,\n\tDeletePaymentRecordOptions,\n} from './types.js';\nexport { PaymentKitClientError } from './error.js';\nexport { DEFAULT_REGISTRY_NAME } from './constants.js';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAiC;AAejC,mBAAsC;AACtC,uBAAsC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CreateRegistryOptions, DeletePaymentRecordOptions, ProcessEphemeralPaymentOptions, ProcessRegistryPaymentOptions, SetEpochExpirationDurationOptions, SetRegistryManagedFundsOptions, WithdrawFromRegistryOptions } from './types.js';
|
|
3
3
|
import type { PaymentKitCalls } from './calls.js';
|
|
4
4
|
export interface PaymentKitTransactionsOptions {
|
|
5
5
|
calls: PaymentKitCalls;
|
|
@@ -10,19 +10,64 @@ export declare class PaymentKitTransactions {
|
|
|
10
10
|
/**
|
|
11
11
|
* Creates a `processRegistryPayment` transaction
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @example
|
|
14
14
|
* ```ts
|
|
15
15
|
* const tx = client.paymentKit.tx.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName });
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
processRegistryPayment(
|
|
18
|
+
processRegistryPayment(options: ProcessRegistryPaymentOptions): Transaction;
|
|
19
19
|
/**
|
|
20
20
|
* Creates a `processEphemeralPayment` transaction
|
|
21
21
|
*
|
|
22
|
-
* @
|
|
22
|
+
* @example
|
|
23
23
|
* ```ts
|
|
24
|
-
* const tx = client.paymentKit.tx.
|
|
24
|
+
* const tx = client.paymentKit.tx.processEphemeralPayment({ nonce, coinType, sender, amount, receiver });
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
processEphemeralPayment(
|
|
27
|
+
processEphemeralPayment(options: ProcessEphemeralPaymentOptions): Transaction;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a `createRegistry` transaction
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const tx = client.paymentKit.tx.createRegistry({ registryName });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
createRegistry(options: CreateRegistryOptions): Transaction;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a `setConfigEpochExpirationDuration` transaction
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const tx = client.paymentKit.tx.setConfigEpochExpirationDuration({ registryName, epochExpirationDuration, adminCapId });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
setConfigEpochExpirationDuration(options: SetEpochExpirationDurationOptions): Transaction;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a `setConfigRegistryManagedFunds` transaction
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const tx = client.paymentKit.tx.setConfigRegistryManagedFunds({ registryName, registryManagedFunds, adminCapId });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
setConfigRegistryManagedFunds(options: SetRegistryManagedFundsOptions): Transaction;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a `withdrawFromRegistry` transaction
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const tx = client.paymentKit.tx.withdrawFromRegistry({ coinType, registryName, adminCapId });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
withdrawFromRegistry(options: WithdrawFromRegistryOptions): Transaction;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a `deletePaymentRecord` transaction
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const tx = client.paymentKit.tx.deletePaymentRecord({ coinType, nonce, amount, receiver, registryName });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
deletePaymentRecord(options: DeletePaymentRecordOptions): Transaction;
|
|
28
73
|
}
|
package/dist/cjs/transactions.js
CHANGED
|
@@ -38,27 +38,92 @@ class PaymentKitTransactions {
|
|
|
38
38
|
/**
|
|
39
39
|
* Creates a `processRegistryPayment` transaction
|
|
40
40
|
*
|
|
41
|
-
* @
|
|
41
|
+
* @example
|
|
42
42
|
* ```ts
|
|
43
43
|
* const tx = client.paymentKit.tx.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName });
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
|
-
processRegistryPayment(
|
|
46
|
+
processRegistryPayment(options) {
|
|
47
47
|
const tx = new import_transactions.Transaction();
|
|
48
|
-
tx.add(__privateGet(this, _calls).processRegistryPayment(
|
|
48
|
+
tx.add(__privateGet(this, _calls).processRegistryPayment(options));
|
|
49
49
|
return tx;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Creates a `processEphemeralPayment` transaction
|
|
53
53
|
*
|
|
54
|
-
* @
|
|
54
|
+
* @example
|
|
55
55
|
* ```ts
|
|
56
|
-
* const tx = client.paymentKit.tx.
|
|
56
|
+
* const tx = client.paymentKit.tx.processEphemeralPayment({ nonce, coinType, sender, amount, receiver });
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
processEphemeralPayment(
|
|
59
|
+
processEphemeralPayment(options) {
|
|
60
60
|
const tx = new import_transactions.Transaction();
|
|
61
|
-
tx.add(__privateGet(this, _calls).processEphemeralPayment(
|
|
61
|
+
tx.add(__privateGet(this, _calls).processEphemeralPayment(options));
|
|
62
|
+
return tx;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates a `createRegistry` transaction
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const tx = client.paymentKit.tx.createRegistry({ registryName });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
createRegistry(options) {
|
|
73
|
+
const tx = new import_transactions.Transaction();
|
|
74
|
+
tx.add(__privateGet(this, _calls).createRegistry(options));
|
|
75
|
+
return tx;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Creates a `setConfigEpochExpirationDuration` transaction
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* const tx = client.paymentKit.tx.setConfigEpochExpirationDuration({ registryName, epochExpirationDuration, adminCapId });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
setConfigEpochExpirationDuration(options) {
|
|
86
|
+
const tx = new import_transactions.Transaction();
|
|
87
|
+
tx.add(__privateGet(this, _calls).setConfigEpochExpirationDuration(options));
|
|
88
|
+
return tx;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Creates a `setConfigRegistryManagedFunds` transaction
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const tx = client.paymentKit.tx.setConfigRegistryManagedFunds({ registryName, registryManagedFunds, adminCapId });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
setConfigRegistryManagedFunds(options) {
|
|
99
|
+
const tx = new import_transactions.Transaction();
|
|
100
|
+
tx.add(__privateGet(this, _calls).setConfigRegistryManagedFunds(options));
|
|
101
|
+
return tx;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Creates a `withdrawFromRegistry` transaction
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const tx = client.paymentKit.tx.withdrawFromRegistry({ coinType, registryName, adminCapId });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
withdrawFromRegistry(options) {
|
|
112
|
+
const tx = new import_transactions.Transaction();
|
|
113
|
+
tx.add(__privateGet(this, _calls).withdrawFromRegistry(options));
|
|
114
|
+
return tx;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Creates a `deletePaymentRecord` transaction
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* const tx = client.paymentKit.tx.deletePaymentRecord({ coinType, nonce, amount, receiver, registryName });
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
deletePaymentRecord(options) {
|
|
125
|
+
const tx = new import_transactions.Transaction();
|
|
126
|
+
tx.add(__privateGet(this, _calls).deletePaymentRecord(options));
|
|
62
127
|
return tx;
|
|
63
128
|
}
|
|
64
129
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA4B;AAH5B;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Transaction } from '@mysten/sui/transactions';\nimport type {\n\tCreateRegistryOptions,\n\tDeletePaymentRecordOptions,\n\tProcessEphemeralPaymentOptions,\n\tProcessRegistryPaymentOptions,\n\tSetEpochExpirationDurationOptions,\n\tSetRegistryManagedFundsOptions,\n\tWithdrawFromRegistryOptions,\n} 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 * @example\n\t * ```ts\n\t * const tx = client.paymentKit.tx.processRegistryPayment({ nonce, coinType, sender, amount, receiver, registryName });\n\t * ```\n\t */\n\tprocessRegistryPayment(options: ProcessRegistryPaymentOptions) {\n\t\tconst tx = new Transaction();\n\t\ttx.add(this.#calls.processRegistryPayment(options));\n\n\t\treturn tx;\n\t}\n\n\t/**\n\t * Creates a `processEphemeralPayment` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * const tx = client.paymentKit.tx.processEphemeralPayment({ nonce, coinType, sender, amount, receiver });\n\t * ```\n\t */\n\tprocessEphemeralPayment(options: ProcessEphemeralPaymentOptions) {\n\t\tconst tx = new Transaction();\n\t\ttx.add(this.#calls.processEphemeralPayment(options));\n\n\t\treturn tx;\n\t}\n\n\t/**\n\t * Creates a `createRegistry` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * const tx = client.paymentKit.tx.createRegistry({ registryName });\n\t * ```\n\t */\n\tcreateRegistry(options: CreateRegistryOptions) {\n\t\tconst tx = new Transaction();\n\t\ttx.add(this.#calls.createRegistry(options));\n\n\t\treturn tx;\n\t}\n\n\t/**\n\t * Creates a `setConfigEpochExpirationDuration` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * const tx = client.paymentKit.tx.setConfigEpochExpirationDuration({ registryName, epochExpirationDuration, adminCapId });\n\t * ```\n\t */\n\tsetConfigEpochExpirationDuration(options: SetEpochExpirationDurationOptions) {\n\t\tconst tx = new Transaction();\n\t\ttx.add(this.#calls.setConfigEpochExpirationDuration(options));\n\n\t\treturn tx;\n\t}\n\n\t/**\n\t * Creates a `setConfigRegistryManagedFunds` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * const tx = client.paymentKit.tx.setConfigRegistryManagedFunds({ registryName, registryManagedFunds, adminCapId });\n\t * ```\n\t */\n\tsetConfigRegistryManagedFunds(options: SetRegistryManagedFundsOptions) {\n\t\tconst tx = new Transaction();\n\t\ttx.add(this.#calls.setConfigRegistryManagedFunds(options));\n\n\t\treturn tx;\n\t}\n\n\t/**\n\t * Creates a `withdrawFromRegistry` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * const tx = client.paymentKit.tx.withdrawFromRegistry({ coinType, registryName, adminCapId });\n\t * ```\n\t */\n\twithdrawFromRegistry(options: WithdrawFromRegistryOptions) {\n\t\tconst tx = new Transaction();\n\t\ttx.add(this.#calls.withdrawFromRegistry(options));\n\n\t\treturn tx;\n\t}\n\n\t/**\n\t * Creates a `deletePaymentRecord` transaction\n\t *\n\t * @example\n\t * ```ts\n\t * const tx = client.paymentKit.tx.deletePaymentRecord({ coinType, nonce, amount, receiver, registryName });\n\t * ```\n\t */\n\tdeletePaymentRecord(options: DeletePaymentRecordOptions) {\n\t\tconst tx = new Transaction();\n\t\ttx.add(this.#calls.deletePaymentRecord(options));\n\n\t\treturn tx;\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA4B;AAH5B;AAmBO,MAAM,uB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AA,EAUA,oBAAoB,SAAqC;AACxD,UAAM,KAAK,IAAI,gCAAY;AAC3B,OAAG,IAAI,mBAAK,QAAO,oBAAoB,OAAO,CAAC;AAE/C,WAAO;AAAA,EACR;AACD;AA9GC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -15,22 +15,37 @@ export type Registry = {
|
|
|
15
15
|
registryName?: never;
|
|
16
16
|
registryId: string;
|
|
17
17
|
};
|
|
18
|
-
export type
|
|
18
|
+
export type RegistryAndAdminCap = {
|
|
19
|
+
adminCapId: string;
|
|
20
|
+
} & Registry;
|
|
21
|
+
export type PaymentKeyArgs = {
|
|
22
|
+
coinType: string;
|
|
19
23
|
nonce: string;
|
|
20
24
|
amount: number | bigint;
|
|
21
25
|
receiver: string;
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
};
|
|
27
|
+
export type GetPaymentRecordOptions = PaymentKeyArgs & Registry;
|
|
24
28
|
export interface GetPaymentRecordResponse {
|
|
25
29
|
key: string;
|
|
26
30
|
paymentTransactionDigest: string | null;
|
|
27
31
|
epochAtTimeOfRecord: string;
|
|
28
32
|
}
|
|
29
|
-
export type
|
|
30
|
-
nonce: string;
|
|
31
|
-
coinType: string;
|
|
33
|
+
export type ProcessEphemeralPaymentOptions = {
|
|
32
34
|
sender: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
} & PaymentKeyArgs;
|
|
36
|
+
export type ProcessRegistryPaymentOptions = ProcessEphemeralPaymentOptions & Registry;
|
|
37
|
+
export type CreateRegistryOptions = {
|
|
38
|
+
registryName: string;
|
|
35
39
|
};
|
|
36
|
-
export type
|
|
40
|
+
export type SetEpochExpirationDurationOptions = {
|
|
41
|
+
epochExpirationDuration: number | bigint;
|
|
42
|
+
} & RegistryAndAdminCap;
|
|
43
|
+
export type SetRegistryManagedFundsOptions = {
|
|
44
|
+
registryManagedFunds: boolean;
|
|
45
|
+
} & RegistryAndAdminCap;
|
|
46
|
+
export type WithdrawFromRegistryOptions = {
|
|
47
|
+
coinType: string;
|
|
48
|
+
} & RegistryAndAdminCap;
|
|
49
|
+
export type DeletePaymentRecordOptions = {
|
|
50
|
+
coinType: string;
|
|
51
|
+
} & PaymentKeyArgs & 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\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
|
|
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 RegistryAndAdminCap = {\n\tadminCapId: string;\n} & Registry;\n\nexport type PaymentKeyArgs = {\n\tcoinType: string;\n\tnonce: string;\n\tamount: number | bigint;\n\treceiver: string;\n};\n\nexport type GetPaymentRecordOptions = PaymentKeyArgs & Registry;\n\nexport interface GetPaymentRecordResponse {\n\tkey: string;\n\tpaymentTransactionDigest: string | null;\n\tepochAtTimeOfRecord: string;\n}\n\nexport type ProcessEphemeralPaymentOptions = {\n\tsender: string;\n} & PaymentKeyArgs;\n\nexport type ProcessRegistryPaymentOptions = ProcessEphemeralPaymentOptions & Registry;\n\nexport type CreateRegistryOptions = {\n\tregistryName: string;\n};\n\nexport type SetEpochExpirationDurationOptions = {\n\tepochExpirationDuration: number | bigint;\n} & RegistryAndAdminCap;\n\nexport type SetRegistryManagedFundsOptions = {\n\tregistryManagedFunds: boolean;\n} & RegistryAndAdminCap;\n\nexport type WithdrawFromRegistryOptions = {\n\tcoinType: string;\n} & RegistryAndAdminCap;\n\nexport type DeletePaymentRecordOptions = {\n\tcoinType: string;\n} & PaymentKeyArgs &\n\tRegistry;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|