@dynamic-labs-wallet/core 0.0.322 → 0.0.324
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/index.cjs.js +101 -18
- package/index.esm.js +101 -18
- package/package.json +2 -2
- package/src/api/api.d.ts +195 -0
- package/src/api/api.d.ts.map +1 -0
- package/src/api/client.d.ts +30 -0
- package/src/api/client.d.ts.map +1 -0
- package/src/api/index.d.ts +2 -0
- package/src/api/index.d.ts.map +1 -0
- package/src/constants.d.ts +130 -0
- package/src/constants.d.ts.map +1 -0
- package/src/eventStream/utils.d.ts +57 -0
- package/src/eventStream/utils.d.ts.map +1 -0
- package/src/index.d.ts +8 -0
- package/src/index.d.ts.map +1 -0
- package/src/mpc/constants.d.ts +51 -0
- package/src/mpc/constants.d.ts.map +1 -0
- package/src/mpc/index.d.ts +3 -0
- package/src/mpc/index.d.ts.map +1 -0
- package/src/mpc/utils.d.ts +75 -0
- package/src/mpc/utils.d.ts.map +1 -0
- package/src/services/axiosErrorResponse.d.ts +10 -0
- package/src/services/axiosErrorResponse.d.ts.map +1 -0
- package/src/services/logger.d.ts +19 -0
- package/src/services/logger.d.ts.map +1 -0
- package/src/types.d.ts +510 -0
- package/src/types.d.ts.map +1 -0
- package/src/utils/index.d.ts +4 -0
- package/src/utils/index.d.ts.map +1 -0
- package/src/utils/keyShare.d.ts +3 -0
- package/src/utils/keyShare.d.ts.map +1 -0
- package/src/utils/messageSerialization.d.ts +6 -0
- package/src/utils/messageSerialization.d.ts.map +1 -0
- package/src/utils/sdkVersion.d.ts +38 -0
- package/src/utils/sdkVersion.d.ts.map +1 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export declare enum ENVIRONMENT_ENUM {
|
|
2
|
+
development = "development",
|
|
3
|
+
preprod = "preprod",
|
|
4
|
+
production = "production"
|
|
5
|
+
}
|
|
6
|
+
export declare const DynamicRequestIdHeader = "x-dyn-request-id";
|
|
7
|
+
export declare const DynamicClientSessionSignature = "x-dyn-client-session-signature";
|
|
8
|
+
export declare const DynamicMfaTokenHeader = "x-mfa-auth-token";
|
|
9
|
+
export declare const DynamicElevatedAccessTokenHeader = "x-dyn-elevated-access-token";
|
|
10
|
+
export declare const DynamicForwardMPCHeader = "x-forward-mpc-client";
|
|
11
|
+
export declare const DynamicTraceIdHeader = "x-dyn-trace-id";
|
|
12
|
+
export declare const DynamicTraceElapsedTimeHeader = "x-dyn-trace-elapsed-time";
|
|
13
|
+
/**
|
|
14
|
+
* Dynamic auth base API URL to redcoast API
|
|
15
|
+
* NOTE: For coookie auth, we should use the configured baseApiUrl
|
|
16
|
+
*/
|
|
17
|
+
export declare const DYNAMIC_AUTH_PROD_BASE_API_URL = "https://app.dynamicauth.com";
|
|
18
|
+
export declare const DYNAMIC_AUTH_PREPROD_BASE_API_URL = "https://app.dynamic-preprod.xyz";
|
|
19
|
+
export declare const DYNAMIC_AUTH_DEV_BASE_API_URL = "http://localhost:4200";
|
|
20
|
+
export declare const DYNAMIC_AUTH_BASE_API_URL_MAP: {
|
|
21
|
+
readonly production: "https://app.dynamicauth.com";
|
|
22
|
+
readonly preprod: "https://app.dynamic-preprod.xyz";
|
|
23
|
+
readonly development: "http://localhost:4200";
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Evervault keyshare encryption relay
|
|
27
|
+
* Note: Not used for cookie auth, we use the configured baseKeyshareRelayApiUrl
|
|
28
|
+
*/
|
|
29
|
+
export declare const DYNAMIC_KEYSHARES_RELAY_PROD_BASE_API_URL = "https://waas-keyshares-relay.dynamicauth.com";
|
|
30
|
+
export declare const DYNAMIC_KEYSHARES_RELAY_PREPROD_BASE_API_URL = "https://waas-keyshares-relay.dynamic-preprod.xyz";
|
|
31
|
+
export declare const DYNAMIC_KEYSHARES_RELAY_MAP: {
|
|
32
|
+
readonly production: "https://waas-keyshares-relay.dynamicauth.com";
|
|
33
|
+
readonly preprod: "https://waas-keyshares-relay.dynamic-preprod.xyz";
|
|
34
|
+
readonly development: "https://waas-keyshares-relay.dynamic-preprod.xyz";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Dymamic MPC relay where the MPC operations are performed (NOT keyshare relay in Evervault)
|
|
38
|
+
*/
|
|
39
|
+
export declare const MPC_RELAY_PROD_API_URL = "relay.dynamicauth.com";
|
|
40
|
+
export declare const MPC_RELAY_PREPROD_API_URL = "relay.dynamic-preprod.xyz";
|
|
41
|
+
export declare const MPC_RELAY_DEV_API_URL = "http://localhost:4200";
|
|
42
|
+
export declare const MPC_RELAY_URL_MAP: {
|
|
43
|
+
readonly production: "relay.dynamicauth.com";
|
|
44
|
+
readonly preprod: "relay.dynamic-preprod.xyz";
|
|
45
|
+
readonly development: "http://localhost:4200";
|
|
46
|
+
};
|
|
47
|
+
export declare const RELAY_APP_ID_HEADER = "X-Evervault-App-Id";
|
|
48
|
+
export declare const PROD_RELAY_APP_ID = "app_6e12fc400995";
|
|
49
|
+
export declare const PREPROD_RELAY_APP_ID = "app_32d15525a875";
|
|
50
|
+
export declare const DYNAMIC_CLIENT_RELAY_REDCOAST_APP_ID_MAP: {
|
|
51
|
+
readonly production: "app_6e12fc400995";
|
|
52
|
+
readonly preprod: "app_32d15525a875";
|
|
53
|
+
readonly development: undefined;
|
|
54
|
+
};
|
|
55
|
+
export declare const RELAY_API_KEY_HEADER = "X-Evervault-Api-Key";
|
|
56
|
+
export declare const PROD_RELAY_API_KEY = "ev:key:1:7kRuVm1sE1J5FjGz2ijufy0IkATzrBKEvde0IMLW1dt3xbFcdTdOKHO0vNnJeAjAD:YmAPOP:Jh7DdD";
|
|
57
|
+
export declare const PREPROD_RELAY_API_KEY = "ev:key:1:7j2jIPMzlcKlpDz1RTV6Vadsm8sgmj1VHZzJXqW9ie1dgmyzKmccEGI8BBWU0PaXv:XfF7Ri:ivvRp1";
|
|
58
|
+
export declare const DYNAMIC_CLIENT_RELAY_REDCOAST_API_KEY_MAP: {
|
|
59
|
+
readonly production: "ev:key:1:7kRuVm1sE1J5FjGz2ijufy0IkATzrBKEvde0IMLW1dt3xbFcdTdOKHO0vNnJeAjAD:YmAPOP:Jh7DdD";
|
|
60
|
+
readonly preprod: "ev:key:1:7j2jIPMzlcKlpDz1RTV6Vadsm8sgmj1VHZzJXqW9ie1dgmyzKmccEGI8BBWU0PaXv:XfF7Ri:ivvRp1";
|
|
61
|
+
readonly development: undefined;
|
|
62
|
+
};
|
|
63
|
+
export declare const SOLANA_RPC_URL = "https://api.devnet.solana.com";
|
|
64
|
+
export declare const chain: {
|
|
65
|
+
readonly EVM: "EVM";
|
|
66
|
+
readonly SVM: "SVM";
|
|
67
|
+
readonly COSMOS: "COSMOS";
|
|
68
|
+
readonly BTC: "BTC";
|
|
69
|
+
readonly FLOW: "FLOW";
|
|
70
|
+
readonly SUI: "SUI";
|
|
71
|
+
readonly TON: "TON";
|
|
72
|
+
};
|
|
73
|
+
export type ChainType = (typeof chain)[keyof typeof chain];
|
|
74
|
+
export declare enum WalletOperation {
|
|
75
|
+
REACH_THRESHOLD = "REACH_THRESHOLD",
|
|
76
|
+
REACH_ALL_PARTIES = "REACH_ALL_PARTIES",
|
|
77
|
+
SIGN_MESSAGE = "SIGN_MESSAGE",
|
|
78
|
+
SIGN_TRANSACTION = "SIGN_TRANSACTION",
|
|
79
|
+
REFRESH = "REFRESH",
|
|
80
|
+
RESHARE = "RESHARE",
|
|
81
|
+
EXPORT_PRIVATE_KEY = "EXPORT_PRIVATE_KEY",
|
|
82
|
+
NO_OPERATION = "NO_OPERATION",
|
|
83
|
+
RECOVER = "RECOVER"
|
|
84
|
+
}
|
|
85
|
+
export declare const ENCRYPTED_SHARES_STORAGE_SUFFIX = "-encrypted";
|
|
86
|
+
export declare enum BackupLocation {
|
|
87
|
+
DYNAMIC = "dynamic",
|
|
88
|
+
GOOGLE_DRIVE = "googleDrive",
|
|
89
|
+
ICLOUD = "iCloud",
|
|
90
|
+
USER = "user",
|
|
91
|
+
EXTERNAL = "external",
|
|
92
|
+
DELEGATED = "delegated"
|
|
93
|
+
}
|
|
94
|
+
export declare const IFRAME_DOMAIN_MAP: {
|
|
95
|
+
readonly development: "http://localhost:4200";
|
|
96
|
+
readonly preprod: "https://app.dynamic-preprod.xyz";
|
|
97
|
+
readonly production: "https://app.dynamicauth.com";
|
|
98
|
+
};
|
|
99
|
+
export declare const chainEnumToVerifiedCredentialName: {
|
|
100
|
+
[key: string]: string;
|
|
101
|
+
};
|
|
102
|
+
export declare const verifiedCredentialNameToChainEnum: {
|
|
103
|
+
[key: string]: string;
|
|
104
|
+
};
|
|
105
|
+
export declare const DELEGATED_SHARE_COUNT = 1;
|
|
106
|
+
export declare const FEATURE_FLAGS: {
|
|
107
|
+
ENABLE_DELEGATED_KEY_SHARES_FLAG: string;
|
|
108
|
+
ENABLE_FORWARD_MPC_CLIENT_FLAG: string;
|
|
109
|
+
ENABLE_ROOM_CACHE_FLAG: string;
|
|
110
|
+
};
|
|
111
|
+
export declare const DYNAMIC_FORWARD_MPC_PROD_ENCLAVE_URL = "wss://mpc-client.dynamicauth.com/ws";
|
|
112
|
+
export declare const DYNAMIC_FORWARD_MPC_PREPROD_ENCLAVE_URL = "wss://mpc-client.dynamic-preprod.xyz/ws";
|
|
113
|
+
export declare const DYNAMIC_FORWARD_MPC_DEV_ENCLAVE_URL = "ws://localhost:8008/ws";
|
|
114
|
+
export declare const DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP: {
|
|
115
|
+
readonly production: "wss://mpc-client.dynamicauth.com/ws";
|
|
116
|
+
readonly preprod: "wss://mpc-client.dynamic-preprod.xyz/ws";
|
|
117
|
+
readonly development: "ws://localhost:8008/ws";
|
|
118
|
+
};
|
|
119
|
+
export declare const DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP: {
|
|
120
|
+
readonly production: {
|
|
121
|
+
readonly expectedPcr8: "484fd412249304fe7659b2a9a4869504f0e4502d8abb4f88183e65416b4f62354e4eda60e80a5b2e9d730ab0d804f83e";
|
|
122
|
+
readonly strictCertValidation: true;
|
|
123
|
+
};
|
|
124
|
+
readonly preprod: {
|
|
125
|
+
readonly expectedPcr8: "acc59ec98dbf7ecb43f9a6b9890866141868c079aa879e05e3675e1a10e187259a64951e72cc531541b02dbdcd780770";
|
|
126
|
+
readonly strictCertValidation: true;
|
|
127
|
+
};
|
|
128
|
+
readonly development: undefined;
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../packages/src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,6BAA6B,mCAAmC,CAAC;AAC9E,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AACxD,eAAO,MAAM,gCAAgC,gCAAgC,CAAC;AAC9E,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAC9D,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AACrD,eAAO,MAAM,6BAA6B,6BAA6B,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAC5E,eAAO,MAAM,iCAAiC,oCAAoC,CAAC;AACnF,eAAO,MAAM,6BAA6B,0BAA0B,CAAC;AAErE,eAAO,MAAM,6BAA6B;;;;CAIhC,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,yCAAyC,iDAAiD,CAAC;AACxG,eAAO,MAAM,4CAA4C,qDAAqD,CAAC;AAE/G,eAAO,MAAM,2BAA2B;;;;CAI9B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAC9D,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,eAAO,MAAM,i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C;AAEF,eAAO,MAAM,oCAAoC,wCAAwC,CAAC;AAE1F,eAAO,MAAM,uCAAuC,4CAA4C,CAAC;AAEjG,eAAO,MAAM,mCAAmC,2BAA2B,CAAC;AAE5E,eAAO,MAAM,mCAAmC;;;;CAItC,CAAC;AAEX,eAAO,MAAM,kDAAkD;;;;;;;;;;CAUrD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
2
|
+
import { SuccessEventType, type TraceContext } from '../types.js';
|
|
3
|
+
export declare const getElapsedTime: (startTime?: number) => string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a promise that resolves when a specific event is received from an event stream.
|
|
6
|
+
* Adds a timeout to prevent hanging and races the two promises.
|
|
7
|
+
*
|
|
8
|
+
* @template T The expected type of the response data
|
|
9
|
+
* @param apiClient The axios instance to use for API calls
|
|
10
|
+
* @param options The configuration options
|
|
11
|
+
* @returns A promise that resolves with the event data or rejects on timeout
|
|
12
|
+
*/
|
|
13
|
+
export declare const createEventStreamPromise: <T>({ apiClient, dynamicRequestId, endpoint, body, successEventType, timeoutMs, timeoutMessage, onError, onCeremonyComplete, mfaToken, elevatedAccessToken, forwardMPCClientEnabled, traceContext, }: {
|
|
14
|
+
apiClient: AxiosInstance;
|
|
15
|
+
dynamicRequestId?: string;
|
|
16
|
+
endpoint: string;
|
|
17
|
+
body: Record<string, unknown> | undefined;
|
|
18
|
+
successEventType: SuccessEventType;
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
timeoutMessage: string;
|
|
21
|
+
onError?: (error: Error) => void;
|
|
22
|
+
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
23
|
+
mfaToken?: string;
|
|
24
|
+
elevatedAccessToken?: string;
|
|
25
|
+
forwardMPCClientEnabled?: boolean;
|
|
26
|
+
traceContext?: TraceContext;
|
|
27
|
+
}) => Promise<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a handler function for processing server-sent events (SSE) streams.
|
|
30
|
+
* This utility manages asynchronous event-based communication with the server,
|
|
31
|
+
* particularly for long-running operations like wallet creation or key generation.
|
|
32
|
+
*
|
|
33
|
+
* @template T - The expected type of the successful response data
|
|
34
|
+
* @param {function} resolve - Promise resolution function to call when the success event is received
|
|
35
|
+
* @param {function} reject - Promise rejection function to call when an error occurs
|
|
36
|
+
* @param {string} successEventType - The event type string that indicates a successful operation
|
|
37
|
+
* @param {function} [onError] - Optional callback for error handling, allowing custom error processing
|
|
38
|
+
* @returns {function} A response handler function that processes the event stream
|
|
39
|
+
*/
|
|
40
|
+
export declare const createSuccessErrorEventStreamHandler: <T>({ resolve, reject, successEventType, onError, onCeremonyComplete, }: {
|
|
41
|
+
resolve: (data: T) => void;
|
|
42
|
+
reject: (error: Error) => void;
|
|
43
|
+
successEventType: string;
|
|
44
|
+
onError?: (error: Error) => void;
|
|
45
|
+
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
46
|
+
}) => (response: {
|
|
47
|
+
status?: number;
|
|
48
|
+
data: {
|
|
49
|
+
getReader: () => {
|
|
50
|
+
read: () => Promise<{
|
|
51
|
+
value: Uint8Array;
|
|
52
|
+
done: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}) => void;
|
|
57
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/eventStream/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAUlE,eAAO,MAAM,cAAc,eAAgB,MAAM,KAAG,MAAM,GAAG,SAE5D,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GAAI,CAAC,oMAcvC;IACD,SAAS,EAAE,aAAa,CAAC;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AC"}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './constants.js';
|
|
2
|
+
export * from './mpc/index.js';
|
|
3
|
+
export * from './api/index.js';
|
|
4
|
+
export * from './types.js';
|
|
5
|
+
export * from './utils/index.js';
|
|
6
|
+
export * from './services/axiosErrorResponse.js';
|
|
7
|
+
export { Logger } from './services/logger.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare enum SigningAlgorithm {
|
|
2
|
+
ECDSA = "ECDSA",
|
|
3
|
+
ED25519 = "ED25519",
|
|
4
|
+
BIP340 = "BIP340"
|
|
5
|
+
}
|
|
6
|
+
export declare const BITCOIN_DERIVATION_PATHS: {
|
|
7
|
+
NATIVE_SEGWIT: number[];
|
|
8
|
+
TAPROOT: number[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Bitcoin address type configurations
|
|
12
|
+
* Maps each address type to its derivation path and signing algorithm
|
|
13
|
+
*/
|
|
14
|
+
export declare const BITCOIN_ADDRESS_TYPE_CONFIG: Record<string, {
|
|
15
|
+
derivationPath: number[];
|
|
16
|
+
signingAlgorithm: SigningAlgorithm;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const MPC_CHAIN_CONFIG: Record<string, {
|
|
19
|
+
derivationPath: number[];
|
|
20
|
+
signingAlgorithm: SigningAlgorithm;
|
|
21
|
+
}>;
|
|
22
|
+
export declare enum ThresholdSignatureScheme {
|
|
23
|
+
TWO_OF_TWO = "TWO_OF_TWO",
|
|
24
|
+
TWO_OF_THREE = "TWO_OF_THREE",
|
|
25
|
+
THREE_OF_FIVE = "THREE_OF_FIVE"
|
|
26
|
+
}
|
|
27
|
+
export declare const MPC_CONFIG: {
|
|
28
|
+
TWO_OF_TWO: {
|
|
29
|
+
numberOfParties: number;
|
|
30
|
+
threshold: number;
|
|
31
|
+
clientThreshold: number;
|
|
32
|
+
dynamicServerThreshold: number;
|
|
33
|
+
};
|
|
34
|
+
TWO_OF_THREE: {
|
|
35
|
+
numberOfParties: number;
|
|
36
|
+
threshold: number;
|
|
37
|
+
clientThreshold: number;
|
|
38
|
+
dynamicServerThreshold: number;
|
|
39
|
+
};
|
|
40
|
+
THREE_OF_FIVE: {
|
|
41
|
+
numberOfParties: number;
|
|
42
|
+
threshold: number;
|
|
43
|
+
clientThreshold: number;
|
|
44
|
+
dynamicServerThreshold: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare enum CreateRoomPartiesOptions {
|
|
48
|
+
THRESHOLD = "threshold",
|
|
49
|
+
FULL = "full"
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/mpc/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,MAAM,EACN;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAAE,CAUjE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAAE,CA0C7G,CAAC;AAEF,oBAAY,wBAAwB;IAClC,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;CAmBtB,CAAC;AAEF,oBAAY,wBAAwB;IAClC,SAAS,cAAc;IACvB,IAAI,SAAS;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mpc/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ThresholdSignatureScheme, type SigningAlgorithm } from './constants.js';
|
|
2
|
+
import { ENVIRONMENT_ENUM } from '../constants.js';
|
|
3
|
+
import type { BitcoinAddressType, BitcoinConfig } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Get Bitcoin chain configuration based on address type
|
|
6
|
+
* @param addressType - Bitcoin address type (taproot, native_segwit)
|
|
7
|
+
* @returns Chain configuration with derivation path and signing algorithm
|
|
8
|
+
*/
|
|
9
|
+
export declare const getBitcoinChainConfig: (addressType: BitcoinAddressType) => {
|
|
10
|
+
derivationPath: number[];
|
|
11
|
+
signingAlgorithm: SigningAlgorithm;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Get MPC chain configuration
|
|
15
|
+
* @param chainName - Chain name (e.g., 'BTC', 'EVM', 'SVM')
|
|
16
|
+
* @param bitcoinConfig - Optional bitcoin config (for BTC)
|
|
17
|
+
* @returns Chain configuration with derivation path and signing algorithm
|
|
18
|
+
*/
|
|
19
|
+
export declare const getMPCChainConfig: (chainName: string, bitcoinConfig?: BitcoinConfig) => {
|
|
20
|
+
derivationPath: number[];
|
|
21
|
+
signingAlgorithm: SigningAlgorithm;
|
|
22
|
+
};
|
|
23
|
+
export declare const getTSSConfig: (thresholdSignatureScheme: ThresholdSignatureScheme) => {
|
|
24
|
+
threshold: number;
|
|
25
|
+
numberOfParties: number;
|
|
26
|
+
};
|
|
27
|
+
export declare const getClientThreshold: (thresholdSignatureScheme: ThresholdSignatureScheme) => number;
|
|
28
|
+
export declare const getDynamicServerThreshold: (thresholdSignatureScheme: ThresholdSignatureScheme) => number;
|
|
29
|
+
/**
|
|
30
|
+
* Helper function to get the reshare config for client and server shares
|
|
31
|
+
* @param {ThresholdSignatureScheme} oldThresholdSignatureScheme - The current threshold signature scheme
|
|
32
|
+
* @param {ThresholdSignatureScheme} newThresholdSignatureScheme - The target threshold signature scheme
|
|
33
|
+
* @returns {{
|
|
34
|
+
* existingClientShareCount: number,
|
|
35
|
+
* newClientShareCount: number,
|
|
36
|
+
* existingServerShareCount: number,
|
|
37
|
+
* newServerShareCount: number
|
|
38
|
+
* }} The number of existing and new client and server shares needed
|
|
39
|
+
*/
|
|
40
|
+
export declare const getReshareConfig: ({ oldThresholdSignatureScheme, newThresholdSignatureScheme, }: {
|
|
41
|
+
oldThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
42
|
+
newThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
43
|
+
}) => {
|
|
44
|
+
existingClientShareCount: number;
|
|
45
|
+
newClientShareCount: number;
|
|
46
|
+
existingServerShareCount: number;
|
|
47
|
+
newServerShareCount: number;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Helper function to get the reshare config for client and server shares
|
|
51
|
+
* @param {ThresholdSignatureScheme} oldThresholdSignatureScheme - The current threshold signature scheme
|
|
52
|
+
* @param {ThresholdSignatureScheme} newThresholdSignatureScheme - The target threshold signature scheme
|
|
53
|
+
* @returns {{
|
|
54
|
+
* existingServerShareCount: number,
|
|
55
|
+
* newServerhareCount: number,
|
|
56
|
+
* existingDynamicServerShareCount: number,
|
|
57
|
+
* newDynamicServerShareCount: number
|
|
58
|
+
* }} The number of existing and new client and server shares needed
|
|
59
|
+
*/
|
|
60
|
+
export declare const getServerWalletReshareConfig: ({ oldThresholdSignatureScheme, newThresholdSignatureScheme, }: {
|
|
61
|
+
oldThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
62
|
+
newThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
63
|
+
}) => {
|
|
64
|
+
existingExternalServerShareCount: number;
|
|
65
|
+
newExternalServerShareCount: number;
|
|
66
|
+
existingDynamicServerShareCount: number;
|
|
67
|
+
newDynamicServerShareCount: number;
|
|
68
|
+
};
|
|
69
|
+
export declare const URL_PATTERNS: {
|
|
70
|
+
development: RegExp;
|
|
71
|
+
preprod: RegExp;
|
|
72
|
+
production: RegExp;
|
|
73
|
+
};
|
|
74
|
+
export declare function getEnvironmentFromUrl(url?: string): ENVIRONMENT_ENUM;
|
|
75
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/mpc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,EAExB,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,gBACnB,kBAAkB,KAC9B;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAQhE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,cAAe,MAAM,kBAAkB,aAAa;oBAhB7D,MAAM,EAAE;sBAAoB,gBAAgB;CA+BhE,CAAC;AAEF,eAAO,MAAM,YAAY,6BAA8B,wBAAwB;;;CAG9E,CAAC;AAEF,eAAO,MAAM,kBAAkB,6BAA8B,wBAAwB,WAEpF,CAAC;AAEF,eAAO,MAAM,yBAAyB,6BAA8B,wBAAwB,WAE3F,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,kEAG1B;IACD,2BAA2B,EAAE,wBAAwB,CAAC;IACtD,2BAA2B,EAAE,wBAAwB,CAAC;CACvD,KAAG;IACF,wBAAwB,EAAE,MAAM,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wBAAwB,EAAE,MAAM,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;CAsG7B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,kEAGtC;IACD,2BAA2B,EAAE,wBAAwB,CAAC;IACtD,2BAA2B,EAAE,wBAAwB,CAAC;CACvD,KAAG;IACF,gCAAgC,EAAE,MAAM,CAAC;IACzC,2BAA2B,EAAE,MAAM,CAAC;IACpC,+BAA+B,EAAE,MAAM,CAAC;IACxC,0BAA0B,EAAE,MAAM,CAAC;CAsGpC,CAAC;AAEF,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAWpE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AxiosError } from 'axios';
|
|
2
|
+
export declare class WalletApiError extends Error {
|
|
3
|
+
status: number;
|
|
4
|
+
constructor(status: number, message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare const isCloudflareRateLimitError: (error: AxiosError) => boolean;
|
|
7
|
+
export declare const handleAxiosError: (error: AxiosError, message: string, context: Record<string, unknown>, _logger?: unknown) => never;
|
|
8
|
+
export type { AxiosError } from 'axios';
|
|
9
|
+
export { isAxiosError } from 'axios';
|
|
10
|
+
//# sourceMappingURL=axiosErrorResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axiosErrorResponse.d.ts","sourceRoot":"","sources":["../../src/services/axiosErrorResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGxC,qBAAa,cAAe,SAAQ,KAAK;IACvC,MAAM,EAAE,MAAM,CAAC;gBAEH,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK5C;AAWD,eAAO,MAAM,0BAA0B,UAAW,UAAU,KAAG,OAG9D,CAAC;AAEF,eAAO,MAAM,gBAAgB,UACpB,UAAU,WACR,MAAM,WACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YACtB,OAAO,UAkBlB,CAAC;AAEF,YAAY,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ILogger } from '../types.js';
|
|
2
|
+
interface ILoggerStatic extends ILogger {
|
|
3
|
+
setContext(context: Record<string, unknown>): void;
|
|
4
|
+
resetContext(): void;
|
|
5
|
+
configure(logger: ILogger): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Global static logger for SDK-internal use.
|
|
9
|
+
*
|
|
10
|
+
* Call `Logger.configure(impl)` once at startup to wire in your logger.
|
|
11
|
+
* Call `Logger.setContext(ctx)` to attach metadata merged into every log call.
|
|
12
|
+
*
|
|
13
|
+
* Parses variadic args: any Error instance is extracted and passed as the
|
|
14
|
+
* third argument; all plain objects are merged into a single context object.
|
|
15
|
+
* This matches Datadog's (message, context?, error?) calling convention.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Logger: ILoggerStatic;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/services/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAEvD,UAAU,aAAc,SAAQ,OAAO;IACrC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACnD,YAAY,IAAI,IAAI,CAAC;IACrB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,aAmFpB,CAAC"}
|