@usesigil/kit 0.5.0 → 0.7.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/dist/agent-errors.d.ts +18 -0
- package/dist/agent-errors.d.ts.map +1 -1
- package/dist/agent-errors.js +18 -0
- package/dist/agent-errors.js.map +1 -1
- package/dist/alt-loader.d.ts.map +1 -1
- package/dist/alt-loader.js +4 -2
- package/dist/alt-loader.js.map +1 -1
- package/dist/composer.d.ts.map +1 -1
- package/dist/composer.js +4 -2
- package/dist/composer.js.map +1 -1
- package/dist/core/errors.d.ts +37 -5
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +25 -4
- package/dist/core/errors.js.map +1 -1
- package/dist/create-vault.d.ts +5 -4
- package/dist/create-vault.d.ts.map +1 -1
- package/dist/create-vault.js +11 -4
- package/dist/create-vault.js.map +1 -1
- package/dist/custody-adapter.d.ts.map +1 -1
- package/dist/custody-adapter.js +4 -2
- package/dist/custody-adapter.js.map +1 -1
- package/dist/dashboard/errors.d.ts.map +1 -1
- package/dist/dashboard/errors.js +78 -1
- package/dist/dashboard/errors.js.map +1 -1
- package/dist/dashboard/index.d.ts +4 -3
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +6 -4
- package/dist/dashboard/index.js.map +1 -1
- package/dist/dashboard/mutations.d.ts +4 -3
- package/dist/dashboard/mutations.d.ts.map +1 -1
- package/dist/dashboard/mutations.js.map +1 -1
- package/dist/errors/base.d.ts +47 -0
- package/dist/errors/base.d.ts.map +1 -0
- package/dist/errors/base.js +85 -0
- package/dist/errors/base.js.map +1 -0
- package/dist/errors/codes.d.ts +71 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/codes.js +68 -0
- package/dist/errors/codes.js.map +1 -0
- package/dist/errors/compose.d.ts +14 -0
- package/dist/errors/compose.d.ts.map +1 -0
- package/dist/errors/compose.js +13 -0
- package/dist/errors/compose.js.map +1 -0
- package/dist/errors/context.d.ts +213 -0
- package/dist/errors/context.d.ts.map +1 -0
- package/dist/errors/context.js +11 -0
- package/dist/errors/context.js.map +1 -0
- package/dist/errors/index.d.ts +22 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +34 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/rpc.d.ts +16 -0
- package/dist/errors/rpc.d.ts.map +1 -0
- package/dist/errors/rpc.js +15 -0
- package/dist/errors/rpc.js.map +1 -0
- package/dist/errors/sdk.d.ts +31 -0
- package/dist/errors/sdk.d.ts.map +1 -0
- package/dist/errors/sdk.js +30 -0
- package/dist/errors/sdk.js.map +1 -0
- package/dist/errors/shield.d.ts +16 -0
- package/dist/errors/shield.d.ts.map +1 -0
- package/dist/errors/shield.js +15 -0
- package/dist/errors/shield.js.map +1 -0
- package/dist/errors/tee.d.ts +18 -0
- package/dist/errors/tee.d.ts.map +1 -0
- package/dist/errors/tee.js +17 -0
- package/dist/errors/tee.js.map +1 -0
- package/dist/errors/walk.d.ts +3 -0
- package/dist/errors/walk.d.ts.map +1 -0
- package/dist/errors/walk.js +71 -0
- package/dist/errors/walk.js.map +1 -0
- package/dist/errors/x402.d.ts +20 -0
- package/dist/errors/x402.d.ts.map +1 -0
- package/dist/errors/x402.js +19 -0
- package/dist/errors/x402.js.map +1 -0
- package/dist/index.d.ts +25 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/inscribe.d.ts.map +1 -1
- package/dist/inscribe.js +5 -3
- package/dist/inscribe.js.map +1 -1
- package/dist/integrations/compose-errors.d.ts +11 -3
- package/dist/integrations/compose-errors.d.ts.map +1 -1
- package/dist/integrations/compose-errors.js +20 -4
- package/dist/integrations/compose-errors.js.map +1 -1
- package/dist/owner-transaction.d.ts.map +1 -1
- package/dist/owner-transaction.js +6 -3
- package/dist/owner-transaction.js.map +1 -1
- package/dist/presets.d.ts +19 -18
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +9 -8
- package/dist/presets.js.map +1 -1
- package/dist/rpc-helpers.d.ts.map +1 -1
- package/dist/rpc-helpers.js +7 -4
- package/dist/rpc-helpers.js.map +1 -1
- package/dist/seal.d.ts.map +1 -1
- package/dist/seal.js +63 -35
- package/dist/seal.js.map +1 -1
- package/dist/shield.d.ts +2 -11
- package/dist/shield.d.ts.map +1 -1
- package/dist/shield.js +34 -16
- package/dist/shield.js.map +1 -1
- package/dist/state-resolver.d.ts +6 -2
- package/dist/state-resolver.d.ts.map +1 -1
- package/dist/state-resolver.js +6 -4
- package/dist/state-resolver.js.map +1 -1
- package/dist/tee/wallet-types.d.ts +10 -2
- package/dist/tee/wallet-types.d.ts.map +1 -1
- package/dist/tee/wallet-types.js +26 -5
- package/dist/tee/wallet-types.js.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +3 -1
- package/dist/tokens.js.map +1 -1
- package/dist/transaction-executor.d.ts.map +1 -1
- package/dist/transaction-executor.js +4 -2
- package/dist/transaction-executor.js.map +1 -1
- package/dist/types.d.ts +46 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +31 -4
- package/dist/types.js.map +1 -1
- package/dist/x402/errors.d.ts +31 -16
- package/dist/x402/errors.d.ts.map +1 -1
- package/dist/x402/errors.js +44 -23
- package/dist/x402/errors.js.map +1 -1
- package/dist/x402/transfer-builder.d.ts.map +1 -1
- package/dist/x402/transfer-builder.js +2 -1
- package/dist/x402/transfer-builder.js.map +1 -1
- package/package.json +2 -2
package/dist/types.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* All types use Kit's `Address` (branded string) instead of web3.js `PublicKey`,
|
|
5
5
|
* and `bigint` instead of `BN`.
|
|
6
6
|
*/
|
|
7
|
+
import { SigilSdkDomainError } from "./errors/sdk.js";
|
|
8
|
+
import { SIGIL_ERROR__SDK__INVALID_NETWORK, SIGIL_ERROR__SDK__INVALID_ACTION_TYPE, } from "./errors/codes.js";
|
|
7
9
|
// Re-export the program address from generated code
|
|
8
10
|
export { SIGIL_PROGRAM_ADDRESS } from "./generated/programs/sigil.js";
|
|
9
11
|
// ─── Fee Constants ────────────────────────────────────────────────────────────
|
|
@@ -11,6 +13,21 @@ export const FEE_RATE_DENOMINATOR = 1_000_000;
|
|
|
11
13
|
export const PROTOCOL_FEE_RATE = 200; // 2 BPS
|
|
12
14
|
export const MAX_DEVELOPER_FEE_RATE = 500; // 5 BPS
|
|
13
15
|
export const PROTOCOL_TREASURY = "ASHie1dFTnDSnrHMPGmniJhMgfJVGPm3rAaEPnrtWDiT";
|
|
16
|
+
/** Construct a branded USD base-units amount. Zero runtime cost. */
|
|
17
|
+
export function usd(amount) {
|
|
18
|
+
return amount;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Construct a branded capability tier. Validates range (0–2) at runtime.
|
|
22
|
+
* @throws RangeError if tier is not 0n, 1n, or 2n.
|
|
23
|
+
*/
|
|
24
|
+
export function capability(tier) {
|
|
25
|
+
return tier;
|
|
26
|
+
}
|
|
27
|
+
/** Construct a branded slot number. Zero runtime cost. */
|
|
28
|
+
export function slot(s) {
|
|
29
|
+
return s;
|
|
30
|
+
}
|
|
14
31
|
// ─── USD Constants ────────────────────────────────────────────────────────────
|
|
15
32
|
export const USD_DECIMALS = 6;
|
|
16
33
|
/** Scaling factor for stablecoin-to-USD conversion.
|
|
@@ -23,11 +40,14 @@ export const MAX_AGENTS_PER_VAULT = 10;
|
|
|
23
40
|
/** Mirror of on-chain MAX_ALLOWED_PROTOCOLS — bounds PolicyConfig.protocols vec. */
|
|
24
41
|
export const MAX_ALLOWED_PROTOCOLS = 10;
|
|
25
42
|
/**
|
|
26
|
-
* Capability
|
|
43
|
+
* Capability tier: Operator (2) — "can spend" + "can hold positions".
|
|
27
44
|
* Replaces the legacy 21-bit ActionType permission bitmask.
|
|
28
45
|
* On-chain v6 uses a 2-bit capability model instead of per-action permissions.
|
|
46
|
+
*
|
|
47
|
+
* PR 2.B: now typed as `CapabilityTier` — NOT assignable to `UsdBaseUnits`
|
|
48
|
+
* or plain `bigint` without the `capability()` constructor.
|
|
29
49
|
*/
|
|
30
|
-
export const FULL_CAPABILITY = 2n;
|
|
50
|
+
export const FULL_CAPABILITY = capability(2n);
|
|
31
51
|
/** @deprecated Use FULL_CAPABILITY instead. Kept for backward compatibility. */
|
|
32
52
|
export const FULL_PERMISSIONS = FULL_CAPABILITY;
|
|
33
53
|
export const SWAP_ONLY = 1n << 0n;
|
|
@@ -87,7 +107,12 @@ export const RECOGNIZED_DEFI_PROGRAMS = new Set([
|
|
|
87
107
|
export function validateNetwork(network) {
|
|
88
108
|
const normalized = network === "mainnet" ? "mainnet-beta" : network;
|
|
89
109
|
if (normalized !== "devnet" && normalized !== "mainnet-beta") {
|
|
90
|
-
throw new
|
|
110
|
+
throw new SigilSdkDomainError(SIGIL_ERROR__SDK__INVALID_NETWORK, `Invalid network: "${network}". Must be "devnet", "mainnet", or "mainnet-beta".`, {
|
|
111
|
+
context: {
|
|
112
|
+
received: network,
|
|
113
|
+
valid: ["devnet", "mainnet", "mainnet-beta"],
|
|
114
|
+
},
|
|
115
|
+
});
|
|
91
116
|
}
|
|
92
117
|
}
|
|
93
118
|
/** Convert short-form network to canonical Network type.
|
|
@@ -164,7 +189,9 @@ export function stringsToPermissions(strings) {
|
|
|
164
189
|
for (const s of strings) {
|
|
165
190
|
if (!Object.prototype.hasOwnProperty.call(ACTION_PERMISSION_MAP, s)) {
|
|
166
191
|
const valid = Object.keys(ACTION_PERMISSION_MAP).join(", ");
|
|
167
|
-
throw new
|
|
192
|
+
throw new SigilSdkDomainError(SIGIL_ERROR__SDK__INVALID_ACTION_TYPE, `Unknown action type: "${s}". Valid types: ${valid}`, {
|
|
193
|
+
context: { received: s, valid: Object.keys(ACTION_PERMISSION_MAP) },
|
|
194
|
+
});
|
|
168
195
|
}
|
|
169
196
|
const bit = ACTION_PERMISSION_MAP[s];
|
|
170
197
|
result |= bit;
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,oDAAoD;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AActE,iFAAiF;AAEjF,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC,CAAC,QAAQ;AAC9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC,CAAC,QAAQ;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAC5B,8CAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACL,iCAAiC,EACjC,qCAAqC,GACtC,MAAM,mBAAmB,CAAC;AAE3B,oDAAoD;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AActE,iFAAiF;AAEjF,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC,CAAC,QAAQ;AAC9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC,CAAC,QAAQ;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAC5B,8CAAyD,CAAC;AA2C5D,oEAAoE;AACpE,MAAM,UAAU,GAAG,CAAC,MAAc;IAChC,OAAO,MAAsB,CAAC;AAChC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,IAAkB;IAC3C,OAAO,IAAsB,CAAC;AAChC,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,IAAI,CAAC,CAAS;IAC5B,OAAO,CAAS,CAAC;AACnB,CAAC;AAED,iFAAiF;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AChB,CAAC"}
|
package/dist/x402/errors.d.ts
CHANGED
|
@@ -2,33 +2,48 @@
|
|
|
2
2
|
* x402 Error Classes — Kit-native
|
|
3
3
|
*
|
|
4
4
|
* Five distinct error types for x402 payment handling.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* PR 2.A: Re-homed under SigilX402Error per UD1 (Architect's recommendation —
|
|
7
|
+
* single canonical .code). The historical numeric codes (7024-7028) are
|
|
8
|
+
* preserved as `.legacyNumericCode` getters for one-minor migration ramp;
|
|
9
|
+
* deletion targeted at v1.0. New typed discrimination uses the SigilErrorCode
|
|
10
|
+
* string-literal `.code` field on the SigilError base.
|
|
11
|
+
*
|
|
12
|
+
* The `instanceof X402ParseError` re-throw guard at src/x402/codec.ts:87
|
|
13
|
+
* continues to work because class identity is unchanged.
|
|
6
14
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
import { SigilX402Error } from "../errors/x402.js";
|
|
16
|
+
import { SIGIL_ERROR__X402__HEADER_MALFORMED, SIGIL_ERROR__X402__PAYMENT_FAILED, SIGIL_ERROR__X402__UNSUPPORTED, SIGIL_ERROR__X402__DESTINATION_BLOCKED, SIGIL_ERROR__X402__REPLAY } from "../errors/codes.js";
|
|
17
|
+
/** Malformed PAYMENT-REQUIRED header. Legacy numeric code: 7024. */
|
|
18
|
+
export declare class X402ParseError extends SigilX402Error<typeof SIGIL_ERROR__X402__HEADER_MALFORMED> {
|
|
19
|
+
/** @deprecated Use `err.code === SIGIL_ERROR__X402__HEADER_MALFORMED`. Removed at v1.0. */
|
|
20
|
+
readonly legacyNumericCode: 7024;
|
|
10
21
|
constructor(message: string);
|
|
11
22
|
}
|
|
12
|
-
/** General x402 payment failure
|
|
13
|
-
export declare class X402PaymentError extends
|
|
14
|
-
|
|
23
|
+
/** General x402 payment failure. Legacy numeric code: 7025. */
|
|
24
|
+
export declare class X402PaymentError extends SigilX402Error<typeof SIGIL_ERROR__X402__PAYMENT_FAILED> {
|
|
25
|
+
/** @deprecated Use `err.code === SIGIL_ERROR__X402__PAYMENT_FAILED`. Removed at v1.0. */
|
|
26
|
+
readonly legacyNumericCode: 7025;
|
|
15
27
|
constructor(message: string);
|
|
16
28
|
}
|
|
17
|
-
/** No compatible Solana payment option
|
|
18
|
-
export declare class X402UnsupportedError extends
|
|
19
|
-
|
|
29
|
+
/** No compatible Solana payment option. Legacy numeric code: 7026. */
|
|
30
|
+
export declare class X402UnsupportedError extends SigilX402Error<typeof SIGIL_ERROR__X402__UNSUPPORTED> {
|
|
31
|
+
/** @deprecated Use `err.code === SIGIL_ERROR__X402__UNSUPPORTED`. Removed at v1.0. */
|
|
32
|
+
readonly legacyNumericCode: 7026;
|
|
20
33
|
constructor(message: string);
|
|
21
34
|
}
|
|
22
|
-
/** payTo address not in destination allowlist
|
|
23
|
-
export declare class X402DestinationBlockedError extends
|
|
35
|
+
/** payTo address not in destination allowlist. Legacy numeric code: 7027. */
|
|
36
|
+
export declare class X402DestinationBlockedError extends SigilX402Error<typeof SIGIL_ERROR__X402__DESTINATION_BLOCKED> {
|
|
24
37
|
readonly payTo: string;
|
|
25
|
-
|
|
38
|
+
/** @deprecated Use `err.code === SIGIL_ERROR__X402__DESTINATION_BLOCKED`. Removed at v1.0. */
|
|
39
|
+
readonly legacyNumericCode: 7027;
|
|
26
40
|
constructor(payTo: string, message?: string);
|
|
27
41
|
}
|
|
28
|
-
/** Duplicate payment detected within replay window
|
|
29
|
-
export declare class X402ReplayError extends
|
|
42
|
+
/** Duplicate payment detected within replay window. Legacy numeric code: 7028. */
|
|
43
|
+
export declare class X402ReplayError extends SigilX402Error<typeof SIGIL_ERROR__X402__REPLAY> {
|
|
30
44
|
readonly nonceKey: string;
|
|
31
|
-
|
|
45
|
+
/** @deprecated Use `err.code === SIGIL_ERROR__X402__REPLAY`. Removed at v1.0. */
|
|
46
|
+
readonly legacyNumericCode: 7028;
|
|
32
47
|
constructor(nonceKey: string, message?: string);
|
|
33
48
|
}
|
|
34
49
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/x402/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/x402/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,mCAAmC,EACnC,iCAAiC,EACjC,8BAA8B,EAC9B,sCAAsC,EACtC,yBAAyB,EAC1B,MAAM,oBAAoB,CAAC;AAE5B,oEAAoE;AACpE,qBAAa,cAAe,SAAQ,cAAc,CAChD,OAAO,mCAAmC,CAC3C;IACC,2FAA2F;IAC3F,QAAQ,CAAC,iBAAiB,EAAG,IAAI,CAAU;gBAC/B,OAAO,EAAE,MAAM;CAM5B;AAED,+DAA+D;AAC/D,qBAAa,gBAAiB,SAAQ,cAAc,CAClD,OAAO,iCAAiC,CACzC;IACC,yFAAyF;IACzF,QAAQ,CAAC,iBAAiB,EAAG,IAAI,CAAU;gBAC/B,OAAO,EAAE,MAAM;CAM5B;AAED,sEAAsE;AACtE,qBAAa,oBAAqB,SAAQ,cAAc,CACtD,OAAO,8BAA8B,CACtC;IACC,sFAAsF;IACtF,QAAQ,CAAC,iBAAiB,EAAG,IAAI,CAAU;gBAC/B,OAAO,EAAE,MAAM;CAM5B;AAED,6EAA6E;AAC7E,qBAAa,2BAA4B,SAAQ,cAAc,CAC7D,OAAO,sCAAsC,CAC9C;aAImB,KAAK,EAAE,MAAM;IAH/B,8FAA8F;IAC9F,QAAQ,CAAC,iBAAiB,EAAG,IAAI,CAAU;gBAEzB,KAAK,EAAE,MAAM,EAC7B,OAAO,CAAC,EAAE,MAAM;CAUnB;AAED,kFAAkF;AAClF,qBAAa,eAAgB,SAAQ,cAAc,CACjD,OAAO,yBAAyB,CACjC;aAImB,QAAQ,EAAE,MAAM;IAHlC,iFAAiF;IACjF,QAAQ,CAAC,iBAAiB,EAAG,IAAI,CAAU;gBAEzB,QAAQ,EAAE,MAAM,EAChC,OAAO,CAAC,EAAE,MAAM;CAUnB"}
|
package/dist/x402/errors.js
CHANGED
|
@@ -2,50 +2,71 @@
|
|
|
2
2
|
* x402 Error Classes — Kit-native
|
|
3
3
|
*
|
|
4
4
|
* Five distinct error types for x402 payment handling.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* PR 2.A: Re-homed under SigilX402Error per UD1 (Architect's recommendation —
|
|
7
|
+
* single canonical .code). The historical numeric codes (7024-7028) are
|
|
8
|
+
* preserved as `.legacyNumericCode` getters for one-minor migration ramp;
|
|
9
|
+
* deletion targeted at v1.0. New typed discrimination uses the SigilErrorCode
|
|
10
|
+
* string-literal `.code` field on the SigilError base.
|
|
11
|
+
*
|
|
12
|
+
* The `instanceof X402ParseError` re-throw guard at src/x402/codec.ts:87
|
|
13
|
+
* continues to work because class identity is unchanged.
|
|
6
14
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
import { SigilX402Error } from "../errors/x402.js";
|
|
16
|
+
import { SIGIL_ERROR__X402__HEADER_MALFORMED, SIGIL_ERROR__X402__PAYMENT_FAILED, SIGIL_ERROR__X402__UNSUPPORTED, SIGIL_ERROR__X402__DESTINATION_BLOCKED, SIGIL_ERROR__X402__REPLAY, } from "../errors/codes.js";
|
|
17
|
+
/** Malformed PAYMENT-REQUIRED header. Legacy numeric code: 7024. */
|
|
18
|
+
export class X402ParseError extends SigilX402Error {
|
|
19
|
+
/** @deprecated Use `err.code === SIGIL_ERROR__X402__HEADER_MALFORMED`. Removed at v1.0. */
|
|
20
|
+
legacyNumericCode = 7024;
|
|
10
21
|
constructor(message) {
|
|
11
|
-
super(`x402 parse error: ${message}
|
|
22
|
+
super(SIGIL_ERROR__X402__HEADER_MALFORMED, `x402 parse error: ${message}`, {
|
|
23
|
+
context: { legacyNumericCode: 7024 },
|
|
24
|
+
});
|
|
12
25
|
this.name = "X402ParseError";
|
|
13
26
|
}
|
|
14
27
|
}
|
|
15
|
-
/** General x402 payment failure
|
|
16
|
-
export class X402PaymentError extends
|
|
17
|
-
code
|
|
28
|
+
/** General x402 payment failure. Legacy numeric code: 7025. */
|
|
29
|
+
export class X402PaymentError extends SigilX402Error {
|
|
30
|
+
/** @deprecated Use `err.code === SIGIL_ERROR__X402__PAYMENT_FAILED`. Removed at v1.0. */
|
|
31
|
+
legacyNumericCode = 7025;
|
|
18
32
|
constructor(message) {
|
|
19
|
-
super(`x402 payment error: ${message}
|
|
33
|
+
super(SIGIL_ERROR__X402__PAYMENT_FAILED, `x402 payment error: ${message}`, {
|
|
34
|
+
context: { legacyNumericCode: 7025 },
|
|
35
|
+
});
|
|
20
36
|
this.name = "X402PaymentError";
|
|
21
37
|
}
|
|
22
38
|
}
|
|
23
|
-
/** No compatible Solana payment option
|
|
24
|
-
export class X402UnsupportedError extends
|
|
25
|
-
code
|
|
39
|
+
/** No compatible Solana payment option. Legacy numeric code: 7026. */
|
|
40
|
+
export class X402UnsupportedError extends SigilX402Error {
|
|
41
|
+
/** @deprecated Use `err.code === SIGIL_ERROR__X402__UNSUPPORTED`. Removed at v1.0. */
|
|
42
|
+
legacyNumericCode = 7026;
|
|
26
43
|
constructor(message) {
|
|
27
|
-
super(`x402 unsupported: ${message}
|
|
44
|
+
super(SIGIL_ERROR__X402__UNSUPPORTED, `x402 unsupported: ${message}`, {
|
|
45
|
+
context: { legacyNumericCode: 7026 },
|
|
46
|
+
});
|
|
28
47
|
this.name = "X402UnsupportedError";
|
|
29
48
|
}
|
|
30
49
|
}
|
|
31
|
-
/** payTo address not in destination allowlist
|
|
32
|
-
export class X402DestinationBlockedError extends
|
|
50
|
+
/** payTo address not in destination allowlist. Legacy numeric code: 7027. */
|
|
51
|
+
export class X402DestinationBlockedError extends SigilX402Error {
|
|
33
52
|
payTo;
|
|
34
|
-
code
|
|
53
|
+
/** @deprecated Use `err.code === SIGIL_ERROR__X402__DESTINATION_BLOCKED`. Removed at v1.0. */
|
|
54
|
+
legacyNumericCode = 7027;
|
|
35
55
|
constructor(payTo, message) {
|
|
36
|
-
super(message ??
|
|
37
|
-
`x402 destination blocked: payTo ${payTo} is not in the allowed destinations list
|
|
56
|
+
super(SIGIL_ERROR__X402__DESTINATION_BLOCKED, message ??
|
|
57
|
+
`x402 destination blocked: payTo ${payTo} is not in the allowed destinations list`, { context: { payTo, legacyNumericCode: 7027 } });
|
|
38
58
|
this.payTo = payTo;
|
|
39
59
|
this.name = "X402DestinationBlockedError";
|
|
40
60
|
}
|
|
41
61
|
}
|
|
42
|
-
/** Duplicate payment detected within replay window
|
|
43
|
-
export class X402ReplayError extends
|
|
62
|
+
/** Duplicate payment detected within replay window. Legacy numeric code: 7028. */
|
|
63
|
+
export class X402ReplayError extends SigilX402Error {
|
|
44
64
|
nonceKey;
|
|
45
|
-
code
|
|
65
|
+
/** @deprecated Use `err.code === SIGIL_ERROR__X402__REPLAY`. Removed at v1.0. */
|
|
66
|
+
legacyNumericCode = 7028;
|
|
46
67
|
constructor(nonceKey, message) {
|
|
47
|
-
super(message ??
|
|
48
|
-
`x402 replay detected: duplicate payment for nonce ${nonceKey}
|
|
68
|
+
super(SIGIL_ERROR__X402__REPLAY, message ??
|
|
69
|
+
`x402 replay detected: duplicate payment for nonce ${nonceKey}`, { context: { nonceKey, legacyNumericCode: 7028 } });
|
|
49
70
|
this.nonceKey = nonceKey;
|
|
50
71
|
this.name = "X402ReplayError";
|
|
51
72
|
}
|
package/dist/x402/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/x402/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/x402/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,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ACL,mCAAmC,KAAK,0CAA0C,EACpF,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,CAChD,CAAC;QARc,UAAK,GAAL,KAAK,CAAQ;QAS7B,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;IAC5C,CAAC;CACF;AAED,kFAAkF;AAClF,MAAM,OAAO,eAAgB,SAAQ,cAEpC;IAImB;IAHlB,iFAAiF;IACxE,iBAAiB,GAAG,IAAa,CAAC;IAC3C,YACkB,QAAgB,EAChC,OAAgB;QAEhB,KAAK,CACH,yBAAyB,EACzB,OAAO;YACL,qDAAqD,QAAQ,EAAE,EACjE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,CACnD,CAAC;QARc,aAAQ,GAAR,QAAQ,CAAQ;QAShC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-builder.d.ts","sourceRoot":"","sources":["../../src/x402/transfer-builder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"transfer-builder.d.ts","sourceRoot":"","sources":["../../src/x402/transfer-builder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAK9D,eAAO,MAAM,gBAAgB,EACsB,OAAO,CAAC;AAC3D,eAAO,MAAM,cAAc,EACyB,OAAO,CAAC;AAO5D;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,OAAO,CAAC,CAalB;AAkBD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,4BAA4B,CAAC,MAAM,EAAE;IACzD,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,WAAW,CAAC,CA0BvB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,WAAW,GAAG,sBAAsB,CAM7E"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* of data + 4 accounts, trivial to encode directly.
|
|
7
7
|
*/
|
|
8
8
|
import { AccountRole, getProgramDerivedAddress } from "@solana/kit";
|
|
9
|
+
import { X402ParseError } from "./errors.js";
|
|
9
10
|
// ─── Constants ──────────────────────────────────────────────────────────────
|
|
10
11
|
export const TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
11
12
|
export const ATA_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
@@ -102,7 +103,7 @@ function base58Decode(str) {
|
|
|
102
103
|
for (const char of str) {
|
|
103
104
|
const value = BASE58_ALPHABET.indexOf(char);
|
|
104
105
|
if (value === -1) {
|
|
105
|
-
throw new
|
|
106
|
+
throw new X402ParseError(`Invalid base58 character: ${char}`);
|
|
106
107
|
}
|
|
107
108
|
let carry = value;
|
|
108
109
|
for (let j = 0; j < bytes.length; j++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-builder.js","sourceRoot":"","sources":["../../src/x402/transfer-builder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
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AE,MAAM;QACxB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC;IAED,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usesigil/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Kaleb Rupe (https://x.com/MightieMags)",
|
|
6
6
|
"homepage": "https://github.com/Sigil-Trade/sigil#readme",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"codama:kamino": "node codama.mjs --protocol=kamino",
|
|
98
98
|
"codama:all": "node codama.mjs --all",
|
|
99
99
|
"pretest": "tsc -p tsconfig.test.json --noEmit",
|
|
100
|
-
"test": "mocha --require tsx 'tests/*.test.ts' 'tests/core/*.test.ts' 'tests/dashboard/*.test.ts' 'tests/experimental/*.test.ts' --timeout 30000",
|
|
100
|
+
"test": "mocha --require tsx 'tests/*.test.ts' 'tests/core/*.test.ts' 'tests/dashboard/*.test.ts' 'tests/errors/*.test.ts' 'tests/experimental/*.test.ts' --timeout 30000",
|
|
101
101
|
"test:devnet": "mocha --require tsx tests/devnet/**/*.test.ts --timeout 300000",
|
|
102
102
|
"test:experimental": "mocha --require tsx tests/experimental/**/*.test.ts --timeout 30000",
|
|
103
103
|
"check:examples": "tsc -p tsconfig.examples.json"
|