@epoch-protocol/epoch-commons-sdk 0.1.19 → 0.1.20
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/data/epochgraphtestnet.json +5 -5
- package/dist/types/index.d.ts +5 -0
- package/package.json +1 -1
- package/dist/utils/witness-typestring-constants.d.ts +0 -18
- package/dist/utils/witness-typestring-constants.js +0 -31
- package/dist/utils/witness-typestring-parse.d.ts +0 -5
- package/dist/utils/witness-typestring-parse.js +0 -18
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"contractAddress": {
|
|
71
71
|
"Base": "0x2BB4FfD7E2c6D432b697554Efd77fA13bdbefd69",
|
|
72
72
|
"Mainnet": "0x2BB4FfD7E2c6D432b697554Efd77fA13bdbefd69",
|
|
73
|
-
"Miden": "
|
|
73
|
+
"Miden": "0x537c15a622074e91188aa894456c52",
|
|
74
74
|
"Optimism": "0x2BB4FfD7E2c6D432b697554Efd77fA13bdbefd69"
|
|
75
75
|
},
|
|
76
76
|
"decimals": 18,
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"Base": "0xc30f1Ce05d1434d484E9A47283aA925fc8A8699a",
|
|
84
84
|
"Mainnet": "0xc30f1Ce05d1434d484E9A47283aA925fc8A8699a",
|
|
85
85
|
"Optimism": "0xc30f1Ce05d1434d484E9A47283aA925fc8A8699a",
|
|
86
|
-
"Miden": "
|
|
86
|
+
"Miden": "0xd17976f0809a8191412f2a126625df"
|
|
87
87
|
},
|
|
88
88
|
"decimals": 18,
|
|
89
89
|
"decimalsByChain": {
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"contractAddress": {
|
|
95
95
|
"Base": "0xc04d2869665Be874881133943523723Be5782720",
|
|
96
96
|
"Mainnet": "0xc04d2869665Be874881133943523723Be5782720",
|
|
97
|
-
"Miden": "
|
|
97
|
+
"Miden": "0x6500ca8c2dd69e9147ab7eafad162c",
|
|
98
98
|
"Optimism": "0xc04d2869665Be874881133943523723Be5782720"
|
|
99
99
|
},
|
|
100
100
|
"decimals": 18,
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"Base": "0x7946dd86eE310D0aC16804A37787289Fa5b88A8A",
|
|
108
108
|
"Mainnet": "0x7946dd86eE310D0aC16804A37787289Fa5b88A8A",
|
|
109
109
|
"Optimism": "0x7946dd86eE310D0aC16804A37787289Fa5b88A8A",
|
|
110
|
-
"Miden": "
|
|
110
|
+
"Miden": "0x4a09f13153d9cd114c078bfb62a7ec"
|
|
111
111
|
},
|
|
112
112
|
"decimals": 18,
|
|
113
113
|
"decimalsByChain": {
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"Base": "0x9b2a2754a9182fD65360E23afCDf3BeFF51796E9",
|
|
120
120
|
"Mainnet": "0x9b2a2754a9182fD65360E23afCDf3BeFF51796E9",
|
|
121
121
|
"Optimism": "0x9b2a2754a9182fD65360E23afCDf3BeFF51796E9",
|
|
122
|
-
"Miden": "
|
|
122
|
+
"Miden": "0x5fd2e6fd17712c51404d09c2b847f7"
|
|
123
123
|
},
|
|
124
124
|
"decimals": 18,
|
|
125
125
|
"decimalsByChain": {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -279,6 +279,11 @@ export type QueuedTransactionForIntent = {
|
|
|
279
279
|
transactionHash: string | null;
|
|
280
280
|
/** EIP-7702 authorization list for relay txs (enable delegation). */
|
|
281
281
|
authorizationList?: Record<string, unknown>[];
|
|
282
|
+
/**
|
|
283
|
+
* Compact / Miden reservation keys so the queue worker can finalize those
|
|
284
|
+
* reservations on SUCCESS or FAILED.
|
|
285
|
+
*/
|
|
286
|
+
processedCompactKeys?: string[];
|
|
282
287
|
};
|
|
283
288
|
export type CompactDataForQueue = {
|
|
284
289
|
intentNonce: string;
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** Base Mandate fields shared by all Epoch intents (matches `getTaskData`). */
|
|
2
|
-
export declare const BASE_MANDATE_TYPESTRING = "address tokenIn,uint256 tokenInAmount,address tokenOut,uint256 minTokenOut,uint256 destinationChainId,bytes4 taskType,bytes32 protocolHashIdentifier,address recipient";
|
|
3
|
-
/** Miden → EVM cross-chain bridge witness suffix (canonical). */
|
|
4
|
-
export declare const MIDEN_TO_EVM_EXTRA_TYPESTRING = "string midenSourceAccount,string midenFaucetId,string midenNoteType,string midenNoteId";
|
|
5
|
-
/** EVM → Miden cross-chain bridge witness suffix (canonical). */
|
|
6
|
-
export declare const EVM_TO_MIDEN_EXTRA_TYPESTRING = "string midenRecipientAccount,string midenFaucetId";
|
|
7
|
-
export declare const MIDEN_TO_EVM_WITNESS_TYPESTRING = "address tokenIn,uint256 tokenInAmount,address tokenOut,uint256 minTokenOut,uint256 destinationChainId,bytes4 taskType,bytes32 protocolHashIdentifier,address recipient,string midenSourceAccount,string midenFaucetId,string midenNoteType,string midenNoteId";
|
|
8
|
-
export declare const EVM_TO_MIDEN_WITNESS_TYPESTRING = "address tokenIn,uint256 tokenInAmount,address tokenOut,uint256 minTokenOut,uint256 destinationChainId,bytes4 taskType,bytes32 protocolHashIdentifier,address recipient,string midenRecipientAccount,string midenFaucetId";
|
|
9
|
-
export declare const MIDEN_TO_EVM_FIELD_NAMES: string[];
|
|
10
|
-
export declare const EVM_TO_MIDEN_FIELD_NAMES: string[];
|
|
11
|
-
/** Union of all Miden bridge field names from the canonical extra typestrings. */
|
|
12
|
-
export declare const MIDEN_MARKER_FIELD_NAMES: string[];
|
|
13
|
-
/** Fields declared only on the Miden→EVM extra typestring. */
|
|
14
|
-
export declare const MIDEN_TO_EVM_ONLY_FIELD_NAMES: string[];
|
|
15
|
-
/** Fields declared only on the EVM→Miden extra typestring. */
|
|
16
|
-
export declare const EVM_TO_MIDEN_ONLY_FIELD_NAMES: string[];
|
|
17
|
-
export declare const MIDEN_SOURCE_ACCOUNT_FIELD_NAME: "midenSourceAccount";
|
|
18
|
-
export declare const MIDEN_RECIPIENT_ACCOUNT_FIELD_NAME: "midenRecipientAccount";
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { fieldNamesFromExtraTypestring } from "./witness-typestring-parse.js";
|
|
2
|
-
function uniqueFieldNames(typestrings) {
|
|
3
|
-
return [
|
|
4
|
-
...new Set(typestrings.flatMap((typestring) => fieldNamesFromExtraTypestring(typestring))),
|
|
5
|
-
];
|
|
6
|
-
}
|
|
7
|
-
function onlyInLeft(left, right) {
|
|
8
|
-
const rightSet = new Set(right);
|
|
9
|
-
return left.filter((name) => !rightSet.has(name));
|
|
10
|
-
}
|
|
11
|
-
/** Base Mandate fields shared by all Epoch intents (matches `getTaskData`). */
|
|
12
|
-
export const BASE_MANDATE_TYPESTRING = "address tokenIn,uint256 tokenInAmount,address tokenOut,uint256 minTokenOut,uint256 destinationChainId,bytes4 taskType,bytes32 protocolHashIdentifier,address recipient";
|
|
13
|
-
/** Miden → EVM cross-chain bridge witness suffix (canonical). */
|
|
14
|
-
export const MIDEN_TO_EVM_EXTRA_TYPESTRING = "string midenSourceAccount,string midenFaucetId,string midenNoteType,string midenNoteId";
|
|
15
|
-
/** EVM → Miden cross-chain bridge witness suffix (canonical). */
|
|
16
|
-
export const EVM_TO_MIDEN_EXTRA_TYPESTRING = "string midenRecipientAccount,string midenFaucetId";
|
|
17
|
-
export const MIDEN_TO_EVM_WITNESS_TYPESTRING = `${BASE_MANDATE_TYPESTRING},${MIDEN_TO_EVM_EXTRA_TYPESTRING}`;
|
|
18
|
-
export const EVM_TO_MIDEN_WITNESS_TYPESTRING = `${BASE_MANDATE_TYPESTRING},${EVM_TO_MIDEN_EXTRA_TYPESTRING}`;
|
|
19
|
-
export const MIDEN_TO_EVM_FIELD_NAMES = fieldNamesFromExtraTypestring(MIDEN_TO_EVM_EXTRA_TYPESTRING);
|
|
20
|
-
export const EVM_TO_MIDEN_FIELD_NAMES = fieldNamesFromExtraTypestring(EVM_TO_MIDEN_EXTRA_TYPESTRING);
|
|
21
|
-
/** Union of all Miden bridge field names from the canonical extra typestrings. */
|
|
22
|
-
export const MIDEN_MARKER_FIELD_NAMES = uniqueFieldNames([
|
|
23
|
-
MIDEN_TO_EVM_EXTRA_TYPESTRING,
|
|
24
|
-
EVM_TO_MIDEN_EXTRA_TYPESTRING,
|
|
25
|
-
]);
|
|
26
|
-
/** Fields declared only on the Miden→EVM extra typestring. */
|
|
27
|
-
export const MIDEN_TO_EVM_ONLY_FIELD_NAMES = onlyInLeft(MIDEN_TO_EVM_FIELD_NAMES, EVM_TO_MIDEN_FIELD_NAMES);
|
|
28
|
-
/** Fields declared only on the EVM→Miden extra typestring. */
|
|
29
|
-
export const EVM_TO_MIDEN_ONLY_FIELD_NAMES = onlyInLeft(EVM_TO_MIDEN_FIELD_NAMES, MIDEN_TO_EVM_FIELD_NAMES);
|
|
30
|
-
export const MIDEN_SOURCE_ACCOUNT_FIELD_NAME = MIDEN_TO_EVM_ONLY_FIELD_NAMES.find((name) => name === "midenSourceAccount");
|
|
31
|
-
export const MIDEN_RECIPIENT_ACCOUNT_FIELD_NAME = EVM_TO_MIDEN_ONLY_FIELD_NAMES.find((name) => name === "midenRecipientAccount");
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export function parseWitnessTypestringFields(witnessTypeString) {
|
|
2
|
-
return witnessTypeString
|
|
3
|
-
.split(",")
|
|
4
|
-
.map((field) => field.trim())
|
|
5
|
-
.filter(Boolean)
|
|
6
|
-
.map((field) => {
|
|
7
|
-
const tokens = field.split(/\s+/).filter(Boolean);
|
|
8
|
-
if (tokens.length < 2) {
|
|
9
|
-
throw new Error(`Invalid witness field "${field}" (expected "type name" in witnessTypeString)`);
|
|
10
|
-
}
|
|
11
|
-
const name = tokens[tokens.length - 1];
|
|
12
|
-
const type = tokens.slice(0, -1).join(" ");
|
|
13
|
-
return { type, name };
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
export function fieldNamesFromExtraTypestring(typestring) {
|
|
17
|
-
return parseWitnessTypestringFields(typestring).map((field) => field.name);
|
|
18
|
-
}
|