@inco/js 0.5.2 → 0.6.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/cjs/advancedacl/session-key.js +2 -2
- package/dist/cjs/attestedcompute/attested-compute.js +7 -4
- package/dist/{esm/generated/abis/addTwo.d.ts → cjs/generated/abis/add-two.d.ts} +27 -0
- package/dist/cjs/generated/abis/add-two.js +67 -0
- package/dist/cjs/generated/abis/lightning-preview.d.ts +346 -293
- package/dist/cjs/generated/abis/lightning-preview.js +192 -214
- package/dist/cjs/generated/abis/lightning.d.ts +339 -5
- package/dist/cjs/generated/abis/lightning.js +266 -7
- package/dist/cjs/generated/abis/{TestElist.d.ts → test-elist.d.ts} +29 -12
- package/dist/cjs/generated/abis/test-elist.js +161 -0
- package/dist/cjs/generated/abis/verifier.d.ts +127 -72
- package/dist/cjs/generated/abis/verifier.js +98 -56
- package/dist/cjs/generated/lightning.d.ts +28 -7
- package/dist/cjs/generated/lightning.js +30 -8
- package/dist/cjs/generated/local-node.d.ts +4 -4
- package/dist/cjs/generated/local-node.js +4 -4
- package/dist/cjs/local/local-node.js +3 -7
- package/dist/cjs/retry.d.ts +2 -1
- package/dist/cjs/retry.js +4 -3
- package/dist/esm/advancedacl/session-key.js +3 -3
- package/dist/esm/attestedcompute/attested-compute.js +7 -4
- package/dist/{types/generated/abis/addTwo.d.ts → esm/generated/abis/add-two.d.ts} +27 -0
- package/dist/esm/generated/abis/add-two.js +64 -0
- package/dist/esm/generated/abis/lightning-preview.d.ts +346 -293
- package/dist/esm/generated/abis/lightning-preview.js +191 -213
- package/dist/esm/generated/abis/lightning.d.ts +339 -5
- package/dist/esm/generated/abis/lightning.js +265 -6
- package/dist/esm/generated/abis/{TestElist.d.ts → test-elist.d.ts} +29 -12
- package/dist/esm/generated/abis/test-elist.js +158 -0
- package/dist/esm/generated/abis/verifier.d.ts +127 -72
- package/dist/esm/generated/abis/verifier.js +98 -56
- package/dist/esm/generated/lightning.d.ts +28 -7
- package/dist/esm/generated/lightning.js +30 -8
- package/dist/esm/generated/local-node.d.ts +4 -4
- package/dist/esm/generated/local-node.js +4 -4
- package/dist/esm/local/local-node.js +3 -7
- package/dist/esm/retry.d.ts +2 -1
- package/dist/esm/retry.js +4 -3
- package/dist/{cjs/generated/abis/addTwo.d.ts → types/generated/abis/add-two.d.ts} +27 -0
- package/dist/types/generated/abis/lightning-preview.d.ts +346 -293
- package/dist/types/generated/abis/lightning.d.ts +339 -5
- package/dist/types/generated/abis/{TestElist.d.ts → test-elist.d.ts} +29 -12
- package/dist/types/generated/abis/verifier.d.ts +127 -72
- package/dist/types/generated/lightning.d.ts +28 -7
- package/dist/types/generated/local-node.d.ts +4 -4
- package/dist/types/retry.d.ts +2 -1
- package/package.json +2 -2
- package/dist/cjs/generated/abis/TestElist.js +0 -152
- package/dist/cjs/generated/abis/addTwo.js +0 -51
- package/dist/esm/generated/abis/TestElist.js +0 -149
- package/dist/esm/generated/abis/addTwo.js +0 -48
package/dist/esm/retry.d.ts
CHANGED
@@ -5,6 +5,7 @@ export type BackoffConfig = {
|
|
5
5
|
maxRetries: number;
|
6
6
|
baseDelayInMs: number;
|
7
7
|
backoffFactor: number;
|
8
|
+
errHandler?: (error: Error, attempt: number) => 'stop' | 'continue';
|
8
9
|
};
|
9
10
|
/**
|
10
11
|
* Helper function to implement exponential backoff retry logic.
|
@@ -12,4 +13,4 @@ export type BackoffConfig = {
|
|
12
13
|
* @param config - Optional backoff configuration
|
13
14
|
* @returns Promise that resolves with the result of the function
|
14
15
|
*/
|
15
|
-
export declare function retryWithBackoff<T>(fn: () => Promise<T>, { maxRetries, baseDelayInMs, backoffFactor, }?: Partial<BackoffConfig>): Promise<T>;
|
16
|
+
export declare function retryWithBackoff<T>(fn: () => Promise<T>, { maxRetries, baseDelayInMs, backoffFactor, errHandler, }?: Partial<BackoffConfig>): Promise<T>;
|
package/dist/esm/retry.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
* @param config - Optional backoff configuration
|
5
5
|
* @returns Promise that resolves with the result of the function
|
6
6
|
*/
|
7
|
-
export async function retryWithBackoff(fn, { maxRetries = 10, baseDelayInMs = 1000, backoffFactor = 1.5, } = {}) {
|
7
|
+
export async function retryWithBackoff(fn, { maxRetries = 10, baseDelayInMs = 1000, backoffFactor = 1.5, errHandler = () => 'continue', } = {}) {
|
8
8
|
let lastError;
|
9
9
|
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
10
10
|
try {
|
@@ -12,7 +12,8 @@ export async function retryWithBackoff(fn, { maxRetries = 10, baseDelayInMs = 10
|
|
12
12
|
}
|
13
13
|
catch (error) {
|
14
14
|
lastError = error;
|
15
|
-
if (attempt
|
15
|
+
if (errHandler(lastError, attempt) !== 'continue' ||
|
16
|
+
attempt === maxRetries - 1) {
|
16
17
|
break;
|
17
18
|
}
|
18
19
|
const delay = baseDelayInMs * Math.pow(backoffFactor, attempt);
|
@@ -22,4 +23,4 @@ export async function retryWithBackoff(fn, { maxRetries = 10, baseDelayInMs = 10
|
|
22
23
|
}
|
23
24
|
throw lastError;
|
24
25
|
}
|
25
|
-
//# sourceMappingURL=data:application/json;base64,
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV0cnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcmV0cnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBVUE7Ozs7O0dBS0c7QUFDSCxNQUFNLENBQUMsS0FBSyxVQUFVLGdCQUFnQixDQUNwQyxFQUFvQixFQUNwQixFQUNFLFVBQVUsR0FBRyxFQUFFLEVBQ2YsYUFBYSxHQUFHLElBQUksRUFDcEIsYUFBYSxHQUFHLEdBQUcsRUFDbkIsVUFBVSxHQUFHLEdBQUcsRUFBRSxDQUFDLFVBQVUsTUFDSCxFQUFFO0lBRTlCLElBQUksU0FBNEIsQ0FBQztJQUVqQyxLQUFLLElBQUksT0FBTyxHQUFHLENBQUMsRUFBRSxPQUFPLEdBQUcsVUFBVSxFQUFFLE9BQU8sRUFBRSxFQUFFLENBQUM7UUFDdEQsSUFBSSxDQUFDO1lBQ0gsT0FBTyxNQUFNLEVBQUUsRUFBRSxDQUFDO1FBQ3BCLENBQUM7UUFBQyxPQUFPLEtBQUssRUFBRSxDQUFDO1lBQ2YsU0FBUyxHQUFHLEtBQWMsQ0FBQztZQUMzQixJQUNFLFVBQVUsQ0FBQyxTQUFTLEVBQUUsT0FBTyxDQUFDLEtBQUssVUFBVTtnQkFDN0MsT0FBTyxLQUFLLFVBQVUsR0FBRyxDQUFDLEVBQzFCLENBQUM7Z0JBQ0QsTUFBTTtZQUNSLENBQUM7WUFDRCxNQUFNLEtBQUssR0FBRyxhQUFhLEdBQUcsSUFBSSxDQUFDLEdBQUcsQ0FBQyxhQUFhLEVBQUUsT0FBTyxDQUFDLENBQUM7WUFDL0QsTUFBTSxNQUFNLEdBQUcsS0FBSyxHQUFHLENBQUMsR0FBRyxHQUFHLElBQUksQ0FBQyxNQUFNLEVBQUUsR0FBRyxHQUFHLENBQUMsQ0FBQyxDQUFDLDBDQUEwQztZQUM5RixNQUFNLElBQUksT0FBTyxDQUFDLENBQUMsT0FBTyxFQUFFLEVBQUUsQ0FBQyxVQUFVLENBQUMsT0FBTyxFQUFFLE1BQU0sQ0FBQyxDQUFDLENBQUM7UUFDOUQsQ0FBQztJQUNILENBQUM7SUFFRCxNQUFNLFNBQVMsQ0FBQztBQUNsQixDQUFDIn0=
|
@@ -6,6 +6,9 @@ export declare const addTwoAbi: readonly [{
|
|
6
6
|
readonly type: "address";
|
7
7
|
}];
|
8
8
|
readonly stateMutability: "nonpayable";
|
9
|
+
}, {
|
10
|
+
readonly type: "receive";
|
11
|
+
readonly stateMutability: "payable";
|
9
12
|
}, {
|
10
13
|
readonly type: "function";
|
11
14
|
readonly inputs: readonly [{
|
@@ -51,6 +54,26 @@ export declare const addTwoAbi: readonly [{
|
|
51
54
|
readonly internalType: "euint256";
|
52
55
|
readonly type: "bytes32";
|
53
56
|
}];
|
57
|
+
readonly stateMutability: "payable";
|
58
|
+
}, {
|
59
|
+
readonly type: "function";
|
60
|
+
readonly inputs: readonly [];
|
61
|
+
readonly name: "getFee";
|
62
|
+
readonly outputs: readonly [{
|
63
|
+
readonly name: "";
|
64
|
+
readonly internalType: "uint256";
|
65
|
+
readonly type: "uint256";
|
66
|
+
}];
|
67
|
+
readonly stateMutability: "pure";
|
68
|
+
}, {
|
69
|
+
readonly type: "function";
|
70
|
+
readonly inputs: readonly [];
|
71
|
+
readonly name: "getTrue";
|
72
|
+
readonly outputs: readonly [{
|
73
|
+
readonly name: "";
|
74
|
+
readonly internalType: "ebool";
|
75
|
+
readonly type: "bytes32";
|
76
|
+
}];
|
54
77
|
readonly stateMutability: "nonpayable";
|
55
78
|
}, {
|
56
79
|
readonly type: "function";
|
@@ -62,4 +85,8 @@ export declare const addTwoAbi: readonly [{
|
|
62
85
|
readonly type: "uint256";
|
63
86
|
}];
|
64
87
|
readonly stateMutability: "view";
|
88
|
+
}, {
|
89
|
+
readonly type: "error";
|
90
|
+
readonly inputs: readonly [];
|
91
|
+
readonly name: "FeeNotPaid";
|
65
92
|
}];
|