@0to1pay/server-sdk 2.3.0 → 3.0.0
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 +8 -16
- package/dist/contracts/openapi.yaml +25 -42
- package/dist/packages/server-sdk/index.d.ts +0 -1
- package/dist/packages/server-sdk/index.js +4 -21
- package/dist/packages/server-sdk/schema.d.ts +22 -30
- package/package.json +1 -1
- package/dist/packages/server-sdk/solana-recipient-proof.d.ts +0 -3
- package/dist/packages/server-sdk/solana-recipient-proof.js +0 -28
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# 0to1Pay Server SDK
|
|
2
2
|
|
|
3
|
-
Node.js 22.20.0 or newer. Install the SDK from npm
|
|
3
|
+
Node.js 22.20.0 or newer. Install the SDK from npm or use the verified tarball in your merchant backend.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
npm install @0to1pay/server-sdk@
|
|
6
|
+
npm install @0to1pay/server-sdk@3.0.0
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npm install ./0to1pay-server-sdk-
|
|
10
|
+
npm install ./0to1pay-server-sdk-3.0.0.tgz
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
On a deployment with public signup enabled,
|
|
13
|
+
On a deployment with public signup enabled, open `/merchant` on the Web origin provided by your platform operator. Sign in to **My workspace**, select a project and issue a scoped Sandbox key from **API keys**. On a restricted deployment, get a test project and server key from the platform operator. Set the HTTPS API origin and scoped key in your app's backend environment.
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { ZeroToOnePayClient } from '@0to1pay/server-sdk';
|
|
@@ -36,13 +36,13 @@ Call `listChainAssets` for the assets enabled in the key's environment. The plat
|
|
|
36
36
|
|
|
37
37
|
When Platform enables Base Sepolia, a Sandbox key can discover test USDC at `eip155:84532`. An empty test asset list means the deployment has no test assets configured. Use a registered test connection, recipient, and webhook endpoint from the same project for a Sandbox checkout.
|
|
38
38
|
|
|
39
|
-
Call `createQuote` with the matching denomination or its registered asset on the selected chain. Then call `createAttempt` with `connection_id` and `quote_id` to read the reserved destination and transfer instructions. Finish checkout with the buyer authorization and signed transaction steps below.
|
|
39
|
+
Call `createQuote` with the matching denomination or its registered asset on the selected chain. Then call `createAttempt` with `connection_id` and `quote_id` to read the reserved destination and transfer instructions. Finish checkout with the buyer authorization and signed transaction steps below.
|
|
40
40
|
|
|
41
41
|
## Payment receipts
|
|
42
42
|
|
|
43
|
-
The
|
|
43
|
+
The Platform must support `GET /v1/payments/{payment_id}/receipt`.
|
|
44
44
|
|
|
45
|
-
Call `getPaymentReceipt(payment_id)` with a server key that has `payments:read`. Display each confirmed amount with its own asset, scale, and network. The receipt reports the funds received at the order’s destinations. Use the payment decision to determine whether to grant the purchased product. An empty available receipt has no confirmed funds.
|
|
45
|
+
Call `getPaymentReceipt(payment_id)` with a server key that has `payments:read`. Display each confirmed amount with its own asset, scale, and network. The receipt reports the funds received at the order’s destinations. Use the payment decision to determine whether to grant the purchased product. An empty available receipt has no confirmed funds. Payments without canonical receipt data can return `availability: "unavailable"`.
|
|
46
46
|
|
|
47
47
|
## Buyer approval for on-chain checkout
|
|
48
48
|
|
|
@@ -55,9 +55,7 @@ The merchant backend authenticates the buyer and checks their access to the quot
|
|
|
55
55
|
|
|
56
56
|
Use the wallet's UTF-8 message signing for the chain. Ethereum and Base use the EVM personal-message signature. TRON uses `signMessageV2`, which returns a `0x`-prefixed signature. EVM and TRON transaction hashes must contain 64 hexadecimal digits. The claim helper accepts `0x` or `0X` and normalizes to lowercase `0x`-prefixed hex. TRON also accepts bare hex.
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
The platform compares the finalized transaction's actual token source with the approved wallet and checks the exact token, destination, amount, and timing. An observed transfer without a matching signed claim is held for operator review. In the [0to1Pay Console](https://github.com/0to1pay/console), open the order and select **Review transfer** on the exact confirmed receipt in **Money movements**. A service with `payments:review` can also call `reviewPayment` with `action: 'accept_unattributed_chain_payment'`, that receipt's `movement_id`, the expected payment resource version, and a reason. Set `allow_late_payment: true` only when deliberately approving the specified late transfer. Exchange withdrawals can use this operational review path.
|
|
58
|
+
The platform compares the finalized transaction's actual token source with the approved wallet and checks the exact token, destination, amount, and timing. An observed transfer without a matching signed claim is held for operator review. Sign in with the reviewer role at `/console` on your deployment’s operator Web origin (`CONSOLE_PUBLIC_ORIGIN`). Open the order, find the confirmed receipt in **Money movements**, and select **Review transfer**. A service with `payments:review` can also call `reviewPayment` with `action: 'accept_unattributed_chain_payment'`, that receipt's `movement_id`, the expected payment resource version, and a reason. Set `allow_late_payment: true` only when deliberately approving the specified late transfer. Exchange withdrawals can use this operational review path.
|
|
61
59
|
|
|
62
60
|
## Subscription and API request allowance
|
|
63
61
|
|
|
@@ -73,10 +71,4 @@ Use the paid subscription flow to issue a live server key.
|
|
|
73
71
|
|
|
74
72
|
The allowance counts admitted requests to metered endpoints, including idempotent replays. `API_REQUEST_LIMIT_REACHED` indicates the period's allowance is exhausted. Payment completion and fulfillment operations remain available to keys with the appropriate scopes.
|
|
75
73
|
|
|
76
|
-
## Upgrade from 1.x
|
|
77
|
-
|
|
78
|
-
- Replace `createConnection`, `validateConnection`, and `rotateConnectionCredentials` with a watch-only `createChainConnection` and registered merchant-controlled recipients.
|
|
79
|
-
- Replace `attachExternalAttempt` and `confirmAttempt` with a chain quote and buyer-authorized transaction claim. The `createAttempt` request has `connection_id` and `quote_id`, and returns `201` for the assigned chain attempt.
|
|
80
|
-
- Use `getOperation` to inspect operation history. `recoverOperation` and `ingestProviderWebhook` are retired. Merchant fulfillment still uses the signed outbound events handled by `@0to1pay/fulfillment-sdk`.
|
|
81
|
-
|
|
82
74
|
The SDK is available under the MIT license. See the `LICENSE` file included in the package.
|
|
@@ -5,7 +5,7 @@ info:
|
|
|
5
5
|
version: 1.0.0-design
|
|
6
6
|
description: 'Seller API for USDC and USDT payments on supported networks and verified order fulfillment.
|
|
7
7
|
Resource IDs are UUID strings. Merchant API keys are scoped to a merchant, project and environment.
|
|
8
|
-
|
|
8
|
+
Payments settle in USDC or USDT on supported networks.'
|
|
9
9
|
servers:
|
|
10
10
|
- url: /v1
|
|
11
11
|
description: Use the origin that serves the OpenAPI document.
|
|
@@ -499,7 +499,7 @@ paths:
|
|
|
499
499
|
summary: Read the confirmed funds received for a payment
|
|
500
500
|
tags: [Payments]
|
|
501
501
|
x-required-scope: payments:read
|
|
502
|
-
description: Returns current finalized on-chain funds linked to this payment's bound quote recipients, grouped by exact token and network. Confirmed reversals, refunds, and dispute adjustments are deducted. These are deposits to the order's recipients and do not establish payer identity or eligibility for fulfillment.
|
|
502
|
+
description: Returns current finalized on-chain funds linked to this payment's bound quote recipients, grouped by exact token and network. Confirmed reversals, refunds, and dispute adjustments are deducted. These are deposits to the order's recipients and do not establish payer identity or eligibility for fulfillment. Payments without canonical receipt data are reported as unavailable.
|
|
503
503
|
responses:
|
|
504
504
|
'200':
|
|
505
505
|
description: Successful scoped receipt response.
|
|
@@ -1024,7 +1024,7 @@ paths:
|
|
|
1024
1024
|
/connections:
|
|
1025
1025
|
get:
|
|
1026
1026
|
operationId: listConnections
|
|
1027
|
-
summary: List chain connections
|
|
1027
|
+
summary: List chain connections
|
|
1028
1028
|
tags:
|
|
1029
1029
|
- Connections
|
|
1030
1030
|
x-required-scope: connections:read
|
|
@@ -1708,32 +1708,31 @@ components:
|
|
|
1708
1708
|
pattern: '^0x[0-9a-fA-F]{64}$'
|
|
1709
1709
|
ChainSelectorId:
|
|
1710
1710
|
type: integer
|
|
1711
|
-
enum: [1,
|
|
1712
|
-
description: EVM or TRON chain
|
|
1711
|
+
enum: [1, 8453, 84532, 31337, 31339, 728126428, 900003]
|
|
1712
|
+
description: Supported EVM or TRON chain selector. Use network_id for the network reference.
|
|
1713
1713
|
ChainNetworkId:
|
|
1714
1714
|
type: string
|
|
1715
|
-
pattern: '^(eip155:
|
|
1715
|
+
pattern: '^(eip155:(1|8453|84532|31337|31339)|tron:(728126428|900003|0x2b6653dc))$'
|
|
1716
1716
|
description: Decimal TRON identifiers are emitted. The hexadecimal TRON mainnet alias is accepted on connection creation.
|
|
1717
1717
|
ChainFamily:
|
|
1718
1718
|
type: string
|
|
1719
|
-
enum: [evm,
|
|
1719
|
+
enum: [evm, tron]
|
|
1720
1720
|
StableDenomination:
|
|
1721
1721
|
type: string
|
|
1722
1722
|
enum: ['stable:USDC', 'stable:USDT']
|
|
1723
1723
|
description: Order denomination, expressed in six decimal places.
|
|
1724
1724
|
ChainTokenSymbol:
|
|
1725
1725
|
type: string
|
|
1726
|
-
enum: [USDC, USDT
|
|
1727
|
-
description: Display ticker. USDT0 is the ASCII display spelling of USD₮0.
|
|
1726
|
+
enum: [USDC, USDT]
|
|
1728
1727
|
ChainAssetRepresentation:
|
|
1729
1728
|
type: string
|
|
1730
|
-
enum: [native,
|
|
1731
|
-
description:
|
|
1729
|
+
enum: [native, fixture]
|
|
1730
|
+
description: Native tokens are used for live checkout.
|
|
1732
1731
|
ChainAddress:
|
|
1733
1732
|
oneOf:
|
|
1734
1733
|
- $ref: '#/components/schemas/EvmAddress'
|
|
1735
1734
|
- type: string
|
|
1736
|
-
pattern: '^[1-9A-HJ-NP-Za-km-z]{
|
|
1735
|
+
pattern: '^T[1-9A-HJ-NP-Za-km-z]{33}$'
|
|
1737
1736
|
ChainQuoteTerms:
|
|
1738
1737
|
type: object
|
|
1739
1738
|
additionalProperties: false
|
|
@@ -1753,12 +1752,10 @@ components:
|
|
|
1753
1752
|
$ref: '#/components/schemas/ChainAssetRepresentation'
|
|
1754
1753
|
token_address:
|
|
1755
1754
|
$ref: '#/components/schemas/ChainAddress'
|
|
1756
|
-
recipient_owner:
|
|
1757
|
-
$ref: '#/components/schemas/ChainAddress'
|
|
1758
1755
|
start_block:
|
|
1759
1756
|
type: string
|
|
1760
1757
|
pattern: '^[1-9][0-9]{0,18}$'
|
|
1761
|
-
description: First block
|
|
1758
|
+
description: First block eligible for observation.
|
|
1762
1759
|
anchor_hash:
|
|
1763
1760
|
$ref: '#/components/schemas/EvmHash'
|
|
1764
1761
|
starts_at_epoch:
|
|
@@ -1827,7 +1824,7 @@ components:
|
|
|
1827
1824
|
properties:
|
|
1828
1825
|
denomination:
|
|
1829
1826
|
$ref: '#/components/schemas/StableDenomination'
|
|
1830
|
-
description: Determines the denomination for recipient registration. Omission selects USDC on EVM
|
|
1827
|
+
description: Determines the denomination for recipient registration. Omission selects USDC on EVM or USDT on TRON. EVM recipients are shared before a quote is assigned.
|
|
1831
1828
|
recipients:
|
|
1832
1829
|
type: array
|
|
1833
1830
|
minItems: 1
|
|
@@ -1839,12 +1836,12 @@ components:
|
|
|
1839
1836
|
properties:
|
|
1840
1837
|
address:
|
|
1841
1838
|
$ref: '#/components/schemas/ChainAddress'
|
|
1842
|
-
description: Seller wallet address.
|
|
1839
|
+
description: Seller wallet address.
|
|
1843
1840
|
signature:
|
|
1844
1841
|
type: string
|
|
1845
1842
|
writeOnly: true
|
|
1846
|
-
pattern: '^0x[0-9a-fA-F]{
|
|
1847
|
-
description: Scoped EIP-191 proof on EVM
|
|
1843
|
+
pattern: '^0x[0-9a-fA-F]{130}$'
|
|
1844
|
+
description: Scoped EIP-191 proof on EVM or TIP-191 personal proof on TRON, encoded as hex.
|
|
1848
1845
|
ChainRecipients:
|
|
1849
1846
|
type: object
|
|
1850
1847
|
additionalProperties: false
|
|
@@ -1859,10 +1856,9 @@ components:
|
|
|
1859
1856
|
$ref: '#/components/schemas/ChainNetworkId'
|
|
1860
1857
|
denomination:
|
|
1861
1858
|
$ref: '#/components/schemas/StableDenomination'
|
|
1862
|
-
description: Solana denomination for these mint-specific addresses.
|
|
1863
1859
|
addresses:
|
|
1864
1860
|
type: array
|
|
1865
|
-
description:
|
|
1861
|
+
description: Registered wallet addresses.
|
|
1866
1862
|
items:
|
|
1867
1863
|
$ref: '#/components/schemas/ChainAddress'
|
|
1868
1864
|
Money:
|
|
@@ -1870,7 +1866,7 @@ components:
|
|
|
1870
1866
|
properties:
|
|
1871
1867
|
asset:
|
|
1872
1868
|
type: string
|
|
1873
|
-
description: A stablecoin denomination or exact registered chain asset.
|
|
1869
|
+
description: A stablecoin denomination or exact registered chain asset.
|
|
1874
1870
|
minLength: 1
|
|
1875
1871
|
maxLength: 160
|
|
1876
1872
|
amount_atomic:
|
|
@@ -2420,10 +2416,6 @@ components:
|
|
|
2420
2416
|
type:
|
|
2421
2417
|
type: string
|
|
2422
2418
|
enum:
|
|
2423
|
-
- checkout_session
|
|
2424
|
-
- payment_intent
|
|
2425
|
-
- paypal_order
|
|
2426
|
-
- paypal_capture
|
|
2427
2419
|
- chain_transaction
|
|
2428
2420
|
id:
|
|
2429
2421
|
type: string
|
|
@@ -2468,8 +2460,6 @@ components:
|
|
|
2468
2460
|
$ref: '#/components/schemas/ChainTokenSymbol'
|
|
2469
2461
|
representation:
|
|
2470
2462
|
$ref: '#/components/schemas/ChainAssetRepresentation'
|
|
2471
|
-
recipient_owner:
|
|
2472
|
-
$ref: '#/components/schemas/ChainAddress'
|
|
2473
2463
|
starts_at_epoch:
|
|
2474
2464
|
type: integer
|
|
2475
2465
|
minimum: 1
|
|
@@ -2630,7 +2620,7 @@ components:
|
|
|
2630
2620
|
- resource_version
|
|
2631
2621
|
additionalProperties: false
|
|
2632
2622
|
description: A transfer instruction identifies the registered asset and assigned recipient for an unfinished quote.
|
|
2633
|
-
The Worker verifies funds from finalized chain evidence.
|
|
2623
|
+
The Worker verifies funds from finalized chain evidence. The transfer instruction is available while the quote can accept payment.
|
|
2634
2624
|
allOf:
|
|
2635
2625
|
- if:
|
|
2636
2626
|
properties:
|
|
@@ -2792,7 +2782,7 @@ components:
|
|
|
2792
2782
|
type: string
|
|
2793
2783
|
family:
|
|
2794
2784
|
type: string
|
|
2795
|
-
enum: [evm
|
|
2785
|
+
enum: [evm]
|
|
2796
2786
|
is_default:
|
|
2797
2787
|
type: boolean
|
|
2798
2788
|
required: [network_id, network_name, family, is_default]
|
|
@@ -2905,12 +2895,12 @@ components:
|
|
|
2905
2895
|
description: Stable opaque reference assigned by the merchant server to the authenticated buyer checkout.
|
|
2906
2896
|
ChainIntentSignature:
|
|
2907
2897
|
type: string
|
|
2908
|
-
pattern: '^0x
|
|
2909
|
-
description:
|
|
2898
|
+
pattern: '^0x[0-9A-Fa-f]{130}$'
|
|
2899
|
+
description: A 0x-prefixed 65-byte wallet signature.
|
|
2910
2900
|
ChainIntentTransactionId:
|
|
2911
2901
|
type: string
|
|
2912
|
-
pattern: '^(0x[0-9A-Fa-f]{64}
|
|
2913
|
-
description: EVM and TRON IDs are canonicalized to lowercase 0x-prefixed hex. TRON accepts bare hex.
|
|
2902
|
+
pattern: '^(0x)?[0-9A-Fa-f]{64}$'
|
|
2903
|
+
description: EVM and TRON IDs are canonicalized to lowercase 0x-prefixed hex. TRON accepts bare hex.
|
|
2914
2904
|
CreateChainIntent:
|
|
2915
2905
|
type: object
|
|
2916
2906
|
properties:
|
|
@@ -3144,10 +3134,7 @@ components:
|
|
|
3144
3134
|
provider:
|
|
3145
3135
|
type: string
|
|
3146
3136
|
enum:
|
|
3147
|
-
- stripe
|
|
3148
|
-
- paypal
|
|
3149
3137
|
- evm
|
|
3150
|
-
- solana
|
|
3151
3138
|
- tron
|
|
3152
3139
|
chain_id:
|
|
3153
3140
|
$ref: '#/components/schemas/ChainSelectorId'
|
|
@@ -3186,9 +3173,6 @@ components:
|
|
|
3186
3173
|
format: uri
|
|
3187
3174
|
minItems: 0
|
|
3188
3175
|
maxItems: 1000
|
|
3189
|
-
webhook_url:
|
|
3190
|
-
description: Retained for historical reads.
|
|
3191
|
-
type: 'null'
|
|
3192
3176
|
validated_at:
|
|
3193
3177
|
anyOf:
|
|
3194
3178
|
- type: string
|
|
@@ -3218,13 +3202,12 @@ components:
|
|
|
3218
3202
|
- status
|
|
3219
3203
|
- capabilities
|
|
3220
3204
|
- return_origins
|
|
3221
|
-
- webhook_url
|
|
3222
3205
|
- validated_at
|
|
3223
3206
|
- created_at
|
|
3224
3207
|
- updated_at
|
|
3225
3208
|
- resource_version
|
|
3226
3209
|
additionalProperties: false
|
|
3227
|
-
description: Ready chain connections can be used for new payments.
|
|
3210
|
+
description: Ready chain connections can be used for new payments.
|
|
3228
3211
|
allOf:
|
|
3229
3212
|
- if:
|
|
3230
3213
|
properties:
|
|
@@ -198,6 +198,5 @@ export declare class ZeroToOnePayClient {
|
|
|
198
198
|
})>;
|
|
199
199
|
}
|
|
200
200
|
export { recipientProofMessage, type RecipientProof } from './recipient-proof.js';
|
|
201
|
-
export { solanaRecipientProofMessage } from './solana-recipient-proof.js';
|
|
202
201
|
export { tronRecipientProofMessage } from './tron-recipient-proof.js';
|
|
203
202
|
export { ZeroToOnePayClient as PaymentToFulfillmentClient, ZeroToOnePayContractError as PaymentToFulfillmentContractError, ZeroToOnePayError as PaymentToFulfillmentError, type ZeroToOnePayClientOptions as PaymentToFulfillmentClientOptions, };
|
|
@@ -14,29 +14,13 @@ for (const [path, item] of Object.entries(spec.paths)) {
|
|
|
14
14
|
const keyPattern = /^[A-Za-z0-9._:-]{16,128}$/;
|
|
15
15
|
const hexTransactionId = /^0x[0-9a-f]{64}$/i;
|
|
16
16
|
const tronTransactionId = /^(?:0x)?[0-9a-f]{64}$/i;
|
|
17
|
-
const solanaTransactionId = /^[1-9A-HJ-NP-Za-km-z]{64,88}$/;
|
|
18
|
-
const base58Alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
19
|
-
function isSolanaTransactionId(value) {
|
|
20
|
-
if (!solanaTransactionId.test(value))
|
|
21
|
-
return false;
|
|
22
|
-
const leadingZeroBytes = value.search(/[^1]/);
|
|
23
|
-
if (leadingZeroBytes < 0 || leadingZeroBytes >= 64)
|
|
24
|
-
return false;
|
|
25
|
-
let decoded = 0n;
|
|
26
|
-
for (const digit of value.slice(leadingZeroBytes)) {
|
|
27
|
-
decoded = decoded * 58n + BigInt(base58Alphabet.indexOf(digit));
|
|
28
|
-
}
|
|
29
|
-
const limit = 1n << BigInt((64 - leadingZeroBytes) * 8);
|
|
30
|
-
return decoded >= (limit >> 8n) && decoded < limit;
|
|
31
|
-
}
|
|
32
17
|
/** Return the exact UTF-8 message the approved payer signs after broadcasting. */
|
|
33
18
|
export function chainIntentClaimMessage(intent, transactionId) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
if (!
|
|
19
|
+
const pattern = intent.family === 'evm' ? hexTransactionId
|
|
20
|
+
: intent.family === 'tron' ? tronTransactionId : undefined;
|
|
21
|
+
if (!pattern?.test(transactionId))
|
|
37
22
|
throw new Error('Invalid chain transaction ID');
|
|
38
|
-
const canonical =
|
|
39
|
-
'0x' + transactionId.replace(/^0x/i, '').toLowerCase();
|
|
23
|
+
const canonical = '0x' + transactionId.replace(/^0x/i, '').toLowerCase();
|
|
40
24
|
return intent.signing_message + '\nTransaction: ' + canonical;
|
|
41
25
|
}
|
|
42
26
|
export class ZeroToOnePayError extends Error {
|
|
@@ -190,7 +174,6 @@ export class ZeroToOnePayClient {
|
|
|
190
174
|
}
|
|
191
175
|
}
|
|
192
176
|
export { recipientProofMessage } from './recipient-proof.js';
|
|
193
|
-
export { solanaRecipientProofMessage } from './solana-recipient-proof.js';
|
|
194
177
|
export { tronRecipientProofMessage } from './tron-recipient-proof.js';
|
|
195
178
|
// Keep the SDK exports used by existing merchant integrations.
|
|
196
179
|
export { ZeroToOnePayClient as PaymentToFulfillmentClient, ZeroToOnePayContractError as PaymentToFulfillmentContractError, ZeroToOnePayError as PaymentToFulfillmentError, };
|
|
@@ -283,7 +283,7 @@ export interface paths {
|
|
|
283
283
|
};
|
|
284
284
|
/**
|
|
285
285
|
* Read the confirmed funds received for a payment
|
|
286
|
-
* @description Returns current finalized on-chain funds linked to this payment's bound quote recipients, grouped by exact token and network. Confirmed reversals, refunds, and dispute adjustments are deducted. These are deposits to the order's recipients and do not establish payer identity or eligibility for fulfillment.
|
|
286
|
+
* @description Returns current finalized on-chain funds linked to this payment's bound quote recipients, grouped by exact token and network. Confirmed reversals, refunds, and dispute adjustments are deducted. These are deposits to the order's recipients and do not establish payer identity or eligibility for fulfillment. Payments without canonical receipt data are reported as unavailable.
|
|
287
287
|
*/
|
|
288
288
|
get: operations["getPaymentReceipt"];
|
|
289
289
|
put?: never;
|
|
@@ -537,7 +537,7 @@ export interface paths {
|
|
|
537
537
|
path?: never;
|
|
538
538
|
cookie?: never;
|
|
539
539
|
};
|
|
540
|
-
/** List chain connections
|
|
540
|
+
/** List chain connections */
|
|
541
541
|
get: operations["listConnections"];
|
|
542
542
|
put?: never;
|
|
543
543
|
post?: never;
|
|
@@ -784,29 +784,26 @@ export interface components {
|
|
|
784
784
|
EvmAddress: string;
|
|
785
785
|
EvmHash: string;
|
|
786
786
|
/**
|
|
787
|
-
* @description EVM or TRON chain
|
|
787
|
+
* @description Supported EVM or TRON chain selector. Use network_id for the network reference.
|
|
788
788
|
* @enum {integer}
|
|
789
789
|
*/
|
|
790
|
-
ChainSelectorId: 1 |
|
|
790
|
+
ChainSelectorId: 1 | 8453 | 84532 | 31337 | 31339 | 728126428 | 900003;
|
|
791
791
|
/** @description Decimal TRON identifiers are emitted. The hexadecimal TRON mainnet alias is accepted on connection creation. */
|
|
792
792
|
ChainNetworkId: string;
|
|
793
793
|
/** @enum {string} */
|
|
794
|
-
ChainFamily: "evm" | "
|
|
794
|
+
ChainFamily: "evm" | "tron";
|
|
795
795
|
/**
|
|
796
796
|
* @description Order denomination, expressed in six decimal places.
|
|
797
797
|
* @enum {string}
|
|
798
798
|
*/
|
|
799
799
|
StableDenomination: "stable:USDC" | "stable:USDT";
|
|
800
|
+
/** @enum {string} */
|
|
801
|
+
ChainTokenSymbol: "USDC" | "USDT";
|
|
800
802
|
/**
|
|
801
|
-
* @description
|
|
802
|
-
* @enum {string}
|
|
803
|
-
*/
|
|
804
|
-
ChainTokenSymbol: "USDC" | "USDT" | "USDT0";
|
|
805
|
-
/**
|
|
806
|
-
* @description Token deployment type. Historical quotes can include USDT0 or a Standard Bridge token. New live quotes use native tokens.
|
|
803
|
+
* @description Native tokens are used for live checkout.
|
|
807
804
|
* @enum {string}
|
|
808
805
|
*/
|
|
809
|
-
ChainAssetRepresentation: "native" | "
|
|
806
|
+
ChainAssetRepresentation: "native" | "fixture";
|
|
810
807
|
ChainAddress: components["schemas"]["EvmAddress"] | string;
|
|
811
808
|
ChainQuoteTerms: {
|
|
812
809
|
chain_id: components["schemas"]["ChainSelectorId"];
|
|
@@ -816,8 +813,7 @@ export interface components {
|
|
|
816
813
|
symbol?: components["schemas"]["ChainTokenSymbol"];
|
|
817
814
|
representation?: components["schemas"]["ChainAssetRepresentation"];
|
|
818
815
|
token_address: components["schemas"]["ChainAddress"];
|
|
819
|
-
|
|
820
|
-
/** @description First block or slot eligible for observation. */
|
|
816
|
+
/** @description First block eligible for observation. */
|
|
821
817
|
start_block: string;
|
|
822
818
|
anchor_hash: components["schemas"]["EvmHash"];
|
|
823
819
|
/** @description Earliest eligible transfer time, as a UTC Unix timestamp in seconds. */
|
|
@@ -847,12 +843,12 @@ export interface components {
|
|
|
847
843
|
network_id?: components["schemas"]["ChainNetworkId"];
|
|
848
844
|
} & (unknown | unknown);
|
|
849
845
|
RegisterChainRecipients: {
|
|
850
|
-
/** @description Determines the denomination for recipient registration. Omission selects USDC on EVM
|
|
846
|
+
/** @description Determines the denomination for recipient registration. Omission selects USDC on EVM or USDT on TRON. EVM recipients are shared before a quote is assigned. */
|
|
851
847
|
denomination?: components["schemas"]["StableDenomination"];
|
|
852
848
|
recipients: {
|
|
853
|
-
/** @description Seller wallet address.
|
|
849
|
+
/** @description Seller wallet address. */
|
|
854
850
|
address: components["schemas"]["ChainAddress"];
|
|
855
|
-
/** @description Scoped EIP-191 proof on EVM
|
|
851
|
+
/** @description Scoped EIP-191 proof on EVM or TIP-191 personal proof on TRON, encoded as hex. */
|
|
856
852
|
signature: string;
|
|
857
853
|
}[];
|
|
858
854
|
};
|
|
@@ -861,14 +857,13 @@ export interface components {
|
|
|
861
857
|
connection_id: string;
|
|
862
858
|
chain_id: components["schemas"]["ChainSelectorId"];
|
|
863
859
|
network_id?: components["schemas"]["ChainNetworkId"];
|
|
864
|
-
/** @description Solana denomination for these mint-specific addresses. */
|
|
865
860
|
denomination?: components["schemas"]["StableDenomination"];
|
|
866
|
-
/** @description
|
|
861
|
+
/** @description Registered wallet addresses. */
|
|
867
862
|
addresses: components["schemas"]["ChainAddress"][];
|
|
868
863
|
};
|
|
869
864
|
/** @description The asset registry confirms scale. USDC 10.00 is amount_atomic="10000000", scale=6. */
|
|
870
865
|
Money: {
|
|
871
|
-
/** @description A stablecoin denomination or exact registered chain asset.
|
|
866
|
+
/** @description A stablecoin denomination or exact registered chain asset. */
|
|
872
867
|
asset: string;
|
|
873
868
|
/** @description Positive integer in the asset minor unit; never a float. */
|
|
874
869
|
amount_atomic: string;
|
|
@@ -1061,7 +1056,7 @@ export interface components {
|
|
|
1061
1056
|
};
|
|
1062
1057
|
ExternalResource: {
|
|
1063
1058
|
/** @enum {string} */
|
|
1064
|
-
type: "
|
|
1059
|
+
type: "chain_transaction";
|
|
1065
1060
|
id: string;
|
|
1066
1061
|
};
|
|
1067
1062
|
CreateAttempt: {
|
|
@@ -1086,7 +1081,6 @@ export interface components {
|
|
|
1086
1081
|
denomination?: components["schemas"]["StableDenomination"];
|
|
1087
1082
|
symbol?: components["schemas"]["ChainTokenSymbol"];
|
|
1088
1083
|
representation?: components["schemas"]["ChainAssetRepresentation"];
|
|
1089
|
-
recipient_owner?: components["schemas"]["ChainAddress"];
|
|
1090
1084
|
/** @description Earliest eligible transfer time, as a UTC Unix timestamp in seconds. */
|
|
1091
1085
|
starts_at_epoch: number;
|
|
1092
1086
|
/** Format: date-time */
|
|
@@ -1113,7 +1107,7 @@ export interface components {
|
|
|
1113
1107
|
registered_at: string;
|
|
1114
1108
|
verified_at: string | null;
|
|
1115
1109
|
};
|
|
1116
|
-
/** @description A transfer instruction identifies the registered asset and assigned recipient for an unfinished quote. The Worker verifies funds from finalized chain evidence.
|
|
1110
|
+
/** @description A transfer instruction identifies the registered asset and assigned recipient for an unfinished quote. The Worker verifies funds from finalized chain evidence. The transfer instruction is available while the quote can accept payment. */
|
|
1117
1111
|
Attempt: {
|
|
1118
1112
|
/** Format: uuid */
|
|
1119
1113
|
merchant_id: string;
|
|
@@ -1201,7 +1195,7 @@ export interface components {
|
|
|
1201
1195
|
network_id: components["schemas"]["ChainNetworkId"];
|
|
1202
1196
|
network_name: string;
|
|
1203
1197
|
/** @enum {string} */
|
|
1204
|
-
family: "evm"
|
|
1198
|
+
family: "evm";
|
|
1205
1199
|
is_default: boolean;
|
|
1206
1200
|
};
|
|
1207
1201
|
BillingSubscription: {
|
|
@@ -1257,9 +1251,9 @@ export interface components {
|
|
|
1257
1251
|
};
|
|
1258
1252
|
/** @description Stable opaque reference assigned by the merchant server to the authenticated buyer checkout. */
|
|
1259
1253
|
ChainCheckoutSessionRef: string;
|
|
1260
|
-
/** @description
|
|
1254
|
+
/** @description A 0x-prefixed 65-byte wallet signature. */
|
|
1261
1255
|
ChainIntentSignature: string;
|
|
1262
|
-
/** @description EVM and TRON IDs are canonicalized to lowercase 0x-prefixed hex. TRON accepts bare hex.
|
|
1256
|
+
/** @description EVM and TRON IDs are canonicalized to lowercase 0x-prefixed hex. TRON accepts bare hex. */
|
|
1263
1257
|
ChainIntentTransactionId: string;
|
|
1264
1258
|
CreateChainIntent: {
|
|
1265
1259
|
checkout_session_ref: components["schemas"]["ChainCheckoutSessionRef"];
|
|
@@ -1343,7 +1337,7 @@ export interface components {
|
|
|
1343
1337
|
enforce_expiry: boolean;
|
|
1344
1338
|
binding_methods: string[];
|
|
1345
1339
|
};
|
|
1346
|
-
/** @description Ready chain connections can be used for new payments.
|
|
1340
|
+
/** @description Ready chain connections can be used for new payments. */
|
|
1347
1341
|
Connection: {
|
|
1348
1342
|
/** Format: uuid */
|
|
1349
1343
|
merchant_id: string;
|
|
@@ -1353,7 +1347,7 @@ export interface components {
|
|
|
1353
1347
|
/** Format: uuid */
|
|
1354
1348
|
connection_id: string;
|
|
1355
1349
|
/** @enum {string} */
|
|
1356
|
-
provider: "
|
|
1350
|
+
provider: "evm" | "tron";
|
|
1357
1351
|
chain_id?: components["schemas"]["ChainSelectorId"];
|
|
1358
1352
|
network_id?: components["schemas"]["ChainNetworkId"];
|
|
1359
1353
|
network_name?: string;
|
|
@@ -1367,8 +1361,6 @@ export interface components {
|
|
|
1367
1361
|
status: "unvalidated" | "ready" | "disabled" | "error";
|
|
1368
1362
|
capabilities: components["schemas"]["Capabilities"];
|
|
1369
1363
|
return_origins: string[];
|
|
1370
|
-
/** @description Retained for historical reads. */
|
|
1371
|
-
webhook_url: null;
|
|
1372
1364
|
validated_at: string | null;
|
|
1373
1365
|
/** Format: date-time */
|
|
1374
1366
|
created_at: string;
|
package/package.json
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { RecipientProof } from './recipient-proof.js';
|
|
2
|
-
/** Return the exact UTF-8 message a recipient's Solana wallet signs via signMessage. */
|
|
3
|
-
export declare function solanaRecipientProofMessage(input: RecipientProof, denomination?: 'stable:USDC' | 'stable:USDT'): string;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const publicKey = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
2
|
-
const identifier = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
3
|
-
/** Return the exact UTF-8 message a recipient's Solana wallet signs via signMessage. */
|
|
4
|
-
export function solanaRecipientProofMessage(input, denomination = 'stable:USDC') {
|
|
5
|
-
const origin = new URL(input.origin);
|
|
6
|
-
const network = input.chain_id === 900001 ? 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'
|
|
7
|
-
: input.chain_id === 900002 ? 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1' : undefined;
|
|
8
|
-
if (!network || !['https:', 'http:'].includes(origin.protocol) || origin.origin !== input.origin ||
|
|
9
|
-
![input.merchant_id, input.project_id, input.connection_id].every(value => identifier.test(value)) ||
|
|
10
|
-
!['test', 'live'].includes(input.environment) || !publicKey.test(input.address) ||
|
|
11
|
-
input.address === '11111111111111111111111111111111') {
|
|
12
|
-
throw new Error('INVALID_SOLANA_RECIPIENT_PROOF_SCOPE');
|
|
13
|
-
}
|
|
14
|
-
if (denomination !== 'stable:USDC' && denomination !== 'stable:USDT')
|
|
15
|
-
throw new Error('INVALID_SOLANA_RECIPIENT_PROOF_ASSET');
|
|
16
|
-
return [
|
|
17
|
-
denomination === 'stable:USDC' ? 'StablePay Solana recipient registration v1' : 'StablePay Solana recipient registration v2',
|
|
18
|
-
`I authorize the use of my native ${denomination.slice('stable:'.length)} associated token account for one order on this StablePay connection.`,
|
|
19
|
-
'',
|
|
20
|
-
'Origin: ' + origin.origin,
|
|
21
|
-
'Merchant: ' + input.merchant_id.toLowerCase(),
|
|
22
|
-
'Project: ' + input.project_id.toLowerCase(),
|
|
23
|
-
'Environment: ' + input.environment,
|
|
24
|
-
'Connection: ' + input.connection_id.toLowerCase(),
|
|
25
|
-
'Network: ' + network,
|
|
26
|
-
'Wallet: ' + input.address,
|
|
27
|
-
].join('\n');
|
|
28
|
-
}
|