@phala/pay-server 0.0.0 → 0.9.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.
- package/LICENSE +202 -0
- package/README.md +213 -1
- package/THIRD_PARTY_NOTICES +25 -0
- package/dist/js/src/shared/checkout-params.d.ts +7 -0
- package/dist/js/src/shared/checkout-params.d.ts.map +1 -0
- package/dist/js/src/shared/checkout-params.js +2 -0
- package/dist/js/src/shared/checkout-params.js.map +1 -0
- package/dist/js-server/src/addresses.d.ts +76 -0
- package/dist/js-server/src/addresses.d.ts.map +1 -0
- package/dist/js-server/src/addresses.js +117 -0
- package/dist/js-server/src/addresses.js.map +1 -0
- package/dist/js-server/src/browser.d.ts +2 -0
- package/dist/js-server/src/browser.d.ts.map +1 -0
- package/dist/js-server/src/browser.js +3 -0
- package/dist/js-server/src/browser.js.map +1 -0
- package/dist/js-server/src/client.d.ts +54 -0
- package/dist/js-server/src/client.d.ts.map +1 -0
- package/dist/js-server/src/client.js +183 -0
- package/dist/js-server/src/client.js.map +1 -0
- package/dist/js-server/src/errors.d.ts +35 -0
- package/dist/js-server/src/errors.d.ts.map +1 -0
- package/dist/js-server/src/errors.js +56 -0
- package/dist/js-server/src/errors.js.map +1 -0
- package/dist/js-server/src/generated/openapi.d.ts +9482 -0
- package/dist/js-server/src/generated/openapi.d.ts.map +1 -0
- package/dist/js-server/src/generated/openapi.js +6 -0
- package/dist/js-server/src/generated/openapi.js.map +1 -0
- package/dist/js-server/src/helpers.d.ts +15 -0
- package/dist/js-server/src/helpers.d.ts.map +1 -0
- package/dist/js-server/src/helpers.js +15 -0
- package/dist/js-server/src/helpers.js.map +1 -0
- package/dist/js-server/src/index.d.ts +12 -0
- package/dist/js-server/src/index.d.ts.map +1 -0
- package/dist/js-server/src/index.js +13 -0
- package/dist/js-server/src/index.js.map +1 -0
- package/dist/js-server/src/json.d.ts +5 -0
- package/dist/js-server/src/json.d.ts.map +1 -0
- package/dist/js-server/src/json.js +114 -0
- package/dist/js-server/src/json.js.map +1 -0
- package/dist/js-server/src/ledger.d.ts +9 -0
- package/dist/js-server/src/ledger.d.ts.map +1 -0
- package/dist/js-server/src/ledger.js +83 -0
- package/dist/js-server/src/ledger.js.map +1 -0
- package/dist/js-server/src/pins.d.ts +19 -0
- package/dist/js-server/src/pins.d.ts.map +1 -0
- package/dist/js-server/src/pins.js +165 -0
- package/dist/js-server/src/pins.js.map +1 -0
- package/dist/js-server/src/resource.d.ts +14 -0
- package/dist/js-server/src/resource.d.ts.map +1 -0
- package/dist/js-server/src/resource.js +32 -0
- package/dist/js-server/src/resource.js.map +1 -0
- package/dist/js-server/src/resources.d.ts +120 -0
- package/dist/js-server/src/resources.d.ts.map +1 -0
- package/dist/js-server/src/resources.js +266 -0
- package/dist/js-server/src/resources.js.map +1 -0
- package/dist/js-server/src/runtime.d.ts +4 -0
- package/dist/js-server/src/runtime.d.ts.map +1 -0
- package/dist/js-server/src/runtime.js +48 -0
- package/dist/js-server/src/runtime.js.map +1 -0
- package/dist/js-server/src/schemas.d.ts +4 -0
- package/dist/js-server/src/schemas.d.ts.map +1 -0
- package/dist/js-server/src/schemas.js +3091 -0
- package/dist/js-server/src/schemas.js.map +1 -0
- package/dist/js-server/src/sweeps.d.ts +78 -0
- package/dist/js-server/src/sweeps.d.ts.map +1 -0
- package/dist/js-server/src/sweeps.js +117 -0
- package/dist/js-server/src/sweeps.js.map +1 -0
- package/dist/js-server/src/transport.d.ts +26 -0
- package/dist/js-server/src/transport.d.ts.map +1 -0
- package/dist/js-server/src/transport.js +248 -0
- package/dist/js-server/src/transport.js.map +1 -0
- package/dist/js-server/src/types.d.ts +111 -0
- package/dist/js-server/src/types.d.ts.map +1 -0
- package/dist/js-server/src/types.js +2 -0
- package/dist/js-server/src/types.js.map +1 -0
- package/dist/js-server/src/validation.d.ts +20 -0
- package/dist/js-server/src/validation.d.ts.map +1 -0
- package/dist/js-server/src/validation.js +43 -0
- package/dist/js-server/src/validation.js.map +1 -0
- package/dist/js-server/src/webhook.d.ts +59 -0
- package/dist/js-server/src/webhook.d.ts.map +1 -0
- package/dist/js-server/src/webhook.js +164 -0
- package/dist/js-server/src/webhook.js.map +1 -0
- package/package.json +55 -4
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { encodeAbiParameters, getAddress, getContractAddress, keccak256, concat, } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* The forwarder `factory` deploys for `treasury` and `salt`: OpenZeppelin 5.x
|
|
4
|
+
* `Clones.predictDeterministicAddressWithImmutableArgs` with `abi.encodePacked(treasury)`, so the
|
|
5
|
+
* address commits to the factory, the implementation, the treasury, and the salt.
|
|
6
|
+
*/
|
|
7
|
+
export function forwarderAddress(factory, implementation, treasury, salt) {
|
|
8
|
+
const initCode = concat([
|
|
9
|
+
"0x61",
|
|
10
|
+
"0x0041", // runtime length: the 45-byte proxy and the 20 treasury bytes
|
|
11
|
+
"0x3d81600a3d39f3",
|
|
12
|
+
"0x363d3d373d3d3d363d73",
|
|
13
|
+
getAddress(implementation),
|
|
14
|
+
"0x5af43d82803e903d91602b57fd5bf3",
|
|
15
|
+
getAddress(treasury),
|
|
16
|
+
]);
|
|
17
|
+
return getContractAddress({
|
|
18
|
+
opcode: "CREATE2",
|
|
19
|
+
from: getAddress(factory),
|
|
20
|
+
salt,
|
|
21
|
+
bytecodeHash: keccak256(initCode),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/** `keccak256(abi.encode(account, client_reference_id, "quote", quote_id))`: a quote's salt. */
|
|
25
|
+
export function quoteSalt(account, clientReferenceId, quoteId) {
|
|
26
|
+
return keccak256(encodeAbiParameters([{ type: "string" }, { type: "string" }, { type: "string" }, { type: "string" }], [account, clientReferenceId, "quote", quoteId]));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* `keccak256(abi.encode(account, livemode, client_reference_id, "deposit_address", version))`:
|
|
30
|
+
* a deposit address's salt, the same on every chain.
|
|
31
|
+
*/
|
|
32
|
+
export function depositAddressSalt(account, livemode, clientReferenceId, version) {
|
|
33
|
+
return keccak256(encodeAbiParameters([
|
|
34
|
+
{ type: "string" },
|
|
35
|
+
{ type: "bool" },
|
|
36
|
+
{ type: "string" },
|
|
37
|
+
{ type: "string" },
|
|
38
|
+
{ type: "uint256" },
|
|
39
|
+
], [account, livemode, clientReferenceId, "deposit_address", BigInt(version)]));
|
|
40
|
+
}
|
|
41
|
+
/** The address of a quote over `treasury`, which you pin yourself (see `verifyQuoteAddress`). */
|
|
42
|
+
export function quoteAddress(forwarder, quote, treasury, account) {
|
|
43
|
+
return forwarderAddress(forwarder.factory, forwarder.implementation, treasury, quoteSalt(account, quote.client_reference_id, quote.id));
|
|
44
|
+
}
|
|
45
|
+
/** A deposit address on the network whose treasury is `treasury`, which you pin yourself. */
|
|
46
|
+
export function depositAddress(forwarder, address, treasury, account) {
|
|
47
|
+
return forwarderAddress(forwarder.factory, forwarder.implementation, treasury, depositAddressSalt(account, address.livemode, address.client_reference_id, address.version));
|
|
48
|
+
}
|
|
49
|
+
/** An address the service returned is not the one your pins derive: show nothing to pay. */
|
|
50
|
+
export { AddressMismatchError } from "./errors.js";
|
|
51
|
+
import { AddressMismatchError } from "./errors.js";
|
|
52
|
+
/**
|
|
53
|
+
* The treasury an address on `chainId` must pay: the pinned one, which the response must name.
|
|
54
|
+
*/
|
|
55
|
+
function pinnedTreasury(pins, livemode, chainId, treasury, where) {
|
|
56
|
+
const pinned = pins.treasuries?.[chainId];
|
|
57
|
+
if (pinned === undefined) {
|
|
58
|
+
if (livemode) {
|
|
59
|
+
throw new AddressMismatchError(`${where}: live mode requires your pinned treasury of chain ${chainId}`);
|
|
60
|
+
}
|
|
61
|
+
console.warn(`${where}: no pinned treasury of chain ${chainId}; the service's ${treasury} is trusted (test mode only)`);
|
|
62
|
+
return treasury;
|
|
63
|
+
}
|
|
64
|
+
if (!sameAddress(pinned, treasury)) {
|
|
65
|
+
throw new AddressMismatchError(`${where} pays a treasury that is not the pinned one`);
|
|
66
|
+
}
|
|
67
|
+
return pinned;
|
|
68
|
+
}
|
|
69
|
+
function requirePins(pins, where) {
|
|
70
|
+
for (const field of ["account", "factory", "implementation"]) {
|
|
71
|
+
if (typeof pins[field] !== "string" || pins[field] === "") {
|
|
72
|
+
throw new AddressMismatchError(`${where}: the pinned ${field} is missing`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function sameAddress(a, b) {
|
|
77
|
+
return a.toLowerCase() === b.toLowerCase();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Recomputes an open quote's address from your pins and returns it, the `expectedAddress` to
|
|
81
|
+
* pass to `<Checkout>`. Throws `AddressMismatchError` unless the quote names your pinned
|
|
82
|
+
* treasury of its chain and its address derives from it; in live mode also when the chain has no
|
|
83
|
+
* pinned treasury.
|
|
84
|
+
*/
|
|
85
|
+
export function verifyQuoteAddress(pins, quote) {
|
|
86
|
+
const where = `quote ${quote.id}`;
|
|
87
|
+
requirePins(pins, where);
|
|
88
|
+
const treasury = pinnedTreasury(pins, quote.livemode, quote.chain_id, quote.treasury, where);
|
|
89
|
+
const derived = quoteAddress(pins, quote, treasury, pins.account);
|
|
90
|
+
if (!sameAddress(derived, quote.address)) {
|
|
91
|
+
throw new AddressMismatchError(`${where} has an address the account cannot derive`);
|
|
92
|
+
}
|
|
93
|
+
return derived;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Recomputes every network of an active deposit address from your pins and returns the address,
|
|
97
|
+
* the same on every network. Throws `AddressMismatchError` as `verifyQuoteAddress` does, for any
|
|
98
|
+
* network.
|
|
99
|
+
*/
|
|
100
|
+
export function verifyDepositAddress(pins, address) {
|
|
101
|
+
requirePins(pins, `deposit address ${address.id}`);
|
|
102
|
+
let first;
|
|
103
|
+
for (const network of address.networks) {
|
|
104
|
+
const where = `deposit address ${address.id} on chain ${network.chain_id}`;
|
|
105
|
+
const treasury = pinnedTreasury(pins, address.livemode, network.chain_id, network.treasury, where);
|
|
106
|
+
const derived = depositAddress(pins, address, treasury, pins.account);
|
|
107
|
+
if (!sameAddress(derived, network.address)) {
|
|
108
|
+
throw new AddressMismatchError(`${where} is not one the account can derive`);
|
|
109
|
+
}
|
|
110
|
+
first ??= derived;
|
|
111
|
+
}
|
|
112
|
+
if (first === undefined) {
|
|
113
|
+
throw new AddressMismatchError(`deposit address ${address.id} has no network`);
|
|
114
|
+
}
|
|
115
|
+
return first;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=addresses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/addresses.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,MAAM,GAGP,MAAM,MAAM,CAAC;AAEd;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAe,EACf,cAAsB,EACtB,QAAgB,EAChB,IAAS;IAET,MAAM,QAAQ,GAAG,MAAM,CAAC;QACtB,MAAM;QACN,QAAQ,EAAE,8DAA8D;QACxE,kBAAkB;QAClB,wBAAwB;QACxB,UAAU,CAAC,cAAc,CAAC;QAC1B,kCAAkC;QAClC,UAAU,CAAC,QAAQ,CAAC;KACrB,CAAC,CAAC;IACH,OAAO,kBAAkB,CAAC;QACxB,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC;QACzB,IAAI;QACJ,YAAY,EAAE,SAAS,CAAC,QAAQ,CAAC;KAClC,CAAC,CAAC;AACL,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,iBAAyB,EAAE,OAAe;IACnF,OAAO,SAAS,CACd,mBAAmB,CACjB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE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;QAC/E,CAAC;QACD,KAAK,KAAK,OAAO,CAAC;IACpB,CAAC;IACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,oBAAoB,CAAC,mBAAmB,OAAO,CAAC,EAAE,iBAAiB,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/browser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../../src/browser.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAC;AACF,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { CheckoutParams } from "../../js/src/shared/checkout-params.js";
|
|
2
|
+
import type { Quote, Deposit, EventObjectResponse } from "./types.js";
|
|
3
|
+
import { type Pins } from "./pins.js";
|
|
4
|
+
import * as Resources from "./resources.js";
|
|
5
|
+
import { type ConstructEventOptions } from "./webhook.js";
|
|
6
|
+
export interface PhalaPayOptions {
|
|
7
|
+
apiKey: string;
|
|
8
|
+
pins: string | Pins;
|
|
9
|
+
apiBase?: string;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
maxAttempts?: number;
|
|
12
|
+
requestDeadlineMs?: number;
|
|
13
|
+
/** Retry safe requests through a planned upgrade for up to five minutes; default false. */
|
|
14
|
+
upgradeTolerance?: boolean;
|
|
15
|
+
fetch?: typeof globalThis.fetch;
|
|
16
|
+
}
|
|
17
|
+
export type Event = Omit<EventObjectResponse, "data" | "pending_webhooks"> & {
|
|
18
|
+
readonly data: Omit<EventObjectResponse["data"], "object" | "previous_attributes"> & {
|
|
19
|
+
readonly object: Readonly<Record<string, unknown>>;
|
|
20
|
+
readonly previous_attributes?: Readonly<Record<string, unknown>> | null;
|
|
21
|
+
};
|
|
22
|
+
readonly pending_webhooks?: EventObjectResponse["pending_webhooks"];
|
|
23
|
+
readonly deposit?: Deposit;
|
|
24
|
+
};
|
|
25
|
+
export declare class PhalaPay {
|
|
26
|
+
#private;
|
|
27
|
+
get pins(): Pins;
|
|
28
|
+
get livemode(): boolean;
|
|
29
|
+
get apiBase(): string;
|
|
30
|
+
readonly quotes: Resources.QuotesResource;
|
|
31
|
+
readonly depositAddresses: Resources.DepositAddressesResource;
|
|
32
|
+
readonly deposits: Resources.DepositsResource;
|
|
33
|
+
readonly refunds: Resources.RefundsResource;
|
|
34
|
+
readonly paymentSettings: Resources.PaymentSettingsResource;
|
|
35
|
+
readonly config: Resources.ConfigResource;
|
|
36
|
+
readonly account: Resources.AccountResource;
|
|
37
|
+
readonly treasuries: Resources.TreasuriesResource;
|
|
38
|
+
readonly apiKeys: Resources.ApiKeysResource;
|
|
39
|
+
readonly webhookEndpoints: Resources.WebhookEndpointsResource;
|
|
40
|
+
readonly events: Resources.EventsResource;
|
|
41
|
+
readonly balance: Resources.BalanceResource;
|
|
42
|
+
readonly sweeps: Resources.SweepsResource;
|
|
43
|
+
readonly forwarders: Resources.ForwardersResource;
|
|
44
|
+
readonly webhooks: Readonly<{
|
|
45
|
+
constructEvent: (body: string | Uint8Array, headers: Headers | Record<string, string | string[] | undefined>, options?: Pick<ConstructEventOptions, "tolerance">) => Promise<Event>;
|
|
46
|
+
}>;
|
|
47
|
+
constructor(options: PhalaPayOptions);
|
|
48
|
+
static fromEnv(env?: Readonly<Record<string, string | undefined>>, options?: {
|
|
49
|
+
apiBase?: string;
|
|
50
|
+
}): PhalaPay;
|
|
51
|
+
close(): Promise<void>;
|
|
52
|
+
checkoutParams(quote: Quote): CheckoutParams;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client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{ ConfigurationError, ResponseValidationError, AddressMismatchError, SignatureVerificationError, } from "./errors.js";
|
|
3
|
+
import { parsePins, validatePins, keyLivemode, normalizeOrigin } from "./pins.js";
|
|
4
|
+
import { Transport } from "./transport.js";
|
|
5
|
+
import * as Resources from "./resources.js";
|
|
6
|
+
import { constructEvent } from "./webhook.js";
|
|
7
|
+
import { isRecord, parseJson } from "./json.js";
|
|
8
|
+
import { contracts, schemas } from "./schemas.js";
|
|
9
|
+
import { valid } from "./validation.js";
|
|
10
|
+
import { verifyQuoteAddress, verifyDepositAddress } from "./addresses.js";
|
|
11
|
+
export class PhalaPay {
|
|
12
|
+
#pins;
|
|
13
|
+
#transport;
|
|
14
|
+
#quotes = new WeakMap();
|
|
15
|
+
get pins() {
|
|
16
|
+
return this.#pins;
|
|
17
|
+
}
|
|
18
|
+
get livemode() {
|
|
19
|
+
return this.#pins.livemode;
|
|
20
|
+
}
|
|
21
|
+
get apiBase() {
|
|
22
|
+
return this.#pins.api_base;
|
|
23
|
+
}
|
|
24
|
+
quotes = new Resources.QuotesResource(this.#execute.bind(this));
|
|
25
|
+
depositAddresses = new Resources.DepositAddressesResource(this.#execute.bind(this));
|
|
26
|
+
deposits = new Resources.DepositsResource(this.#execute.bind(this));
|
|
27
|
+
refunds = new Resources.RefundsResource(this.#execute.bind(this));
|
|
28
|
+
paymentSettings = new Resources.PaymentSettingsResource(this.#execute.bind(this));
|
|
29
|
+
config = new Resources.ConfigResource(this.#execute.bind(this));
|
|
30
|
+
account = new Resources.AccountResource(this.#execute.bind(this));
|
|
31
|
+
treasuries = new Resources.TreasuriesResource(this.#execute.bind(this));
|
|
32
|
+
apiKeys = new Resources.ApiKeysResource(this.#execute.bind(this));
|
|
33
|
+
webhookEndpoints = new Resources.WebhookEndpointsResource(this.#execute.bind(this));
|
|
34
|
+
events = new Resources.EventsResource(this.#execute.bind(this));
|
|
35
|
+
balance = new Resources.BalanceResource(this.#execute.bind(this));
|
|
36
|
+
sweeps = new Resources.SweepsResource(this.#execute.bind(this));
|
|
37
|
+
forwarders = new Resources.ForwardersResource(this.#execute.bind(this));
|
|
38
|
+
webhooks = Object.freeze({ constructEvent: this.#constructEvent.bind(this) });
|
|
39
|
+
constructor(options) {
|
|
40
|
+
requireServer();
|
|
41
|
+
this.#pins =
|
|
42
|
+
typeof options.pins === "string" ? parsePins(options.pins) : validatePins(options.pins);
|
|
43
|
+
if (keyLivemode(options.apiKey) !== this.livemode)
|
|
44
|
+
throw new ConfigurationError("API key and pins mode differ");
|
|
45
|
+
if (options.apiBase !== undefined &&
|
|
46
|
+
normalizeOrigin(options.apiBase, !this.livemode) !== this.apiBase)
|
|
47
|
+
throw new ConfigurationError("API origin must match pins");
|
|
48
|
+
if (options.fetch !== undefined && typeof options.fetch !== "function")
|
|
49
|
+
throw new ConfigurationError("Invalid fetch transport");
|
|
50
|
+
this.#transport = new Transport({ ...options, apiBase: this.apiBase });
|
|
51
|
+
}
|
|
52
|
+
static fromEnv(env, options = {}) {
|
|
53
|
+
requireServer();
|
|
54
|
+
const values = env ?? serverEnv();
|
|
55
|
+
const apiKey = values["PHALA_PAY_API_KEY"];
|
|
56
|
+
const pins = values["PHALA_PAY_PINS"];
|
|
57
|
+
if (!apiKey || !pins)
|
|
58
|
+
throw new ConfigurationError("PHALA_PAY_API_KEY and PHALA_PAY_PINS are required");
|
|
59
|
+
return new PhalaPay({
|
|
60
|
+
apiKey,
|
|
61
|
+
pins,
|
|
62
|
+
...(options.apiBase === undefined ? {} : { apiBase: options.apiBase }),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
close() {
|
|
66
|
+
return this.#transport.close();
|
|
67
|
+
}
|
|
68
|
+
checkoutParams(quote) {
|
|
69
|
+
if (this.#quotes.get(quote) !== quote.client_secret ||
|
|
70
|
+
!this.#quotes.has(quote) ||
|
|
71
|
+
quote.status !== "open" ||
|
|
72
|
+
typeof quote.client_secret !== "string" ||
|
|
73
|
+
!quote.client_secret.startsWith(`${quote.id}_secret_`) ||
|
|
74
|
+
quote.expires_at <= Date.now() / 1000)
|
|
75
|
+
throw new ResponseValidationError("Quote cannot be used for checkout");
|
|
76
|
+
this.#verify(quote);
|
|
77
|
+
return {
|
|
78
|
+
clientSecret: quote.client_secret,
|
|
79
|
+
expectedAddress: verifyQuoteAddress(this.pins, quote),
|
|
80
|
+
apiBase: this.apiBase,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async #execute(operation, method, path, params, options) {
|
|
84
|
+
const contract = contracts[operation];
|
|
85
|
+
if (!contract)
|
|
86
|
+
throw new ConfigurationError("Unknown API operation");
|
|
87
|
+
if (contract.body && !valid(params, contract.body))
|
|
88
|
+
throw new ConfigurationError("Invalid request parameters");
|
|
89
|
+
const result = await this.#transport.request(method, path, params, options, contract.response);
|
|
90
|
+
this.#verify(result);
|
|
91
|
+
if (operation === "create_quote" &&
|
|
92
|
+
isRecord(result) &&
|
|
93
|
+
typeof result["client_secret"] === "string")
|
|
94
|
+
this.#quotes.set(result, result["client_secret"]);
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
#verify(value) {
|
|
98
|
+
if (Array.isArray(value)) {
|
|
99
|
+
value.forEach((item) => this.#verify(item));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (!isRecord(value))
|
|
103
|
+
return;
|
|
104
|
+
if (Object.hasOwn(value, "account") &&
|
|
105
|
+
typeof value["account"] === "string" &&
|
|
106
|
+
value["account"] !== this.pins.account)
|
|
107
|
+
throw new ResponseValidationError("Response account differs from pins");
|
|
108
|
+
if (Object.hasOwn(value, "livemode") && value["livemode"] !== this.livemode)
|
|
109
|
+
throw new ResponseValidationError("Response mode differs from pins");
|
|
110
|
+
if (value["object"] === "account" && value["id"] !== this.pins.account)
|
|
111
|
+
throw new ResponseValidationError("Response account differs from pins");
|
|
112
|
+
if (value["object"] === "quote" && value["status"] === "open") {
|
|
113
|
+
if (!valid(value, schemas["Quote"] ?? {}))
|
|
114
|
+
throw new ResponseValidationError();
|
|
115
|
+
const quote = value;
|
|
116
|
+
if (!this.pins.treasuries[String(quote.chain_id)])
|
|
117
|
+
throw new AddressMismatchError("Missing pinned chain");
|
|
118
|
+
verifyQuoteAddress(this.pins, quote);
|
|
119
|
+
}
|
|
120
|
+
if (value["object"] === "deposit_address" && value["status"] === "active") {
|
|
121
|
+
if (!valid(value, schemas["DepositAddress"] ?? {}))
|
|
122
|
+
throw new ResponseValidationError();
|
|
123
|
+
const address = value;
|
|
124
|
+
for (const network of address.networks)
|
|
125
|
+
if (!this.pins.treasuries[String(network.chain_id)])
|
|
126
|
+
throw new AddressMismatchError("Missing pinned chain");
|
|
127
|
+
verifyDepositAddress(this.pins, address);
|
|
128
|
+
if (typeof address.address === "string" &&
|
|
129
|
+
address.networks.some((network) => network.address.toLowerCase() !== address.address?.toLowerCase()))
|
|
130
|
+
throw new AddressMismatchError("Deposit address differs from its verified networks");
|
|
131
|
+
}
|
|
132
|
+
// Only resource-bearing fields; metadata and unknown additional fields are opaque merchant data.
|
|
133
|
+
for (const key of ["data", "deposit", "quote", "deposit_address", "object"]) {
|
|
134
|
+
if (isRecord(value[key]) || Array.isArray(value[key]))
|
|
135
|
+
this.#verify(value[key]);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async #constructEvent(body, headers, options = {}) {
|
|
139
|
+
if (options.tolerance !== undefined &&
|
|
140
|
+
(!Number.isFinite(options.tolerance) || options.tolerance < 0))
|
|
141
|
+
throw new ConfigurationError("Invalid webhook tolerance");
|
|
142
|
+
try {
|
|
143
|
+
const verified = await constructEvent(body, headers, this.pins.webhook_keys.map((key) => key.public_key), {
|
|
144
|
+
...(options.tolerance === undefined ? {} : { tolerance: options.tolerance }),
|
|
145
|
+
expectedAccount: this.pins.account,
|
|
146
|
+
expectedLivemode: this.livemode,
|
|
147
|
+
});
|
|
148
|
+
// Legacy low-level verification normalizes previous_attributes; bound events preserve the wire value.
|
|
149
|
+
const raw = parseJson(typeof body === "string" ? body : new TextDecoder("utf-8", { fatal: true }).decode(body));
|
|
150
|
+
const schema = schemas["EventObjectResponse"] ?? {};
|
|
151
|
+
if (!isRecord(raw) ||
|
|
152
|
+
!valid(raw, {
|
|
153
|
+
...schema,
|
|
154
|
+
required: schema.required?.filter((field) => field !== "pending_webhooks") ?? [],
|
|
155
|
+
}))
|
|
156
|
+
throw new SignatureVerificationError("Invalid webhook envelope");
|
|
157
|
+
const event = { ...verified, data: raw["data"] };
|
|
158
|
+
const depositTypes = [
|
|
159
|
+
"deposit.credited",
|
|
160
|
+
"deposit.rejected",
|
|
161
|
+
"deposit.refunded",
|
|
162
|
+
"deposit.reversed",
|
|
163
|
+
];
|
|
164
|
+
if (depositTypes.includes(event.type)) {
|
|
165
|
+
if (event.data.object["object"] !== "deposit" ||
|
|
166
|
+
!valid(event.data.object, schemas["Deposit"] ?? {}))
|
|
167
|
+
throw new SignatureVerificationError("Invalid webhook deposit");
|
|
168
|
+
this.#verify(event.data.object);
|
|
169
|
+
return { ...event, deposit: event.data.object };
|
|
170
|
+
}
|
|
171
|
+
if (["quote.canceled", "quote.expired"].includes(event.type)) {
|
|
172
|
+
if (!valid(event.data.object, schemas["Quote"] ?? {}))
|
|
173
|
+
throw new SignatureVerificationError("Invalid webhook quote");
|
|
174
|
+
this.#verify(event.data.object);
|
|
175
|
+
}
|
|
176
|
+
return event;
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
throw new SignatureVerificationError("Webhook verification failed");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,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7D,CAAC;YACD,IAAI,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7D,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;oBACnD,MAAM,IAAI,0BAA0B,CAAC,uBAAuB,CAAC,CAAC;gBAChE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,0BAA0B,CAAC,6BAA6B,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Errors contain no request bodies, credentials, or raw transport causes. */
|
|
2
|
+
export declare class PhalaPayError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class ConfigurationError extends PhalaPayError {
|
|
6
|
+
}
|
|
7
|
+
export declare class ResponseValidationError extends PhalaPayError {
|
|
8
|
+
readonly statusCode: number | null;
|
|
9
|
+
readonly requestId: string | null;
|
|
10
|
+
constructor(message?: string, statusCode?: number | null, requestId?: string | null);
|
|
11
|
+
}
|
|
12
|
+
export declare class AddressMismatchError extends ResponseValidationError {
|
|
13
|
+
}
|
|
14
|
+
export declare class AttestationError extends PhalaPayError {
|
|
15
|
+
}
|
|
16
|
+
export declare class SignatureVerificationError extends PhalaPayError {
|
|
17
|
+
}
|
|
18
|
+
export { SignatureVerificationError as WebhookSignatureError };
|
|
19
|
+
export declare class LedgerSnapshotError extends PhalaPayError {
|
|
20
|
+
}
|
|
21
|
+
export declare class TransportError extends PhalaPayError {
|
|
22
|
+
readonly code: "network" | "timeout" | "cancelled";
|
|
23
|
+
constructor(code: "network" | "timeout" | "cancelled");
|
|
24
|
+
}
|
|
25
|
+
export declare class ApiError extends PhalaPayError {
|
|
26
|
+
readonly statusCode: number;
|
|
27
|
+
readonly code: string;
|
|
28
|
+
readonly errorType: string | null;
|
|
29
|
+
readonly param: string | null;
|
|
30
|
+
readonly docUrl: string | null;
|
|
31
|
+
readonly requestId: string | null;
|
|
32
|
+
readonly retryAfter: number | null;
|
|
33
|
+
constructor(statusCode: number, code: string, message: string, errorType: string | null, param: string | null, docUrl: string | null, requestId: string | null, retryAfter: number | null);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAQ5B;AACD,qBAAa,kBAAmB,SAAQ,aAAa;CAAG;AACxD,qBAAa,uBAAwB,SAAQ,aAAa;IAGtD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;gBAFjC,OAAO,SAA6B,EAC3B,UAAU,GAAE,MAAM,GAAG,IAAW,EAChC,SAAS,GAAE,MAAM,GAAG,IAAW;CAI3C;AACD,qBAAa,oBAAqB,SAAQ,uBAAuB;CAAG;AACpE,qBAAa,gBAAiB,SAAQ,aAAa;CAAG;AACtD,qBAAa,0BAA2B,SAAQ,aAAa;CAAG;AAChE,OAAO,EAAE,0BAA0B,IAAI,qBAAqB,EAAE,CAAC;AAC/D,qBAAa,mBAAoB,SAAQ,aAAa;CAAG;AACzD,qBAAa,cAAe,SAAQ,aAAa;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW;gBAAzC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW;CAG/D;AACD,qBAAa,QAAS,SAAQ,aAAa;IAEvC,QAAQ,CAAC,UAAU,EAAE,MAAM;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;gBAPzB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,UAAU,EAAE,MAAM,GAAG,IAAI;CAIrC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Errors contain no request bodies, credentials, or raw transport causes. */
|
|
2
|
+
export class PhalaPayError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message
|
|
5
|
+
.replace(/ppay_(?:sk|rk)_(?:test|live)_[A-Za-z0-9]+/g, "[redacted]")
|
|
6
|
+
.replace(/(?:qt|da)_[A-Za-z0-9]+_secret_[A-Za-z0-9]+/g, "[redacted]"));
|
|
7
|
+
this.name = new.target.name;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class ConfigurationError extends PhalaPayError {
|
|
11
|
+
}
|
|
12
|
+
export class ResponseValidationError extends PhalaPayError {
|
|
13
|
+
statusCode;
|
|
14
|
+
requestId;
|
|
15
|
+
constructor(message = "Invalid service response", statusCode = null, requestId = null) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.statusCode = statusCode;
|
|
18
|
+
this.requestId = requestId;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export class AddressMismatchError extends ResponseValidationError {
|
|
22
|
+
}
|
|
23
|
+
export class AttestationError extends PhalaPayError {
|
|
24
|
+
}
|
|
25
|
+
export class SignatureVerificationError extends PhalaPayError {
|
|
26
|
+
}
|
|
27
|
+
export { SignatureVerificationError as WebhookSignatureError };
|
|
28
|
+
export class LedgerSnapshotError extends PhalaPayError {
|
|
29
|
+
}
|
|
30
|
+
export class TransportError extends PhalaPayError {
|
|
31
|
+
code;
|
|
32
|
+
constructor(code) {
|
|
33
|
+
super(`Request ${code}`);
|
|
34
|
+
this.code = code;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class ApiError extends PhalaPayError {
|
|
38
|
+
statusCode;
|
|
39
|
+
code;
|
|
40
|
+
errorType;
|
|
41
|
+
param;
|
|
42
|
+
docUrl;
|
|
43
|
+
requestId;
|
|
44
|
+
retryAfter;
|
|
45
|
+
constructor(statusCode, code, message, errorType, param, docUrl, requestId, retryAfter) {
|
|
46
|
+
super(message);
|
|
47
|
+
this.statusCode = statusCode;
|
|
48
|
+
this.code = code;
|
|
49
|
+
this.errorType = errorType;
|
|
50
|
+
this.param = param;
|
|
51
|
+
this.docUrl = docUrl;
|
|
52
|
+
this.requestId = requestId;
|
|
53
|
+
this.retryAfter = retryAfter;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CACH,OAAO;aACJ,OAAO,CAAC,4CAA4C,EAAE,YAAY,CAAC;aACnE,OAAO,CAAC,6CAA6C,EAAE,YAAY,CAAC,CACxE,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;IAC9B,CAAC;CACF;AACD,MAAM,OAAO,kBAAmB,SAAQ,aAAa;CAA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