@settlemint/dalp-sdk 3.1.18-main.33866438356 → 3.1.18-main.33867412971
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/auth.js +18 -18
- package/dist/bundler.js +7 -9
- package/dist/{chunk-tcm75mnh.js → chunk-396ye0s9.js} +55 -55
- package/dist/{chunk-feq06kty.js → chunk-as5fp17r.js} +6 -6
- package/dist/{chunk-y0d2c7kp.js → chunk-j4sxrfzz.js} +4 -4
- package/dist/{chunk-r0vsftj4.js → chunk-qvtjb3dz.js} +4 -4
- package/dist/{chunk-77rp65xa.js → chunk-v6zadx3z.js} +11 -11
- package/dist/{chunk-h12fatty.js → chunk-xp3fx2yt.js} +12 -12
- package/dist/client/request-compression.d.ts +1 -1
- package/dist/effect.js +13 -14
- package/dist/errors/sdk-error.js +5 -5
- package/dist/index.js +48 -50
- package/dist/react-query.js +9 -10
- package/dist/routes/index.js +1 -1
- package/dist/scalars/index.js +5 -5
- package/dist/sign-webhook-receipt.js +3 -3
- package/dist/verify-webhook.js +5 -5
- package/dist/wait-for-transaction.js +3 -3
- package/package.json +1 -1
- /package/dist/{chunk-fjnq61hj.js → chunk-d327hed9.js} +0 -0
- /package/dist/{chunk-gryttjx0.js → chunk-g0z27jbh.js} +0 -0
- /package/dist/{chunk-f4t1bm86.js → chunk-rb8k4w3q.js} +0 -0
package/dist/auth.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
makeCookieStore
|
|
5
|
-
} from "./chunk-feq06kty.js";
|
|
2
|
+
createDalpSdkConfigurationError2
|
|
3
|
+
} from "./chunk-j4sxrfzz.js";
|
|
6
4
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
5
|
+
secret2,
|
|
6
|
+
unwrapSecret,
|
|
7
|
+
normalizeDalpBaseUrl
|
|
8
|
+
} from "./chunk-xp3fx2yt.js";
|
|
11
9
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
makeCookieStore2,
|
|
11
|
+
createCookieStoreFetch2,
|
|
12
|
+
SDK_USER_AGENT2
|
|
13
|
+
} from "./chunk-as5fp17r.js";
|
|
14
14
|
|
|
15
15
|
// src/auth/live.ts
|
|
16
16
|
import { apiKeyClient } from "@better-auth/api-key/client";
|
|
@@ -113,9 +113,9 @@ function decodeAuthConfig(input) {
|
|
|
113
113
|
const configuredFetch = optionalFetch(raw.fetch);
|
|
114
114
|
return {
|
|
115
115
|
url,
|
|
116
|
-
...apiKey === undefined ? {} : { apiKey:
|
|
117
|
-
...sessionToken === undefined ? {} : { sessionToken:
|
|
118
|
-
...cookie === undefined ? {} : { cookie:
|
|
116
|
+
...apiKey === undefined ? {} : { apiKey: secret2(apiKey) },
|
|
117
|
+
...sessionToken === undefined ? {} : { sessionToken: secret2(sessionToken) },
|
|
118
|
+
...cookie === undefined ? {} : { cookie: secret2(cookie) },
|
|
119
119
|
...cookieStore === undefined ? {} : { cookieStore },
|
|
120
120
|
...organizationId === undefined ? {} : { organizationId },
|
|
121
121
|
...headers === undefined ? {} : { headers },
|
|
@@ -126,7 +126,7 @@ async function decodeDalpAuthClientConfig(input) {
|
|
|
126
126
|
try {
|
|
127
127
|
return decodeAuthConfig(input);
|
|
128
128
|
} catch (error) {
|
|
129
|
-
throw
|
|
129
|
+
throw createDalpSdkConfigurationError2({
|
|
130
130
|
message: "DALP SDK: auth client configuration is invalid.",
|
|
131
131
|
why: "The auth client received a malformed URL, credential, header map, fetch seam, or cookie store.",
|
|
132
132
|
fix: "Pass one credential source, an HTTP(S) URL, and valid fetch and cookie-store seams.",
|
|
@@ -264,7 +264,7 @@ var walletSecretCodesClient = () => ({
|
|
|
264
264
|
// src/auth/live.ts
|
|
265
265
|
var reservedHeaders = new Set(["x-api-key", "authorization", "cookie"]);
|
|
266
266
|
function authHeaders(config) {
|
|
267
|
-
const headers = { "User-Agent":
|
|
267
|
+
const headers = { "User-Agent": SDK_USER_AGENT2 };
|
|
268
268
|
for (const [name, value] of Object.entries(config.headers ?? {})) {
|
|
269
269
|
if (!reservedHeaders.has(name.toLowerCase())) {
|
|
270
270
|
headers[name] = value;
|
|
@@ -287,7 +287,7 @@ function createConfiguredBetterAuthClient(config, cookieStore) {
|
|
|
287
287
|
baseURL: `${normalizeDalpBaseUrl(config.url)}/api/auth`,
|
|
288
288
|
fetchOptions: {
|
|
289
289
|
headers: authHeaders(config),
|
|
290
|
-
customFetchImpl:
|
|
290
|
+
customFetchImpl: createCookieStoreFetch2(cookieStore, config.fetch),
|
|
291
291
|
credentials: "include"
|
|
292
292
|
},
|
|
293
293
|
plugins: [
|
|
@@ -307,13 +307,13 @@ function createConfiguredBetterAuthClient(config, cookieStore) {
|
|
|
307
307
|
}
|
|
308
308
|
async function createDalpAuthClient(input) {
|
|
309
309
|
const config = await decodeDalpAuthClientConfig(input);
|
|
310
|
-
const cookieStore = config.cookieStore ??
|
|
310
|
+
const cookieStore = config.cookieStore ?? makeCookieStore2();
|
|
311
311
|
if (config.cookie !== undefined) {
|
|
312
312
|
cookieStore.setCookieHeader(unwrapSecret(config.cookie));
|
|
313
313
|
}
|
|
314
314
|
const credentialCount = [config.apiKey, config.sessionToken, cookieStore.isEmpty() ? undefined : true].filter(Boolean).length;
|
|
315
315
|
if (credentialCount > 1) {
|
|
316
|
-
throw
|
|
316
|
+
throw createDalpSdkConfigurationError2({
|
|
317
317
|
message: "DALP SDK: configure only one auth credential source.",
|
|
318
318
|
why: "The auth client received multiple credential types.",
|
|
319
319
|
fix: "Use an API key, bearer token, or cookie store, not a combination."
|
package/dist/bundler.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import"./chunk-g0z27jbh.js";
|
|
2
|
+
import"./chunk-j4sxrfzz.js";
|
|
3
|
+
import"./chunk-396ye0s9.js";
|
|
4
|
+
import"./chunk-xp3fx2yt.js";
|
|
1
5
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import"./chunk-f4t1bm86.js";
|
|
5
|
-
import"./chunk-tcm75mnh.js";
|
|
6
|
-
import"./chunk-fjnq61hj.js";
|
|
7
|
-
import"./chunk-gryttjx0.js";
|
|
8
|
-
import"./chunk-h12fatty.js";
|
|
9
|
-
import"./chunk-y0d2c7kp.js";
|
|
6
|
+
createDalpClient2
|
|
7
|
+
} from "./chunk-v6zadx3z.js";
|
|
10
8
|
|
|
11
9
|
// src/bundler.ts
|
|
12
10
|
import { getAddress, hexToBigInt, isHex } from "viem";
|
|
@@ -22,7 +20,7 @@ var requireHex = (value, field) => {
|
|
|
22
20
|
return value;
|
|
23
21
|
};
|
|
24
22
|
function createDalpBundlerClient(config) {
|
|
25
|
-
const client =
|
|
23
|
+
const client = createDalpClient2({
|
|
26
24
|
baseUrl: config.url,
|
|
27
25
|
apiKey: config.apiKey,
|
|
28
26
|
context: { organizationId: config.organizationId },
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
2
|
+
DalpSdkError2,
|
|
3
|
+
createDalpSdkConfigurationError2
|
|
4
|
+
} from "./chunk-j4sxrfzz.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
6
|
+
Secret2,
|
|
7
|
+
secret2,
|
|
8
|
+
unwrapSecret,
|
|
9
|
+
normalizeDalpBaseUrl
|
|
10
|
+
} from "./chunk-xp3fx2yt.js";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from "./chunk-
|
|
12
|
+
readsAsFundingPaused,
|
|
13
|
+
PAUSED_POLL_INTERVAL_MAX_MS
|
|
14
|
+
} from "./chunk-d327hed9.js";
|
|
15
15
|
|
|
16
16
|
// src/errors/find-current-error.ts
|
|
17
17
|
var readProperty = (target, key) => Reflect.get(target, key);
|
|
@@ -26,7 +26,7 @@ var findCurrentError = (error, maxNodes = 20) => {
|
|
|
26
26
|
}
|
|
27
27
|
seen.add(current);
|
|
28
28
|
visited += 1;
|
|
29
|
-
if (current instanceof
|
|
29
|
+
if (current instanceof DalpSdkError2) {
|
|
30
30
|
return current;
|
|
31
31
|
}
|
|
32
32
|
if (typeof current !== "object") {
|
|
@@ -46,7 +46,7 @@ var findCurrentError = (error, maxNodes = 20) => {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
// src/errors/api-error.ts
|
|
49
|
-
class
|
|
49
|
+
class DalpApiError2 extends Error {
|
|
50
50
|
id;
|
|
51
51
|
code;
|
|
52
52
|
category;
|
|
@@ -70,11 +70,11 @@ class DalpApiError extends Error {
|
|
|
70
70
|
this.data = options.data;
|
|
71
71
|
}
|
|
72
72
|
static make(options) {
|
|
73
|
-
return new
|
|
73
|
+
return new DalpApiError2(options);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
var
|
|
77
|
-
var
|
|
76
|
+
var isDalpApiError2 = (error) => error instanceof DalpApiError2;
|
|
77
|
+
var findDalpSdkError2 = findCurrentError;
|
|
78
78
|
var API_ERROR_CATEGORIES = new Set([
|
|
79
79
|
"client",
|
|
80
80
|
"auth",
|
|
@@ -95,10 +95,10 @@ var mapSdkErrorCategory = (category) => {
|
|
|
95
95
|
}
|
|
96
96
|
return "operational";
|
|
97
97
|
};
|
|
98
|
-
var
|
|
99
|
-
const sdkError =
|
|
98
|
+
var makeDalpApiError2 = (error) => {
|
|
99
|
+
const sdkError = findDalpSdkError2(error);
|
|
100
100
|
if (sdkError === undefined) {
|
|
101
|
-
return new
|
|
101
|
+
return new DalpApiError2({
|
|
102
102
|
message: "DALP API request failed",
|
|
103
103
|
cause: error,
|
|
104
104
|
code: "sdk.transport.REQUEST_FAILED",
|
|
@@ -109,7 +109,7 @@ var makeDalpApiError = (error) => {
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
const detailsId = sdkError.details?.id;
|
|
112
|
-
return new
|
|
112
|
+
return new DalpApiError2({
|
|
113
113
|
message: sdkError.message,
|
|
114
114
|
cause: sdkError,
|
|
115
115
|
id: typeof detailsId === "string" ? detailsId : undefined,
|
|
@@ -477,20 +477,20 @@ function withConditionalRequests(base) {
|
|
|
477
477
|
const request = new Request(input, init);
|
|
478
478
|
syncIdentity(request.headers);
|
|
479
479
|
if (request.method !== "GET") {
|
|
480
|
-
const
|
|
481
|
-
if (isIdentityResetPath(request.url) &&
|
|
480
|
+
const response = await base(request);
|
|
481
|
+
if (isIdentityResetPath(request.url) && response.ok) {
|
|
482
482
|
state.store.clear();
|
|
483
483
|
state.lastIdentity = undefined;
|
|
484
484
|
}
|
|
485
|
-
return
|
|
485
|
+
return response;
|
|
486
486
|
}
|
|
487
487
|
const key = resourceKey(request);
|
|
488
488
|
let sent = request;
|
|
489
489
|
if (!request.headers.has(IF_NONE_MATCH)) {
|
|
490
|
-
const
|
|
491
|
-
if (
|
|
490
|
+
const entry = touch(state.store, key);
|
|
491
|
+
if (entry !== undefined) {
|
|
492
492
|
const headers = new Headers(request.headers);
|
|
493
|
-
headers.set(IF_NONE_MATCH,
|
|
493
|
+
headers.set(IF_NONE_MATCH, entry.etag);
|
|
494
494
|
sent = new Request(request, { headers });
|
|
495
495
|
}
|
|
496
496
|
}
|
|
@@ -568,7 +568,7 @@ function setNonEmptyHeader(headers, name, value) {
|
|
|
568
568
|
headers.set(name, String(value));
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function createDalpContextHeaders2(context) {
|
|
572
572
|
const headers = new Headers;
|
|
573
573
|
setNonEmptyHeader(headers, CONTEXT_HEADERS.organizationId, context.organizationId);
|
|
574
574
|
setNonEmptyHeader(headers, CONTEXT_HEADERS.participant, context.participant);
|
|
@@ -590,13 +590,13 @@ function createTransport(options) {
|
|
|
590
590
|
let apiKey;
|
|
591
591
|
if (apiKeyOption === undefined) {
|
|
592
592
|
apiKey = undefined;
|
|
593
|
-
} else if (apiKeyOption instanceof
|
|
593
|
+
} else if (apiKeyOption instanceof Secret2) {
|
|
594
594
|
apiKey = apiKeyOption;
|
|
595
595
|
} else {
|
|
596
|
-
apiKey =
|
|
596
|
+
apiKey = secret2(apiKeyOption.trim());
|
|
597
597
|
}
|
|
598
598
|
if (runtime === "browser" && apiKey !== undefined) {
|
|
599
|
-
throw
|
|
599
|
+
throw createDalpSdkConfigurationError2({
|
|
600
600
|
message: "DALP SDK: API keys are server/CLI-only credentials and cannot configure a browser client.",
|
|
601
601
|
why: "An API key placed in a browser client ships the credential to every visitor's bundle.",
|
|
602
602
|
fix: "Keep the API key on the server or CLI process; browser clients authenticate with the session cookie."
|
|
@@ -615,7 +615,7 @@ function createTransport(options) {
|
|
|
615
615
|
conditionalRequests: conditional.store,
|
|
616
616
|
credentials: runtime === "browser" ? "include" : "omit",
|
|
617
617
|
apiKey,
|
|
618
|
-
contextHeaders:
|
|
618
|
+
contextHeaders: createDalpContextHeaders2(options.context ?? {}),
|
|
619
619
|
settlementTimeoutMs: options.settlementTimeoutMs
|
|
620
620
|
};
|
|
621
621
|
}
|
|
@@ -668,7 +668,7 @@ function sdkErrorFromEnvelope(payload, response) {
|
|
|
668
668
|
const rawData = Reflect.get(envelope, "data");
|
|
669
669
|
const data = rawData !== null && typeof rawData === "object" ? rawData : {};
|
|
670
670
|
const retryable = Reflect.get(data, "retryable");
|
|
671
|
-
return new
|
|
671
|
+
return new DalpSdkError2({
|
|
672
672
|
code: readString(envelope, "code") ?? `sdk.transport.HTTP_${String(response.status)}`,
|
|
673
673
|
category: "dependency",
|
|
674
674
|
status: response.status,
|
|
@@ -688,7 +688,7 @@ async function readResponse(response) {
|
|
|
688
688
|
payload = text;
|
|
689
689
|
}
|
|
690
690
|
if (!response.ok) {
|
|
691
|
-
throw
|
|
691
|
+
throw makeDalpApiError2(sdkErrorFromEnvelope(payload, response));
|
|
692
692
|
}
|
|
693
693
|
return payload;
|
|
694
694
|
}
|
|
@@ -696,10 +696,10 @@ async function readResponse(response) {
|
|
|
696
696
|
// src/proxy/settlement.ts
|
|
697
697
|
var SUCCESS_STATE = "COMPLETED";
|
|
698
698
|
var FAILURE_STATES = new Set(["FAILED", "DEAD_LETTER", "CANCELLED"]);
|
|
699
|
-
var
|
|
699
|
+
var DEFAULT_SETTLEMENT_TIMEOUT_MS2 = 120000;
|
|
700
700
|
var POLL_INTERVAL_MS = 1000;
|
|
701
701
|
|
|
702
|
-
class
|
|
702
|
+
class SettlementTimeoutError2 extends DalpSdkError2 {
|
|
703
703
|
transactionId;
|
|
704
704
|
statusUrl;
|
|
705
705
|
constructor(transactionId, statusUrl, timeoutMs) {
|
|
@@ -718,7 +718,7 @@ class SettlementTimeoutError extends DalpSdkError {
|
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
720
|
|
|
721
|
-
class
|
|
721
|
+
class SettlementFailedError2 extends DalpSdkError2 {
|
|
722
722
|
transactionId;
|
|
723
723
|
constructor(transactionId, state, reason) {
|
|
724
724
|
super({
|
|
@@ -757,13 +757,13 @@ async function resolveSettlement(transport, payload, options, now = Date.now, sl
|
|
|
757
757
|
if (handle === undefined) {
|
|
758
758
|
return payload;
|
|
759
759
|
}
|
|
760
|
-
const timeoutMs = options?.settlementTimeoutMs ?? transport.settlementTimeoutMs ??
|
|
760
|
+
const timeoutMs = options?.settlementTimeoutMs ?? transport.settlementTimeoutMs ?? DEFAULT_SETTLEMENT_TIMEOUT_MS2;
|
|
761
761
|
let deadline = now() + timeoutMs;
|
|
762
762
|
let pollIntervalMs = POLL_INTERVAL_MS;
|
|
763
763
|
const statusUrl = handle.statusUrl.startsWith("http") ? handle.statusUrl : `${transport.baseUrl}${handle.statusUrl}`;
|
|
764
764
|
for (;; ) {
|
|
765
765
|
if (now() >= deadline) {
|
|
766
|
-
throw new
|
|
766
|
+
throw new SettlementTimeoutError2(handle.transactionId, handle.statusUrl, timeoutMs);
|
|
767
767
|
}
|
|
768
768
|
await sleep(pollIntervalMs);
|
|
769
769
|
const response = await transport.fetch(statusUrl, {
|
|
@@ -779,7 +779,7 @@ async function resolveSettlement(transport, payload, options, now = Date.now, sl
|
|
|
779
779
|
return status;
|
|
780
780
|
}
|
|
781
781
|
if (state !== undefined && FAILURE_STATES.has(state)) {
|
|
782
|
-
throw new
|
|
782
|
+
throw new SettlementFailedError2(handle.transactionId, state, readString2(body, "errorMessage"));
|
|
783
783
|
}
|
|
784
784
|
if (readsAsFundingPaused(body)) {
|
|
785
785
|
deadline = now() + timeoutMs;
|
|
@@ -791,8 +791,8 @@ async function resolveSettlement(transport, payload, options, now = Date.now, sl
|
|
|
791
791
|
}
|
|
792
792
|
|
|
793
793
|
// src/proxy/sse.ts
|
|
794
|
-
var
|
|
795
|
-
var
|
|
794
|
+
var RESERVED_STREAM_FAILURE_EVENT2 = "effect/httpapi/stream/failure";
|
|
795
|
+
var STREAM_FAILED_ERROR_CODE2 = "sdk.stream.FAILED";
|
|
796
796
|
function parseFrame(raw) {
|
|
797
797
|
try {
|
|
798
798
|
return JSON.parse(raw.data);
|
|
@@ -801,9 +801,9 @@ function parseFrame(raw) {
|
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
803
|
function dispatchFrame(raw) {
|
|
804
|
-
if (raw.event ===
|
|
805
|
-
throw
|
|
806
|
-
code:
|
|
804
|
+
if (raw.event === RESERVED_STREAM_FAILURE_EVENT2) {
|
|
805
|
+
throw makeDalpApiError2(new DalpSdkError2({
|
|
806
|
+
code: STREAM_FAILED_ERROR_CODE2,
|
|
807
807
|
category: "dependency",
|
|
808
808
|
retryable: true,
|
|
809
809
|
message: "The DALP API stream failed before it completed.",
|
|
@@ -834,7 +834,7 @@ function readBlock(block) {
|
|
|
834
834
|
return data.length === 0 ? undefined : { event, data: data.join(`
|
|
835
835
|
`) };
|
|
836
836
|
}
|
|
837
|
-
async function*
|
|
837
|
+
async function* decodeEventStream2(body) {
|
|
838
838
|
const reader = body.getReader();
|
|
839
839
|
const decoder = new TextDecoder;
|
|
840
840
|
let buffer = "";
|
|
@@ -887,7 +887,7 @@ async function* streamRequest(transport, route, input, options) {
|
|
|
887
887
|
if (response.body === null) {
|
|
888
888
|
return;
|
|
889
889
|
}
|
|
890
|
-
yield*
|
|
890
|
+
yield* decodeEventStream2(response.body);
|
|
891
891
|
}
|
|
892
892
|
|
|
893
893
|
// src/proxy/fetch-executor.ts
|
|
@@ -911,9 +911,9 @@ function createFetchExecutor(transport) {
|
|
|
911
911
|
}
|
|
912
912
|
|
|
913
913
|
// src/proxy/tanstack.ts
|
|
914
|
-
function
|
|
914
|
+
function canonicalize2(value) {
|
|
915
915
|
if (Array.isArray(value)) {
|
|
916
|
-
return value.map(
|
|
916
|
+
return value.map(canonicalize2);
|
|
917
917
|
}
|
|
918
918
|
if (value === null || typeof value !== "object") {
|
|
919
919
|
return value;
|
|
@@ -922,20 +922,20 @@ function canonicalize(value) {
|
|
|
922
922
|
for (const key of Object.keys(value).sort((left, right) => left.localeCompare(right))) {
|
|
923
923
|
const entry = Reflect.get(value, key);
|
|
924
924
|
if (entry !== undefined) {
|
|
925
|
-
entries.push([key,
|
|
925
|
+
entries.push([key, canonicalize2(entry)]);
|
|
926
926
|
}
|
|
927
927
|
}
|
|
928
928
|
return Object.fromEntries(entries);
|
|
929
929
|
}
|
|
930
|
-
function
|
|
931
|
-
const canonical =
|
|
930
|
+
function queryKeyFor2(id, input) {
|
|
931
|
+
const canonical = canonicalize2(input);
|
|
932
932
|
return canonical === undefined ? ["dalp", id] : ["dalp", id, canonical];
|
|
933
933
|
}
|
|
934
|
-
var
|
|
934
|
+
var UI_SETTLEMENT_TIMEOUT_MS2 = 30000;
|
|
935
935
|
function createTanstackFactories(transport) {
|
|
936
936
|
return {
|
|
937
937
|
queryOptions: (route, id, input, options) => ({
|
|
938
|
-
queryKey:
|
|
938
|
+
queryKey: queryKeyFor2(id, input),
|
|
939
939
|
queryFn: (context) => sendRequest(transport, route, input, {
|
|
940
940
|
...options,
|
|
941
941
|
...context.signal === undefined ? {} : { signal: context.signal }
|
|
@@ -943,9 +943,9 @@ function createTanstackFactories(transport) {
|
|
|
943
943
|
}),
|
|
944
944
|
mutationOptions: (route, id, options) => ({
|
|
945
945
|
mutationKey: ["dalp", id],
|
|
946
|
-
mutationFn: (input) => sendRequest(transport, route, input, { settlementTimeoutMs:
|
|
946
|
+
mutationFn: (input) => sendRequest(transport, route, input, { settlementTimeoutMs: UI_SETTLEMENT_TIMEOUT_MS2, ...options })
|
|
947
947
|
})
|
|
948
948
|
};
|
|
949
949
|
}
|
|
950
950
|
|
|
951
|
-
export {
|
|
951
|
+
export { DalpApiError2, isDalpApiError2, findDalpSdkError2, makeDalpApiError2, createDalpContextHeaders2, createTransport, DEFAULT_SETTLEMENT_TIMEOUT_MS2, SettlementTimeoutError2, SettlementFailedError2, RESERVED_STREAM_FAILURE_EVENT2, STREAM_FAILED_ERROR_CODE2, decodeEventStream2, streamRequest, sendRequest, createFetchExecutor, canonicalize2, queryKeyFor2, UI_SETTLEMENT_TIMEOUT_MS2, createTanstackFactories };
|
|
@@ -21,7 +21,7 @@ var isCookieDeletion = (setCookie, now = Date.now()) => {
|
|
|
21
21
|
const parsed = Date.parse(expires.trim());
|
|
22
22
|
return !Number.isNaN(parsed) && parsed <= now;
|
|
23
23
|
};
|
|
24
|
-
function
|
|
24
|
+
function makeCookieStore2(initialHeader = "") {
|
|
25
25
|
const cookies = parseCookieHeader(initialHeader);
|
|
26
26
|
return {
|
|
27
27
|
header: () => [...cookies.values()].join("; "),
|
|
@@ -86,7 +86,7 @@ var splitCombinedSetCookie = (value) => {
|
|
|
86
86
|
}
|
|
87
87
|
return cookies;
|
|
88
88
|
};
|
|
89
|
-
function
|
|
89
|
+
function createCookieStoreFetch2(cookieStore, fetchImpl = globalThis.fetch) {
|
|
90
90
|
return async (input, init) => {
|
|
91
91
|
const headers = new Headers(init?.headers ?? (input instanceof Request ? input.headers : undefined));
|
|
92
92
|
if (!cookieStore.isEmpty() && !headers.has("cookie")) {
|
|
@@ -102,7 +102,7 @@ function createCookieStoreFetch(cookieStore, fetchImpl = globalThis.fetch) {
|
|
|
102
102
|
// package.json
|
|
103
103
|
var package_default = {
|
|
104
104
|
name: "@settlemint/dalp-sdk",
|
|
105
|
-
version: "3.1.18-main.
|
|
105
|
+
version: "3.1.18-main.33867412971",
|
|
106
106
|
private: false,
|
|
107
107
|
description: "Fully typed SDK for the DALP tokenization platform API",
|
|
108
108
|
homepage: "https://settlemint.com",
|
|
@@ -254,7 +254,7 @@ var package_default = {
|
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
// src/version.ts
|
|
257
|
-
var
|
|
258
|
-
var
|
|
257
|
+
var SDK_VERSION2 = package_default.version;
|
|
258
|
+
var SDK_USER_AGENT2 = `DALP SDK v${SDK_VERSION2}`;
|
|
259
259
|
|
|
260
|
-
export {
|
|
260
|
+
export { makeCookieStore2, createCookieStoreFetch2, SDK_VERSION2, SDK_USER_AGENT2 };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var DALP_SDK_ERROR_CODE = "DALP_SDK_ERROR";
|
|
3
3
|
var DALP_SDK_ERROR_CATEGORY = "sdk.configuration";
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class DalpSdkError2 extends Error {
|
|
6
6
|
code;
|
|
7
7
|
category;
|
|
8
8
|
status;
|
|
@@ -38,8 +38,8 @@ class DalpSdkError extends Error {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
return new
|
|
41
|
+
function createDalpSdkConfigurationError2(input) {
|
|
42
|
+
return new DalpSdkError2({
|
|
43
43
|
code: DALP_SDK_ERROR_CODE,
|
|
44
44
|
category: DALP_SDK_ERROR_CATEGORY,
|
|
45
45
|
status: 400,
|
|
@@ -51,4 +51,4 @@ function createDalpSdkConfigurationError(input) {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export {
|
|
54
|
+
export { DalpSdkError2, createDalpSdkConfigurationError2 };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/verify-webhook.ts
|
|
2
2
|
import { Webhook as StandardWebhook } from "standardwebhooks";
|
|
3
3
|
var DEFAULT_TIMESTAMP_TOLERANCE_SECONDS = 5 * 60;
|
|
4
|
-
function
|
|
4
|
+
function toStandardWebhookSecret2(secret) {
|
|
5
5
|
return secret.replace(/^dalp_whsk_/u, "");
|
|
6
6
|
}
|
|
7
|
-
async function
|
|
7
|
+
async function verifyWebhook2(input) {
|
|
8
8
|
const headers = normalizeHeaders(input.headers);
|
|
9
9
|
const nowMillis = input.now instanceof Date ? input.now.getTime() : input.now ?? Date.now();
|
|
10
10
|
const tolerance = input.timestampToleranceSeconds ?? DEFAULT_TIMESTAMP_TOLERANCE_SECONDS;
|
|
@@ -54,7 +54,7 @@ function matchesSignature(secret, rawBody, headers) {
|
|
|
54
54
|
if (eventId === undefined || !Number.isFinite(timestamp) || signatures === undefined) {
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
|
-
const expected = new StandardWebhook(
|
|
57
|
+
const expected = new StandardWebhook(toStandardWebhookSecret2(secret)).sign(eventId, new Date(timestamp * 1000), rawBody);
|
|
58
58
|
return signatures.split(" ").some((signature) => {
|
|
59
59
|
const left = new TextEncoder().encode(signature);
|
|
60
60
|
const right = new TextEncoder().encode(expected);
|
|
@@ -99,4 +99,4 @@ function classifySignatureFailure(rawBody, headers) {
|
|
|
99
99
|
return "SECRET_MISMATCH";
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
export {
|
|
102
|
+
export { toStandardWebhookSecret2, verifyWebhook2 };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-f4t1bm86.js";
|
|
2
|
+
data
|
|
3
|
+
} from "./chunk-g0z27jbh.js";
|
|
5
4
|
import {
|
|
6
|
-
createFetchExecutor,
|
|
7
|
-
createTanstackFactories,
|
|
8
5
|
createTransport,
|
|
6
|
+
streamRequest,
|
|
9
7
|
sendRequest,
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
createFetchExecutor,
|
|
9
|
+
createTanstackFactories
|
|
10
|
+
} from "./chunk-396ye0s9.js";
|
|
12
11
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
buildProxy,
|
|
13
|
+
findRoute
|
|
14
|
+
} from "./chunk-rb8k4w3q.js";
|
|
15
15
|
|
|
16
16
|
// src/proxy/client.ts
|
|
17
|
-
function
|
|
17
|
+
function createDalpClient2(options) {
|
|
18
18
|
const transport = createTransport(options);
|
|
19
19
|
const api = buildProxy(data, createFetchExecutor(transport), createTanstackFactories(transport));
|
|
20
20
|
return {
|
|
@@ -30,4 +30,4 @@ function createDalpClient(options) {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
export {
|
|
33
|
+
export { createDalpClient2 };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createDalpSdkConfigurationError2
|
|
3
|
+
} from "./chunk-j4sxrfzz.js";
|
|
4
4
|
|
|
5
5
|
// src/secret.ts
|
|
6
|
-
var
|
|
6
|
+
var SECRET_REDACTION_MARKER2 = "[REDACTED]";
|
|
7
7
|
var inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
8
8
|
var secretValue = new WeakMap;
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class Secret2 {
|
|
11
11
|
constructor(value) {
|
|
12
12
|
secretValue.set(this, value);
|
|
13
13
|
Object.freeze(this);
|
|
@@ -16,19 +16,19 @@ class Secret {
|
|
|
16
16
|
if (value.trim().length === 0) {
|
|
17
17
|
throw new TypeError("DALP SDK: a secret value must not be empty.");
|
|
18
18
|
}
|
|
19
|
-
return new
|
|
19
|
+
return new Secret2(value);
|
|
20
20
|
}
|
|
21
21
|
toString() {
|
|
22
|
-
return
|
|
22
|
+
return SECRET_REDACTION_MARKER2;
|
|
23
23
|
}
|
|
24
24
|
toJSON() {
|
|
25
|
-
return
|
|
25
|
+
return SECRET_REDACTION_MARKER2;
|
|
26
26
|
}
|
|
27
27
|
[inspectSymbol]() {
|
|
28
|
-
return
|
|
28
|
+
return SECRET_REDACTION_MARKER2;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
var
|
|
31
|
+
var secret2 = (value) => Secret2.from(value);
|
|
32
32
|
var unwrapSecret = (value) => {
|
|
33
33
|
const raw = secretValue.get(value);
|
|
34
34
|
if (raw === undefined) {
|
|
@@ -43,7 +43,7 @@ function normalizeDalpBaseUrl(url) {
|
|
|
43
43
|
try {
|
|
44
44
|
parsed = new URL(url);
|
|
45
45
|
} catch (error) {
|
|
46
|
-
throw
|
|
46
|
+
throw createDalpSdkConfigurationError2({
|
|
47
47
|
message: `DALP SDK: invalid url "${url}". Provide a full URL including the protocol (e.g., "https://dalp.example.com").`,
|
|
48
48
|
why: "The SDK could not parse the configured DALP API URL.",
|
|
49
49
|
fix: 'Provide a full http:// or https:// URL, for example "https://dalp.example.com".',
|
|
@@ -51,7 +51,7 @@ function normalizeDalpBaseUrl(url) {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
54
|
-
throw
|
|
54
|
+
throw createDalpSdkConfigurationError2({
|
|
55
55
|
message: `DALP SDK: url must use https:// or http:// protocol, got "${parsed.protocol}".`,
|
|
56
56
|
why: `The SDK received a URL with the unsupported "${parsed.protocol}" protocol.`,
|
|
57
57
|
fix: 'Use a DALP API base URL that starts with "https://" or "http://".'
|
|
@@ -60,4 +60,4 @@ function normalizeDalpBaseUrl(url) {
|
|
|
60
60
|
return `${parsed.origin}${parsed.pathname.replace(/\/+$/, "")}`;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export {
|
|
63
|
+
export { SECRET_REDACTION_MARKER2, Secret2, secret2, unwrapSecret, normalizeDalpBaseUrl };
|
|
@@ -26,7 +26,7 @@ export declare const DALP_SDK_REQUEST_COMPRESSION_MIN_BODY_BYTES = 1024;
|
|
|
26
26
|
/** Explicitly-sized bodies larger than this are sent uncompressed. */
|
|
27
27
|
export declare const DALP_SDK_REQUEST_COMPRESSION_MAX_BODY_BYTES = 16777216;
|
|
28
28
|
/**
|
|
29
|
-
* Bun's `compress` fetch option. bun-types
|
|
29
|
+
* Bun's `compress` fetch option. bun-types still types `RequestInit`
|
|
30
30
|
* from lib.dom without it, so the field is declared here and set through one
|
|
31
31
|
* narrow cast at the transport seam.
|
|
32
32
|
*/
|
package/dist/effect.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
data
|
|
3
|
+
} from "./chunk-g0z27jbh.js";
|
|
4
|
+
import"./chunk-j4sxrfzz.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
DalpApiError2,
|
|
7
7
|
createTransport,
|
|
8
|
-
|
|
8
|
+
streamRequest,
|
|
9
9
|
sendRequest,
|
|
10
|
-
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import"./chunk-
|
|
10
|
+
queryKeyFor2
|
|
11
|
+
} from "./chunk-396ye0s9.js";
|
|
12
|
+
import"./chunk-xp3fx2yt.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import"./chunk-y0d2c7kp.js";
|
|
14
|
+
buildProxy,
|
|
15
|
+
findRoute
|
|
16
|
+
} from "./chunk-rb8k4w3q.js";
|
|
18
17
|
|
|
19
18
|
// src/effect.ts
|
|
20
19
|
import * as Effect from "effect/Effect";
|
|
@@ -27,7 +26,7 @@ class DalpRequestError extends Error {
|
|
|
27
26
|
routeId;
|
|
28
27
|
data;
|
|
29
28
|
constructor(routeId, cause) {
|
|
30
|
-
const api = cause instanceof
|
|
29
|
+
const api = cause instanceof DalpApiError2 ? cause : undefined;
|
|
31
30
|
super(api?.message ?? `DALP request failed for ${routeId}`, { cause });
|
|
32
31
|
this.name = "DalpRequestError";
|
|
33
32
|
this._tag = "DalpRequestError";
|
|
@@ -61,7 +60,7 @@ function createDalpEffectClient(options) {
|
|
|
61
60
|
const executor = (route, id, input, callOptions) => runRoute(transport, route, id, input, callOptions);
|
|
62
61
|
const factories = {
|
|
63
62
|
queryOptions: (route, id, input, callOptions) => ({
|
|
64
|
-
queryKey:
|
|
63
|
+
queryKey: queryKeyFor2(id, input),
|
|
65
64
|
queryFn: () => runRoute(transport, route, id, input, callOptions)
|
|
66
65
|
}),
|
|
67
66
|
mutationOptions: (route, id, callOptions) => ({
|
package/dist/errors/sdk-error.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "../chunk-
|
|
2
|
+
DalpSdkError2,
|
|
3
|
+
createDalpSdkConfigurationError2
|
|
4
|
+
} from "../chunk-j4sxrfzz.js";
|
|
5
5
|
export {
|
|
6
|
-
DalpSdkError,
|
|
7
|
-
createDalpSdkConfigurationError
|
|
6
|
+
DalpSdkError2 as DalpSdkError,
|
|
7
|
+
createDalpSdkConfigurationError2 as createDalpSdkConfigurationError
|
|
8
8
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
|
+
import"./chunk-g0z27jbh.js";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
makeCookieStore
|
|
6
|
-
} from "./chunk-feq06kty.js";
|
|
3
|
+
DalpSdkError2,
|
|
4
|
+
createDalpSdkConfigurationError2
|
|
5
|
+
} from "./chunk-j4sxrfzz.js";
|
|
7
6
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
DalpApiError2,
|
|
8
|
+
isDalpApiError2,
|
|
9
|
+
findDalpSdkError2,
|
|
10
|
+
makeDalpApiError2,
|
|
11
|
+
createDalpContextHeaders2,
|
|
12
|
+
DEFAULT_SETTLEMENT_TIMEOUT_MS2,
|
|
13
|
+
SettlementTimeoutError2,
|
|
14
|
+
SettlementFailedError2,
|
|
15
|
+
RESERVED_STREAM_FAILURE_EVENT2,
|
|
16
|
+
STREAM_FAILED_ERROR_CODE2,
|
|
17
|
+
decodeEventStream2
|
|
18
|
+
} from "./chunk-396ye0s9.js";
|
|
11
19
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
SettlementFailedError,
|
|
17
|
-
SettlementTimeoutError,
|
|
18
|
-
createDalpContextHeaders,
|
|
19
|
-
decodeEventStream,
|
|
20
|
-
findDalpSdkError,
|
|
21
|
-
isDalpApiError,
|
|
22
|
-
makeDalpApiError
|
|
23
|
-
} from "./chunk-tcm75mnh.js";
|
|
24
|
-
import"./chunk-fjnq61hj.js";
|
|
25
|
-
import"./chunk-gryttjx0.js";
|
|
20
|
+
SECRET_REDACTION_MARKER2,
|
|
21
|
+
Secret2,
|
|
22
|
+
secret2
|
|
23
|
+
} from "./chunk-xp3fx2yt.js";
|
|
26
24
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
makeCookieStore2,
|
|
26
|
+
createCookieStoreFetch2,
|
|
27
|
+
SDK_VERSION2,
|
|
28
|
+
SDK_USER_AGENT2
|
|
29
|
+
} from "./chunk-as5fp17r.js";
|
|
31
30
|
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} from "./chunk-y0d2c7kp.js";
|
|
31
|
+
createDalpClient2
|
|
32
|
+
} from "./chunk-v6zadx3z.js";
|
|
35
33
|
// src/transport/sse-lifecycle.ts
|
|
36
34
|
class SseLifecycleError extends Error {
|
|
37
35
|
reason;
|
|
@@ -125,28 +123,28 @@ var Webhook;
|
|
|
125
123
|
})(Webhook ||= {});
|
|
126
124
|
var WEBHOOK_MANIFEST_VERSION = Webhook.MANIFEST_VERSION;
|
|
127
125
|
export {
|
|
128
|
-
DEFAULT_SETTLEMENT_TIMEOUT_MS,
|
|
129
|
-
DalpApiError,
|
|
130
|
-
DalpSdkError,
|
|
131
|
-
RESERVED_STREAM_FAILURE_EVENT,
|
|
132
|
-
SDK_USER_AGENT,
|
|
133
|
-
SDK_VERSION,
|
|
134
|
-
SECRET_REDACTION_MARKER,
|
|
135
|
-
STREAM_FAILED_ERROR_CODE,
|
|
136
|
-
Secret,
|
|
137
|
-
SettlementFailedError,
|
|
138
|
-
SettlementTimeoutError,
|
|
126
|
+
DEFAULT_SETTLEMENT_TIMEOUT_MS2 as DEFAULT_SETTLEMENT_TIMEOUT_MS,
|
|
127
|
+
DalpApiError2 as DalpApiError,
|
|
128
|
+
DalpSdkError2 as DalpSdkError,
|
|
129
|
+
RESERVED_STREAM_FAILURE_EVENT2 as RESERVED_STREAM_FAILURE_EVENT,
|
|
130
|
+
SDK_USER_AGENT2 as SDK_USER_AGENT,
|
|
131
|
+
SDK_VERSION2 as SDK_VERSION,
|
|
132
|
+
SECRET_REDACTION_MARKER2 as SECRET_REDACTION_MARKER,
|
|
133
|
+
STREAM_FAILED_ERROR_CODE2 as STREAM_FAILED_ERROR_CODE,
|
|
134
|
+
Secret2 as Secret,
|
|
135
|
+
SettlementFailedError2 as SettlementFailedError,
|
|
136
|
+
SettlementTimeoutError2 as SettlementTimeoutError,
|
|
139
137
|
SseLifecycleError,
|
|
140
138
|
WEBHOOK_MANIFEST_VERSION,
|
|
141
139
|
consumeSseUntilTerminal,
|
|
142
|
-
createCookieStoreFetch,
|
|
143
|
-
createDalpClient,
|
|
144
|
-
createDalpContextHeaders,
|
|
145
|
-
createDalpSdkConfigurationError,
|
|
146
|
-
decodeEventStream,
|
|
147
|
-
findDalpSdkError,
|
|
148
|
-
isDalpApiError,
|
|
149
|
-
makeCookieStore,
|
|
150
|
-
makeDalpApiError,
|
|
151
|
-
secret
|
|
140
|
+
createCookieStoreFetch2 as createCookieStoreFetch,
|
|
141
|
+
createDalpClient2 as createDalpClient,
|
|
142
|
+
createDalpContextHeaders2 as createDalpContextHeaders,
|
|
143
|
+
createDalpSdkConfigurationError2 as createDalpSdkConfigurationError,
|
|
144
|
+
decodeEventStream2 as decodeEventStream,
|
|
145
|
+
findDalpSdkError2 as findDalpSdkError,
|
|
146
|
+
isDalpApiError2 as isDalpApiError,
|
|
147
|
+
makeCookieStore2 as makeCookieStore,
|
|
148
|
+
makeDalpApiError2 as makeDalpApiError,
|
|
149
|
+
secret2 as secret
|
|
152
150
|
};
|
package/dist/react-query.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import"./chunk-j4sxrfzz.js";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import"./chunk-
|
|
7
|
-
import"./chunk-h12fatty.js";
|
|
8
|
-
import"./chunk-y0d2c7kp.js";
|
|
3
|
+
canonicalize2,
|
|
4
|
+
queryKeyFor2,
|
|
5
|
+
UI_SETTLEMENT_TIMEOUT_MS2
|
|
6
|
+
} from "./chunk-396ye0s9.js";
|
|
7
|
+
import"./chunk-xp3fx2yt.js";
|
|
9
8
|
export {
|
|
10
|
-
UI_SETTLEMENT_TIMEOUT_MS,
|
|
11
|
-
canonicalize,
|
|
12
|
-
queryKeyFor
|
|
9
|
+
UI_SETTLEMENT_TIMEOUT_MS2 as UI_SETTLEMENT_TIMEOUT_MS,
|
|
10
|
+
canonicalize2 as canonicalize,
|
|
11
|
+
queryKeyFor2 as queryKeyFor
|
|
13
12
|
};
|
package/dist/routes/index.js
CHANGED
package/dist/scalars/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
2
|
+
DalpSdkError2
|
|
3
|
+
} from "../chunk-j4sxrfzz.js";
|
|
4
4
|
|
|
5
5
|
// src/scalars/big-decimal.ts
|
|
6
6
|
import * as dn from "dnum";
|
|
7
7
|
var DECIMAL_WIRE = /^-?\d+(?:\.\d+)?$/u;
|
|
8
8
|
function decodeBigDecimal(wire) {
|
|
9
9
|
if (!DECIMAL_WIRE.test(wire)) {
|
|
10
|
-
throw new
|
|
10
|
+
throw new DalpSdkError2({
|
|
11
11
|
code: "sdk.scalar.BIG_DECIMAL_INVALID",
|
|
12
12
|
category: "sdk.configuration",
|
|
13
13
|
retryable: false,
|
|
@@ -23,7 +23,7 @@ var encodeBigDecimal = (value) => dn.toString(value);
|
|
|
23
23
|
import { getAddress, isAddress } from "viem";
|
|
24
24
|
function decodeEthereumAddress(wire) {
|
|
25
25
|
if (!isAddress(wire, { strict: false })) {
|
|
26
|
-
throw new
|
|
26
|
+
throw new DalpSdkError2({
|
|
27
27
|
code: "sdk.scalar.EVM_ADDRESS_INVALID",
|
|
28
28
|
category: "sdk.configuration",
|
|
29
29
|
retryable: false,
|
|
@@ -43,7 +43,7 @@ function tryDecodeEthereumAddress(wire) {
|
|
|
43
43
|
// src/scalars/organization-id.ts
|
|
44
44
|
function decodeOrganizationId(wire) {
|
|
45
45
|
if (wire.length === 0) {
|
|
46
|
-
throw new
|
|
46
|
+
throw new DalpSdkError2({
|
|
47
47
|
code: "sdk.scalar.ORGANIZATION_ID_INVALID",
|
|
48
48
|
category: "sdk.configuration",
|
|
49
49
|
retryable: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
toStandardWebhookSecret2
|
|
3
|
+
} from "./chunk-qvtjb3dz.js";
|
|
4
4
|
|
|
5
5
|
// src/sign-webhook-receipt.ts
|
|
6
6
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
@@ -10,7 +10,7 @@ function buildReceiptSigningString(tuple) {
|
|
|
10
10
|
`);
|
|
11
11
|
}
|
|
12
12
|
function signWebhookReceipt({ secret, ...tuple }) {
|
|
13
|
-
const key = Buffer.from(
|
|
13
|
+
const key = Buffer.from(toStandardWebhookSecret2(secret), "base64");
|
|
14
14
|
return createHmac("sha256", key).update(buildReceiptSigningString(tuple), "utf8").digest("hex");
|
|
15
15
|
}
|
|
16
16
|
function verifyWebhookReceipt({ signature, ...input }) {
|
package/dist/verify-webhook.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
2
|
+
toStandardWebhookSecret2,
|
|
3
|
+
verifyWebhook2
|
|
4
|
+
} from "./chunk-qvtjb3dz.js";
|
|
5
5
|
export {
|
|
6
|
-
toStandardWebhookSecret,
|
|
7
|
-
verifyWebhook
|
|
6
|
+
toStandardWebhookSecret2 as toStandardWebhookSecret,
|
|
7
|
+
verifyWebhook2 as verifyWebhook
|
|
8
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
2
|
+
readsAsFundingPaused,
|
|
3
|
+
PAUSED_POLL_INTERVAL_MAX_MS
|
|
4
|
+
} from "./chunk-d327hed9.js";
|
|
5
5
|
|
|
6
6
|
// src/wait-for-transaction.ts
|
|
7
7
|
var failedStates = new Set(["FAILED", "DEAD_LETTER", "CANCELLED"]);
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|