@mysten/payment-kit 0.0.0-experimental-20251001205708 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/README.md +0 -126
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysten/payment-kit",
3
- "version": "0.0.0-experimental-20251001205708",
3
+ "version": "0.0.1",
4
4
  "private": false,
5
5
  "description": "Sui Payment Kit",
6
6
  "license": "Apache-2.0",
@@ -22,11 +22,11 @@
22
22
  "devDependencies": {
23
23
  "typescript": "^5.9.2",
24
24
  "@mysten/build-scripts": "0.0.0",
25
- "@mysten/codegen": "0.0.0-experimental-20251001205708"
25
+ "@mysten/codegen": "0.0.0-experimental-20250930221033"
26
26
  },
27
27
  "dependencies": {
28
28
  "@mysten/bcs": "1.8.0",
29
- "@mysten/sui": "0.0.0-experimental-20251001205708"
29
+ "@mysten/sui": "1.38.0"
30
30
  },
31
31
  "scripts": {
32
32
  "clean": "rm -rf tsconfig.tsbuildinfo ./dist",
package/README.md DELETED
@@ -1,126 +0,0 @@
1
- # `@mysten/payment-kit`
2
-
3
- > ⚠️ **Warning** - This package is in active development. APIs are experimental and subject to
4
- > breaking changes without notice. We recommend thoroughly testing any implementation before using
5
- > in production environments.
6
-
7
- ## Installation
8
-
9
- ```bash
10
- npm install --save @mysten/payment-kit @mysten/sui
11
- ```
12
-
13
- ## Setup
14
-
15
- In order to use the Payment Kit SDK you will first need to create an instance of SuiClient from the
16
- Typescript SDK, and a client instance of the Payment Kit SDK.
17
-
18
- ```ts
19
- import { getFullnodeUrl, SuiClient } from '@mysten/sui/client';
20
- import { PaymentKitClient } from '@mysten/payment-kit';
21
-
22
- const suiClient = new SuiClient({
23
- url: getFullnodeUrl('testnet'),
24
- network: 'testnet',
25
- });
26
-
27
- const paymentKitClient = new PaymentKitClient({
28
- suiClient,
29
- });
30
- ```
31
-
32
- The Payment Kit SDK already includes all relevant package and object IDs to operate against
33
- `mainnet` and `testnet`. No other environments are currently supported. By default, all registry
34
- based payments are routed through a default payment registry, but more on that later.
35
-
36
- ## SDK Overview
37
-
38
- The Payment Kit SDK is designed to allow for direct interactions with the
39
- [sui-payment-kit](https://github.com/MystenLabs/sui-payment-kit) Move Package. This includes:
40
-
41
- - Processing payments
42
- - Creating and managing `PaymentRegistry` instances
43
- - Claiming `PaymentRecord` storage fees
44
- - Querying the state of a `PaymentRecord`
45
- - Constructing relevant Object IDs
46
-
47
- These operations are exposed via a `PaymentKitClient` which provides relevant APIs so an application
48
- doesn't need to know how payments are processed, receipts are created and registry configurations
49
- are stored.
50
-
51
- ### Payment Processing
52
-
53
- There are two distinct ways in which payments are processed. Registry based payments and Ephemeral
54
- payments.
55
-
56
- #### Registry Processed Payments
57
-
58
- When using a `PaymentRegistry` to process a payment a registry must always be specified. A registry
59
- has the ability to specify where funds must be sent and how long a `PaymentRecord` can live before
60
- being eligible for deletion. In addition to registry configurations, a `PaymentRecord` is always
61
- created when using a registry to process a payment. A `PaymentRecord` enforces that a payment
62
- request cannot be fulfilled more than once. The existence of a `PaymentRecord` also guarantees that
63
- a payment has been made. Once a payment has been fulfilled a `PaymentReceipt` is emitted that can be
64
- used as you please.
65
-
66
- #### Ephemeral Payments
67
-
68
- Unlike Registry processed payments, an ephemeral payment does not leverage a registry and does not
69
- write a `PaymentRecord`. This means duplicate payments are not implicitly prevented. Although, a
70
- `PaymentReceipt` is still emitted once completed, similar to registry based payments.
71
-
72
- ### Payment Registries
73
-
74
- At the core of Payment Kit is the `PaymentRegistry`. Currently, a registry is used to process
75
- one-time payments, manage how funds are collected and specify the expiration of a `PaymentRecord`.
76
- While there is a default registry to leverage, entities are encouraged to create and manage their
77
- own registries. This enables easier indexing of relevant payments and reduces the potential for
78
- object congestion. Registries are created via personalized name. This name is then used to derive an
79
- Object ID. This means registry names must be unique.
80
-
81
- #### Registry Configuration
82
-
83
- Configurations are applied to an instance of a `PaymentRegistry`. There are currently two
84
- configurations offered:
85
-
86
- 1. Receipt Epoch Expiration: The number of epochs that must elapse before a `PaymentReceipt` is
87
- eligible to be deleted. Deleting expired receipts is a permissionless operation that anyone can
88
- perform and will result in a small storage rebate for each deleted record, incentivizing
89
- automatic cleanup up of registries.
90
-
91
- 2. Registry Managed Funds: A configuration that specifies if payment funds must be sent to the
92
- registry itself. If a `PaymentRegistry` has set this configuration, the `receiver` must be the
93
- registry itself. Funds can later be claimed by the registry admin. An added benefit to this
94
- configuration is avoiding complicated coin merging, when dealing with high thoroughput payments.
95
- This is because the destination is always the same coin object when the registry is set as the
96
- fund manager.
97
-
98
- ### Payment Records
99
-
100
- As mentioned above, a `PaymentRecord` is only written when using a registry to process a payment.
101
- This payment record is used to guarantee a payment has been made. But note records can be deleted
102
- based on a registries epoch expiration duration (the default expiration is 30 epochs after
103
- creation).
104
-
105
- #### Payment Keys
106
-
107
- A `PaymentRecord` is a Dynamic Field owned by the `PaymentRegistry`. This record is derived via a
108
- `PaymentKey`. A `PaymentKey` is a hash of request payment. This includes the `PaymentID`,
109
- `PaymentAmount`, `CoinType`, and `ReceiverAddress`.
110
-
111
- ### Payment Receipts
112
-
113
- When processing an ephemeral, or registry based, payment a `PaymentReceipt` is always emitted and
114
- returned. This payment receipt can be stored, off-chain, for whateve purpose it may serve to your
115
- application.
116
-
117
- ```ts
118
- type PaymentReceipt = {
119
- paymentType: PaymentType;
120
- paymentId: string;
121
- amount: number;
122
- receiver: string;
123
- coinType: string;
124
- timestampMs: number;
125
- };
126
- ```