@mysten/payment-kit 0.1.9 → 0.1.11
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/docs/getting-started.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
> Install and set up Payment Kit for your Sui application.
|
|
4
4
|
|
|
5
|
-
> **Note:** This package is in active development and should be used with caution. APIs are
|
|
6
|
-
>
|
|
7
|
-
>
|
|
5
|
+
> **Note:** This package is in active development and should be used with caution. APIs are experimental and
|
|
6
|
+
> subject to breaking changes without notice. We recommend thoroughly testing any implementation
|
|
7
|
+
> before using in production environments.
|
|
8
8
|
|
|
9
9
|
This guide will help you set up and start using the Payment Kit SDK in your Sui application.
|
|
10
10
|
|
|
@@ -29,6 +29,7 @@ The Payment Kit SDK extends the standard `SuiGrpcClient` to provide payment func
|
|
|
29
29
|
how to set it up:
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
|
+
|
|
32
33
|
// Create a Sui client with Payment Kit extension
|
|
33
34
|
const client = new SuiGrpcClient({
|
|
34
35
|
network: 'testnet',
|
|
@@ -44,6 +45,7 @@ The client will automatically configure the correct package IDs for the network
|
|
|
44
45
|
Let's process a basic registry-based payment using the default payment registry:
|
|
45
46
|
|
|
46
47
|
```ts
|
|
48
|
+
|
|
47
49
|
// Create or load your keypair
|
|
48
50
|
const keypair = Ed25519Keypair.generate();
|
|
49
51
|
const sender = keypair.getPublicKey().toSuiAddress();
|
|
@@ -198,6 +200,7 @@ Payment Kit provides helper functions to create and parse Payment Kit transactio
|
|
|
198
200
|
are useful for generating payment links, QR codes, or deep links in your application:
|
|
199
201
|
|
|
200
202
|
```ts
|
|
203
|
+
|
|
201
204
|
// Create a payment URI
|
|
202
205
|
const paymentUri = createPaymentTransactionUri({
|
|
203
206
|
receiverAddress: '0x123...abc',
|
|
@@ -228,6 +231,7 @@ The URI parameters include:
|
|
|
228
231
|
You can then parse URIs back into payment parameters:
|
|
229
232
|
|
|
230
233
|
```ts
|
|
234
|
+
|
|
231
235
|
// Parse a payment URI
|
|
232
236
|
const params = parsePaymentTransactionUri(paymentUri);
|
|
233
237
|
// Returns: { receiverAddress, amount, coinType, nonce, label?, message?, iconUrl?, registryName? | registryId? }
|
|
@@ -249,4 +253,4 @@ Now that you understand the basics, explore more advanced features:
|
|
|
249
253
|
|
|
250
254
|
- [Payment Processing](./payment-processing) - Deep dive into payment models
|
|
251
255
|
- [Registry Management](./registry-management) - Create and configure custom registries
|
|
252
|
-
- [SDK API Reference](./payment-kit-sdk) - Complete SDK API documentation
|
|
256
|
+
- [SDK API Reference](./payment-kit-sdk) - Complete SDK API documentation
|
package/docs/index.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
> Accept payments in any coin type on the Sui blockchain with built-in duplicate prevention.
|
|
4
4
|
|
|
5
|
-
> **Note:** This package is in active development and should be used with caution. APIs are
|
|
6
|
-
>
|
|
7
|
-
>
|
|
5
|
+
> **Note:** This package is in active development and should be used with caution. APIs are experimental and
|
|
6
|
+
> subject to breaking changes without notice. We recommend thoroughly testing any implementation
|
|
7
|
+
> before using in production environments.
|
|
8
8
|
|
|
9
9
|
The Sui Payment Kit SDK is a TypeScript library that provides a straightforward and secure way to
|
|
10
10
|
process blockchain payments on the Sui network. It offers flexible payment processing with built-in
|
|
@@ -41,6 +41,7 @@ npm install --save @mysten/payment-kit @mysten/sui
|
|
|
41
41
|
## Quick start
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
+
|
|
44
45
|
// Create a Sui client with a Payment Kit extension
|
|
45
46
|
const client = new SuiGrpcClient({
|
|
46
47
|
network: 'testnet',
|
|
@@ -128,4 +129,4 @@ type PaymentReceipt = {
|
|
|
128
129
|
- [Getting Started Guide](/payment-kit/getting-started) - Detailed setup and usage instructions
|
|
129
130
|
- [Payment Processing](/payment-kit/payment-processing) - Learn about different payment models
|
|
130
131
|
- [Registry Management](/payment-kit/registry-management) - Create and configure payment registries
|
|
131
|
-
- [SDK API Reference](/payment-kit/payment-kit-sdk) - Complete SDK API documentation
|
|
132
|
+
- [SDK API Reference](/payment-kit/payment-kit-sdk) - Complete SDK API documentation
|
package/docs/llms-index.md
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
# Payment Kit
|
|
2
|
-
|
|
3
2
|
> Accept payments in any coin type on Sui
|
|
4
3
|
|
|
5
|
-
- [Payment Kit](..md): Accept payments in any coin type on the Sui blockchain with built-in
|
|
6
|
-
duplicate prevention.
|
|
4
|
+
- [Payment Kit](..md): Accept payments in any coin type on the Sui blockchain with built-in duplicate prevention.
|
|
7
5
|
- [Getting Started](./getting-started.md): Install and set up Payment Kit for your Sui application.
|
|
8
|
-
- [Payment Kit SDK](./payment-kit-sdk.md): Payment Kit SDK API reference and configuration for the
|
|
9
|
-
|
|
10
|
-
- [
|
|
11
|
-
handle transaction results on Sui.
|
|
12
|
-
- [Registry Management](./registry-management.md): Create, configure, and manage payment registries
|
|
13
|
-
and accepted coin types on Sui.
|
|
6
|
+
- [Payment Kit SDK](./payment-kit-sdk.md): Payment Kit SDK API reference and configuration for the PaymentKitClient.
|
|
7
|
+
- [Payment Processing](./payment-processing.md): Process registry-based and ephemeral payments and handle transaction results on Sui.
|
|
8
|
+
- [Registry Management](./registry-management.md): Create, configure, and manage payment registries and accepted coin types on Sui.
|
package/docs/payment-kit-sdk.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
> Payment Kit SDK API reference and configuration for the PaymentKitClient.
|
|
4
4
|
|
|
5
|
-
> **Note:** This package is in active development and should be used with caution. APIs are
|
|
6
|
-
>
|
|
7
|
-
>
|
|
5
|
+
> **Note:** This package is in active development and should be used with caution. APIs are experimental and
|
|
6
|
+
> subject to breaking changes without notice. We recommend thoroughly testing any implementation
|
|
7
|
+
> before using in production environments.
|
|
8
8
|
|
|
9
9
|
Complete API reference for the Payment Kit SDK.
|
|
10
10
|
|
|
@@ -27,6 +27,7 @@ paymentKit<Name extends string = 'paymentKit'>({
|
|
|
27
27
|
**Example:**
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
+
|
|
30
31
|
const client = new SuiGrpcClient({
|
|
31
32
|
network: 'testnet',
|
|
32
33
|
baseUrl: 'https://fullnode.testnet.sui.io:443',
|
|
@@ -479,6 +480,7 @@ processRegistryPayment(
|
|
|
479
480
|
**Example:**
|
|
480
481
|
|
|
481
482
|
```ts
|
|
483
|
+
|
|
482
484
|
const tx = new Transaction();
|
|
483
485
|
|
|
484
486
|
// Add custom logic before payment
|
|
@@ -646,6 +648,7 @@ type PaymentUriParams = {
|
|
|
646
648
|
**Example:**
|
|
647
649
|
|
|
648
650
|
```ts
|
|
651
|
+
|
|
649
652
|
// Create a URI for a registry-based payment
|
|
650
653
|
const uri = createPaymentTransactionUri({
|
|
651
654
|
receiverAddress: '0x1234...abcd',
|
|
@@ -705,6 +708,7 @@ parsePaymentTransactionUri(uri: string): PaymentUriParams
|
|
|
705
708
|
**Example:**
|
|
706
709
|
|
|
707
710
|
```ts
|
|
711
|
+
|
|
708
712
|
const uri =
|
|
709
713
|
'sui:pay?receiver=0x1234...&amount=1000000000&coinType=0x2::sui::SUI&nonce=abc123®istry=my-registry';
|
|
710
714
|
|
|
@@ -740,4 +744,4 @@ const tx = client.paymentKit.tx.processRegistryPayment({
|
|
|
740
744
|
|
|
741
745
|
Check the
|
|
742
746
|
[CHANGELOG](https://github.com/MystenLabs/ts-sdks/blob/main/packages/payment-kit/CHANGELOG.md) for
|
|
743
|
-
updates.
|
|
747
|
+
updates.
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
> Process registry-based and ephemeral payments and handle transaction results on Sui.
|
|
4
4
|
|
|
5
|
-
> **Note:** This package is in active development and should be used with caution. APIs are
|
|
6
|
-
>
|
|
7
|
-
>
|
|
5
|
+
> **Note:** This package is in active development and should be used with caution. APIs are experimental and
|
|
6
|
+
> subject to breaking changes without notice. We recommend thoroughly testing any implementation
|
|
7
|
+
> before using in production environments.
|
|
8
8
|
|
|
9
9
|
Payment Kit provides two distinct payment processing models, each designed for different use cases.
|
|
10
10
|
This guide explains how each model works and when to use them.
|
|
@@ -276,6 +276,7 @@ if (receiptEvent) {
|
|
|
276
276
|
You can combine multiple payment operations in a single transaction:
|
|
277
277
|
|
|
278
278
|
```ts
|
|
279
|
+
|
|
279
280
|
const tx = new Transaction();
|
|
280
281
|
|
|
281
282
|
// Add multiple registry payments
|
|
@@ -368,4 +369,4 @@ Ephemeral payments have lower gas costs because they:
|
|
|
368
369
|
|
|
369
370
|
## Next steps
|
|
370
371
|
|
|
371
|
-
- [Registry Management](./registry-management) - Learn how to create and configure custom registries
|
|
372
|
+
- [Registry Management](./registry-management) - Learn how to create and configure custom registries
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
> Create, configure, and manage payment registries and accepted coin types on Sui.
|
|
4
4
|
|
|
5
|
-
> **Note:** This package is in active development and should be used with caution. APIs are
|
|
6
|
-
>
|
|
7
|
-
>
|
|
5
|
+
> **Note:** This package is in active development and should be used with caution. APIs are experimental and
|
|
6
|
+
> subject to breaking changes without notice. We recommend thoroughly testing any implementation
|
|
7
|
+
> before using in production environments.
|
|
8
8
|
|
|
9
9
|
Payment registries are the core of Payment Kit's duplicate prevention and payment tracking system.
|
|
10
10
|
This guide covers creating, configuring, and managing payment registries.
|
|
@@ -224,6 +224,7 @@ const tx = client.paymentKit.tx.processRegistryPayment({
|
|
|
224
224
|
You can configure both settings independently:
|
|
225
225
|
|
|
226
226
|
```ts
|
|
227
|
+
|
|
227
228
|
const tx = new Transaction();
|
|
228
229
|
|
|
229
230
|
// Set expiration duration
|
|
@@ -400,6 +401,7 @@ const record = await client.paymentKit.getPaymentRecord({
|
|
|
400
401
|
Here's a complete workflow for setting up a custom registry:
|
|
401
402
|
|
|
402
403
|
```ts
|
|
404
|
+
|
|
403
405
|
const client = new SuiGrpcClient({
|
|
404
406
|
network: 'testnet',
|
|
405
407
|
baseUrl: 'https://fullnode.testnet.sui.io:443',
|
|
@@ -524,4 +526,4 @@ console.log('First payment processed:', paymentResult.Transaction.digest);
|
|
|
524
526
|
|
|
525
527
|
## Next steps
|
|
526
528
|
|
|
527
|
-
- [SDK API Reference](./payment-kit-sdk) - Complete SDK API documentation
|
|
529
|
+
- [SDK API Reference](./payment-kit-sdk) - Complete SDK API documentation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mysten/payment-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Sui Payment Kit",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,20 +29,18 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"typescript": "^5.9.3",
|
|
32
|
-
"vitest": "^4.0.17"
|
|
33
|
-
"@mysten/codegen": "^0.10.3",
|
|
34
|
-
"@mysten/sui": "^2.16.0"
|
|
32
|
+
"vitest": "^4.0.17"
|
|
35
33
|
},
|
|
36
34
|
"dependencies": {
|
|
37
|
-
"@mysten/bcs": "^2.0.
|
|
35
|
+
"@mysten/bcs": "^2.0.5"
|
|
38
36
|
},
|
|
39
37
|
"peerDependencies": {
|
|
40
|
-
"@mysten/sui": "^2.16.
|
|
38
|
+
"@mysten/sui": "^2.16.2"
|
|
41
39
|
},
|
|
42
40
|
"scripts": {
|
|
43
41
|
"clean": "rm -rf tsconfig.tsbuildinfo ./dist",
|
|
44
42
|
"build": "rm -rf dist && tsc --noEmit && tsdown",
|
|
45
|
-
"build:docs": "
|
|
43
|
+
"build:docs": "node ../docs/scripts/build-docs.ts",
|
|
46
44
|
"codegen": "sui-ts-codegen generate && pnpm lint:fix",
|
|
47
45
|
"prettier:check": "prettier -c --ignore-unknown .",
|
|
48
46
|
"prettier:fix": "prettier -w --ignore-unknown .",
|