@4mica/sdk 0.5.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/.eslintrc.cjs +29 -0
- package/.github/workflows/ci.yml +31 -0
- package/.prettierignore +3 -0
- package/.prettierrc +6 -0
- package/LICENSE +21 -0
- package/README.md +444 -0
- package/dist/abi/core4mica.json +1605 -0
- package/dist/abi/erc20.json +187 -0
- package/dist/auth.d.ts +62 -0
- package/dist/auth.js +255 -0
- package/dist/bls.d.ts +5 -0
- package/dist/bls.js +58 -0
- package/dist/client.d.ts +58 -0
- package/dist/client.js +245 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.js +123 -0
- package/dist/contract.d.ts +33 -0
- package/dist/contract.js +134 -0
- package/dist/errors.d.ts +43 -0
- package/dist/errors.js +62 -0
- package/dist/guarantee.d.ts +3 -0
- package/dist/guarantee.js +66 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +28 -0
- package/dist/models.d.ts +150 -0
- package/dist/models.js +176 -0
- package/dist/rpc.d.ts +37 -0
- package/dist/rpc.js +163 -0
- package/dist/signing.d.ts +106 -0
- package/dist/signing.js +223 -0
- package/dist/src/abi/core4mica.json +1605 -0
- package/dist/src/abi/erc20.json +187 -0
- package/dist/src/bls.d.ts +5 -0
- package/dist/src/bls.js +45 -0
- package/dist/src/client.d.ts +55 -0
- package/dist/src/client.js +214 -0
- package/dist/src/config.d.ts +21 -0
- package/dist/src/config.js +76 -0
- package/dist/src/contract.d.ts +33 -0
- package/dist/src/contract.js +121 -0
- package/dist/src/errors.d.ts +17 -0
- package/dist/src/errors.js +31 -0
- package/dist/src/guarantee.d.ts +3 -0
- package/dist/src/guarantee.js +66 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/index.js +27 -0
- package/dist/src/models.d.ts +119 -0
- package/dist/src/models.js +132 -0
- package/dist/src/rpc.d.ts +30 -0
- package/dist/src/rpc.js +122 -0
- package/dist/src/signing.d.ts +16 -0
- package/dist/src/signing.js +102 -0
- package/dist/src/utils.d.ts +8 -0
- package/dist/src/utils.js +78 -0
- package/dist/src/x402.d.ts +77 -0
- package/dist/src/x402.js +214 -0
- package/dist/tests/config.test.d.ts +1 -0
- package/dist/tests/config.test.js +26 -0
- package/dist/tests/guarantee.test.d.ts +1 -0
- package/dist/tests/guarantee.test.js +26 -0
- package/dist/tests/rpc.test.d.ts +1 -0
- package/dist/tests/rpc.test.js +44 -0
- package/dist/tests/signing.test.d.ts +1 -0
- package/dist/tests/signing.test.js +25 -0
- package/dist/tests/utils.test.d.ts +1 -0
- package/dist/tests/utils.test.js +25 -0
- package/dist/tests/x402.test.d.ts +1 -0
- package/dist/tests/x402.test.js +65 -0
- package/dist/utils.d.ts +8 -0
- package/dist/utils.js +78 -0
- package/dist/x402/index.d.ts +22 -0
- package/dist/x402/index.js +136 -0
- package/dist/x402/models.d.ts +80 -0
- package/dist/x402/models.js +2 -0
- package/dist/x402.d.ts +78 -0
- package/dist/x402.js +231 -0
- package/eslint.config.mjs +22 -0
- package/package.json +31 -0
- package/src/abi/core4mica.json +1605 -0
- package/src/abi/erc20.json +187 -0
- package/src/auth.ts +325 -0
- package/src/bls.ts +76 -0
- package/src/client.ts +347 -0
- package/src/config.ts +149 -0
- package/src/contract.ts +194 -0
- package/src/errors.ts +40 -0
- package/src/guarantee.ts +96 -0
- package/src/index.ts +12 -0
- package/src/models.ts +309 -0
- package/src/rpc.ts +225 -0
- package/src/signing.ts +330 -0
- package/src/utils.ts +75 -0
- package/src/x402/index.ts +192 -0
- package/src/x402/models.ts +94 -0
- package/tests/auth.integration.test.ts +97 -0
- package/tests/auth.test.ts +292 -0
- package/tests/config.test.ts +56 -0
- package/tests/guarantee.test.ts +26 -0
- package/tests/rpc.test.ts +76 -0
- package/tests/signing.test.ts +52 -0
- package/tests/utils.test.ts +35 -0
- package/tests/x402.test.ts +152 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +15 -0
- package/vitest.config.ts +12 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { PaymentGuaranteeRequestClaims, PaymentSignature, SigningScheme } from './models';
|
|
2
|
+
/**
|
|
3
|
+
* ClientEvmSigner - Used by x402 clients to sign payment authorizations
|
|
4
|
+
* This is typically a LocalAccount or wallet that holds private keys
|
|
5
|
+
* and can sign EIP-712 typed data for payment authorizations
|
|
6
|
+
*/
|
|
7
|
+
export type EvmSigner = {
|
|
8
|
+
readonly address: `0x${string}`;
|
|
9
|
+
signTypedData(message: {
|
|
10
|
+
domain: Record<string, unknown>;
|
|
11
|
+
types: Record<string, unknown>;
|
|
12
|
+
primaryType: string;
|
|
13
|
+
message: Record<string, unknown>;
|
|
14
|
+
}): Promise<`0x${string}`>;
|
|
15
|
+
signMessage(message: {
|
|
16
|
+
message: string;
|
|
17
|
+
}): Promise<`0x${string}`>;
|
|
18
|
+
};
|
|
19
|
+
export declare function createLocalSigner(privateKey: string): EvmSigner;
|
|
20
|
+
export declare class CorePublicParameters {
|
|
21
|
+
publicKey: Uint8Array;
|
|
22
|
+
contractAddress: string;
|
|
23
|
+
ethereumHttpRpcUrl: string;
|
|
24
|
+
eip712Name: string;
|
|
25
|
+
eip712Version: string;
|
|
26
|
+
chainId: number;
|
|
27
|
+
constructor(publicKey: Uint8Array, contractAddress: string, ethereumHttpRpcUrl: string, eip712Name: string, eip712Version: string, chainId: number);
|
|
28
|
+
static fromRpc(payload: Record<string, unknown>): CorePublicParameters;
|
|
29
|
+
}
|
|
30
|
+
export declare const GUARANTEE_EIP712_TYPES: {
|
|
31
|
+
readonly EIP712Domain: readonly [{
|
|
32
|
+
readonly name: "name";
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "version";
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "chainId";
|
|
39
|
+
readonly type: "uint256";
|
|
40
|
+
}];
|
|
41
|
+
readonly SolGuaranteeRequestClaimsV1: readonly [{
|
|
42
|
+
readonly name: "user";
|
|
43
|
+
readonly type: "address";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "recipient";
|
|
46
|
+
readonly type: "address";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "tabId";
|
|
49
|
+
readonly type: "uint256";
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "reqId";
|
|
52
|
+
readonly type: "uint256";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "amount";
|
|
55
|
+
readonly type: "uint256";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "asset";
|
|
58
|
+
readonly type: "address";
|
|
59
|
+
}, {
|
|
60
|
+
readonly name: "timestamp";
|
|
61
|
+
readonly type: "uint64";
|
|
62
|
+
}];
|
|
63
|
+
};
|
|
64
|
+
export type GuaranteeTypedData = {
|
|
65
|
+
types: typeof GUARANTEE_EIP712_TYPES;
|
|
66
|
+
primaryType: 'SolGuaranteeRequestClaimsV1';
|
|
67
|
+
domain: {
|
|
68
|
+
name: string;
|
|
69
|
+
version: string;
|
|
70
|
+
chainId: number;
|
|
71
|
+
};
|
|
72
|
+
message: {
|
|
73
|
+
user: string;
|
|
74
|
+
recipient: string;
|
|
75
|
+
tabId: bigint;
|
|
76
|
+
reqId: bigint;
|
|
77
|
+
amount: bigint;
|
|
78
|
+
asset: string;
|
|
79
|
+
timestamp: bigint;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export type GuaranteeTypedDataValidationOptions = {
|
|
83
|
+
expectedChainId?: number;
|
|
84
|
+
expectedSigner?: string;
|
|
85
|
+
expectedRecipient?: string;
|
|
86
|
+
};
|
|
87
|
+
export type GuaranteeSigningContextOptions = {
|
|
88
|
+
signerAddress?: string;
|
|
89
|
+
signerChainId?: number;
|
|
90
|
+
};
|
|
91
|
+
export declare function validateGuaranteeTypedData(payload: {
|
|
92
|
+
domain: Record<string, unknown>;
|
|
93
|
+
types: Record<string, Array<{
|
|
94
|
+
name: string;
|
|
95
|
+
type: string;
|
|
96
|
+
}>>;
|
|
97
|
+
message: Record<string, unknown>;
|
|
98
|
+
}, options?: GuaranteeTypedDataValidationOptions): void;
|
|
99
|
+
export declare function validateGuaranteeSigningContext(params: CorePublicParameters, claims: PaymentGuaranteeRequestClaims, options?: GuaranteeSigningContextOptions): void;
|
|
100
|
+
export declare function buildGuaranteeTypedData(params: CorePublicParameters, claims: PaymentGuaranteeRequestClaims): GuaranteeTypedData;
|
|
101
|
+
export declare function encodeGuaranteeEip191(claims: PaymentGuaranteeRequestClaims): string;
|
|
102
|
+
export declare class PaymentSigner {
|
|
103
|
+
private signer;
|
|
104
|
+
constructor(signer: EvmSigner);
|
|
105
|
+
signRequest(params: CorePublicParameters, claims: PaymentGuaranteeRequestClaims, scheme?: SigningScheme): Promise<PaymentSignature>;
|
|
106
|
+
}
|
package/dist/signing.js
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentSigner = exports.GUARANTEE_EIP712_TYPES = exports.CorePublicParameters = void 0;
|
|
4
|
+
exports.createLocalSigner = createLocalSigner;
|
|
5
|
+
exports.validateGuaranteeTypedData = validateGuaranteeTypedData;
|
|
6
|
+
exports.validateGuaranteeSigningContext = validateGuaranteeSigningContext;
|
|
7
|
+
exports.buildGuaranteeTypedData = buildGuaranteeTypedData;
|
|
8
|
+
exports.encodeGuaranteeEip191 = encodeGuaranteeEip191;
|
|
9
|
+
const ethers_1 = require("ethers");
|
|
10
|
+
const errors_1 = require("./errors");
|
|
11
|
+
const models_1 = require("./models");
|
|
12
|
+
const utils_1 = require("./utils");
|
|
13
|
+
function createLocalSigner(privateKey) {
|
|
14
|
+
privateKey = (0, utils_1.normalizePrivateKey)(privateKey);
|
|
15
|
+
const wallet = new ethers_1.Wallet(privateKey);
|
|
16
|
+
return {
|
|
17
|
+
address: wallet.address,
|
|
18
|
+
signTypedData: async (message) => {
|
|
19
|
+
const signature = await wallet.signTypedData(message.domain, { [message.primaryType]: message.types[message.primaryType] }, message.message);
|
|
20
|
+
return signature;
|
|
21
|
+
},
|
|
22
|
+
signMessage: async ({ message }) => {
|
|
23
|
+
const signature = await wallet.signMessage(message);
|
|
24
|
+
return signature;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
class CorePublicParameters {
|
|
29
|
+
constructor(publicKey, contractAddress, ethereumHttpRpcUrl, eip712Name, eip712Version, chainId) {
|
|
30
|
+
this.publicKey = publicKey;
|
|
31
|
+
this.contractAddress = contractAddress;
|
|
32
|
+
this.ethereumHttpRpcUrl = ethereumHttpRpcUrl;
|
|
33
|
+
this.eip712Name = eip712Name;
|
|
34
|
+
this.eip712Version = eip712Version;
|
|
35
|
+
this.chainId = chainId;
|
|
36
|
+
}
|
|
37
|
+
static fromRpc(payload) {
|
|
38
|
+
const pkRaw = payload.public_key ?? payload.publicKey;
|
|
39
|
+
const pk = typeof pkRaw === 'string'
|
|
40
|
+
? (0, ethers_1.getBytes)(pkRaw)
|
|
41
|
+
: pkRaw instanceof Uint8Array
|
|
42
|
+
? pkRaw
|
|
43
|
+
: Array.isArray(pkRaw)
|
|
44
|
+
? Uint8Array.from(pkRaw)
|
|
45
|
+
: new Uint8Array();
|
|
46
|
+
return new CorePublicParameters(pk, String(payload.contract_address ?? payload.contractAddress ?? ''), String(payload.ethereum_http_rpc_url ?? payload.ethereumHttpRpcUrl ?? ''), (payload.eip712_name ?? payload.eip712Name ?? '4Mica'), (payload.eip712_version ?? payload.eip712Version ?? '1'), Number(payload.chain_id ?? payload.chainId));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.CorePublicParameters = CorePublicParameters;
|
|
50
|
+
exports.GUARANTEE_EIP712_TYPES = {
|
|
51
|
+
EIP712Domain: [
|
|
52
|
+
{ name: 'name', type: 'string' },
|
|
53
|
+
{ name: 'version', type: 'string' },
|
|
54
|
+
{ name: 'chainId', type: 'uint256' },
|
|
55
|
+
],
|
|
56
|
+
SolGuaranteeRequestClaimsV1: [
|
|
57
|
+
{ name: 'user', type: 'address' },
|
|
58
|
+
{ name: 'recipient', type: 'address' },
|
|
59
|
+
{ name: 'tabId', type: 'uint256' },
|
|
60
|
+
{ name: 'reqId', type: 'uint256' },
|
|
61
|
+
{ name: 'amount', type: 'uint256' },
|
|
62
|
+
{ name: 'asset', type: 'address' },
|
|
63
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
const isRecord = (value) => Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
67
|
+
const fieldsMatch = (actual, expected) => {
|
|
68
|
+
if (!Array.isArray(actual) || actual.length !== expected.length)
|
|
69
|
+
return false;
|
|
70
|
+
const norm = (list) => list.map((item) => `${item.name}:${item.type}`).sort();
|
|
71
|
+
const actualSet = new Set(norm(actual));
|
|
72
|
+
return norm(expected).every((key) => actualSet.has(key));
|
|
73
|
+
};
|
|
74
|
+
const parseChainId = (value) => {
|
|
75
|
+
if (typeof value === 'bigint')
|
|
76
|
+
return Number(value);
|
|
77
|
+
if (typeof value === 'number')
|
|
78
|
+
return value;
|
|
79
|
+
if (typeof value === 'string' && value.trim())
|
|
80
|
+
return Number(value);
|
|
81
|
+
return Number.NaN;
|
|
82
|
+
};
|
|
83
|
+
const ensureBigIntish = (value, label) => {
|
|
84
|
+
try {
|
|
85
|
+
BigInt(value);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
throw new utils_1.ValidationError(`${label} must be a numeric value`);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
function validateGuaranteeTypedData(payload, options = {}) {
|
|
92
|
+
if (!isRecord(payload)) {
|
|
93
|
+
throw new utils_1.ValidationError('typed data payload is required');
|
|
94
|
+
}
|
|
95
|
+
if (!isRecord(payload.domain)) {
|
|
96
|
+
throw new utils_1.ValidationError('domain is required');
|
|
97
|
+
}
|
|
98
|
+
if (!isRecord(payload.types)) {
|
|
99
|
+
throw new utils_1.ValidationError('types are required');
|
|
100
|
+
}
|
|
101
|
+
if (!isRecord(payload.message)) {
|
|
102
|
+
throw new utils_1.ValidationError('message is required');
|
|
103
|
+
}
|
|
104
|
+
const types = payload.types;
|
|
105
|
+
if (!fieldsMatch(types.SolGuaranteeRequestClaimsV1, exports.GUARANTEE_EIP712_TYPES.SolGuaranteeRequestClaimsV1)) {
|
|
106
|
+
throw new utils_1.ValidationError('Unexpected struct fields for SolGuaranteeRequestClaimsV1');
|
|
107
|
+
}
|
|
108
|
+
const message = payload.message;
|
|
109
|
+
const requiredFields = ['user', 'recipient', 'tabId', 'reqId', 'amount', 'asset', 'timestamp'];
|
|
110
|
+
if (requiredFields.some((field) => !(field in message))) {
|
|
111
|
+
throw new utils_1.ValidationError('message is missing required SolGuaranteeRequestClaimsV1 fields');
|
|
112
|
+
}
|
|
113
|
+
const user = (0, utils_1.normalizeAddress)(message.user);
|
|
114
|
+
const recipient = (0, utils_1.normalizeAddress)(message.recipient);
|
|
115
|
+
(0, utils_1.normalizeAddress)(message.asset);
|
|
116
|
+
if (options.expectedSigner) {
|
|
117
|
+
if ((0, utils_1.normalizeAddress)(options.expectedSigner) !== user) {
|
|
118
|
+
throw new utils_1.ValidationError('message.user must match signer address');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (options.expectedRecipient) {
|
|
122
|
+
if ((0, utils_1.normalizeAddress)(options.expectedRecipient) !== recipient) {
|
|
123
|
+
throw new utils_1.ValidationError('message.recipient must match expected recipient');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
ensureBigIntish(message.tabId, 'tabId');
|
|
127
|
+
ensureBigIntish(message.reqId, 'reqId');
|
|
128
|
+
ensureBigIntish(message.amount, 'amount');
|
|
129
|
+
ensureBigIntish(message.timestamp, 'timestamp');
|
|
130
|
+
if (options.expectedChainId !== undefined) {
|
|
131
|
+
const domainChainId = parseChainId(payload.domain.chainId);
|
|
132
|
+
if (!Number.isFinite(domainChainId)) {
|
|
133
|
+
throw new utils_1.ValidationError('domain.chainId is required for typed data signatures');
|
|
134
|
+
}
|
|
135
|
+
if (Number(domainChainId) !== Number(options.expectedChainId)) {
|
|
136
|
+
throw new utils_1.ValidationError(`domain.chainId mismatch; expected ${options.expectedChainId}, got ${domainChainId}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function validateGuaranteeSigningContext(params, claims, options = {}) {
|
|
141
|
+
if (options.signerAddress) {
|
|
142
|
+
const signer = (0, utils_1.normalizeAddress)(options.signerAddress);
|
|
143
|
+
const user = (0, utils_1.normalizeAddress)(claims.userAddress);
|
|
144
|
+
if (signer !== user) {
|
|
145
|
+
throw new utils_1.ValidationError(`address mismatch: signer ${options.signerAddress} != claims.user_address ${claims.userAddress}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (options.signerChainId !== undefined) {
|
|
149
|
+
const signerChainId = Number(options.signerChainId);
|
|
150
|
+
if (!Number.isFinite(signerChainId)) {
|
|
151
|
+
throw new utils_1.ValidationError('signer chain id is invalid');
|
|
152
|
+
}
|
|
153
|
+
if (Number(params.chainId) !== signerChainId) {
|
|
154
|
+
throw new utils_1.ValidationError(`chain id mismatch: expected ${params.chainId}, got ${signerChainId}`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function buildGuaranteeTypedData(params, claims) {
|
|
159
|
+
return {
|
|
160
|
+
types: exports.GUARANTEE_EIP712_TYPES,
|
|
161
|
+
primaryType: 'SolGuaranteeRequestClaimsV1',
|
|
162
|
+
domain: {
|
|
163
|
+
name: params.eip712Name,
|
|
164
|
+
version: params.eip712Version,
|
|
165
|
+
chainId: params.chainId,
|
|
166
|
+
},
|
|
167
|
+
message: {
|
|
168
|
+
user: claims.userAddress,
|
|
169
|
+
recipient: claims.recipientAddress,
|
|
170
|
+
tabId: claims.tabId,
|
|
171
|
+
reqId: claims.reqId,
|
|
172
|
+
amount: claims.amount,
|
|
173
|
+
asset: claims.assetAddress,
|
|
174
|
+
timestamp: BigInt(claims.timestamp),
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function encodeGuaranteeEip191(claims) {
|
|
179
|
+
const payload = ethers_1.AbiCoder.defaultAbiCoder().encode(['address', 'address', 'uint256', 'uint256', 'uint256', 'address', 'uint64'], [
|
|
180
|
+
claims.userAddress,
|
|
181
|
+
claims.recipientAddress,
|
|
182
|
+
claims.tabId,
|
|
183
|
+
claims.reqId,
|
|
184
|
+
claims.amount,
|
|
185
|
+
claims.assetAddress,
|
|
186
|
+
claims.timestamp,
|
|
187
|
+
]);
|
|
188
|
+
return payload;
|
|
189
|
+
}
|
|
190
|
+
class PaymentSigner {
|
|
191
|
+
constructor(signer) {
|
|
192
|
+
this.signer = signer;
|
|
193
|
+
}
|
|
194
|
+
async signRequest(params, claims, scheme = models_1.SigningScheme.EIP712) {
|
|
195
|
+
try {
|
|
196
|
+
validateGuaranteeSigningContext(params, claims, { signerAddress: this.signer.address });
|
|
197
|
+
if (scheme === models_1.SigningScheme.EIP712) {
|
|
198
|
+
const typed = buildGuaranteeTypedData(params, claims);
|
|
199
|
+
const signature = await this.signer.signTypedData({
|
|
200
|
+
domain: typed.domain,
|
|
201
|
+
types: { SolGuaranteeRequestClaimsV1: typed.types.SolGuaranteeRequestClaimsV1 },
|
|
202
|
+
primaryType: typed.primaryType,
|
|
203
|
+
message: typed.message,
|
|
204
|
+
});
|
|
205
|
+
return { signature, scheme };
|
|
206
|
+
}
|
|
207
|
+
if (scheme === models_1.SigningScheme.EIP191) {
|
|
208
|
+
const message = encodeGuaranteeEip191(claims);
|
|
209
|
+
const signature = await this.signer.signMessage({ message });
|
|
210
|
+
return { signature, scheme };
|
|
211
|
+
}
|
|
212
|
+
throw new errors_1.SigningError(`unsupported signing scheme: ${scheme}`);
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
if (err instanceof utils_1.ValidationError) {
|
|
216
|
+
throw new errors_1.SigningError(err.message);
|
|
217
|
+
}
|
|
218
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
219
|
+
throw new errors_1.SigningError(message);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
exports.PaymentSigner = PaymentSigner;
|