@invisi-labs/sdk 1.1.0 → 1.1.1
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/{chunk-NAEEEZMH.js → chunk-4HMM7ZKY.js} +24 -1
- package/dist/chunk-4HMM7ZKY.js.map +1 -0
- package/dist/{chunk-T246CYQ7.js → chunk-7TFLU2Z6.js} +2 -2
- package/dist/ethers.cjs +22 -0
- package/dist/ethers.cjs.map +1 -1
- package/dist/ethers.d.cts +2 -0
- package/dist/ethers.d.ts +2 -0
- package/dist/ethers.js +1 -1
- package/dist/index.cjs +22 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -2
- package/dist/indexeddb.cjs +25 -0
- package/dist/indexeddb.cjs.map +1 -1
- package/dist/indexeddb.js +2 -2
- package/dist/memory.cjs +25 -0
- package/dist/memory.cjs.map +1 -1
- package/dist/memory.js +2 -2
- package/dist/sqlite.cjs +25 -0
- package/dist/sqlite.cjs.map +1 -1
- package/dist/sqlite.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-NAEEEZMH.js.map +0 -1
- /package/dist/{chunk-T246CYQ7.js.map → chunk-7TFLU2Z6.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -24,11 +24,11 @@ declare class PreparedTransaction {
|
|
|
24
24
|
private constructor();
|
|
25
25
|
static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction;
|
|
26
26
|
get id(): string;
|
|
27
|
-
get kind(): "
|
|
27
|
+
get kind(): "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
28
28
|
estimateGas(): GasReference;
|
|
29
29
|
preview(): {
|
|
30
30
|
id: string;
|
|
31
|
-
kind: "
|
|
31
|
+
kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
32
32
|
status: OperationStatus;
|
|
33
33
|
context: {
|
|
34
34
|
tokenAddress: _invisi_labs_core.Address;
|
|
@@ -87,7 +87,7 @@ declare class PreparedTransaction {
|
|
|
87
87
|
toJSON(): {
|
|
88
88
|
transaction: boolean;
|
|
89
89
|
id: string;
|
|
90
|
-
kind: "
|
|
90
|
+
kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
91
91
|
status: OperationStatus;
|
|
92
92
|
};
|
|
93
93
|
}
|
|
@@ -185,7 +185,7 @@ declare class Operation {
|
|
|
185
185
|
estimateGas(): GasReference;
|
|
186
186
|
preview(): {
|
|
187
187
|
id: string;
|
|
188
|
-
kind: "
|
|
188
|
+
kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
189
189
|
status: OperationStatus;
|
|
190
190
|
context: {
|
|
191
191
|
tokenAddress: _invisi_labs_core.Address;
|
|
@@ -245,7 +245,7 @@ declare class Operation {
|
|
|
245
245
|
}): Promise<Operation>;
|
|
246
246
|
toJSON(): {
|
|
247
247
|
id: string;
|
|
248
|
-
kind: "
|
|
248
|
+
kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
249
249
|
status: OperationStatus;
|
|
250
250
|
};
|
|
251
251
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -24,11 +24,11 @@ declare class PreparedTransaction {
|
|
|
24
24
|
private constructor();
|
|
25
25
|
static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction;
|
|
26
26
|
get id(): string;
|
|
27
|
-
get kind(): "
|
|
27
|
+
get kind(): "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
28
28
|
estimateGas(): GasReference;
|
|
29
29
|
preview(): {
|
|
30
30
|
id: string;
|
|
31
|
-
kind: "
|
|
31
|
+
kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
32
32
|
status: OperationStatus;
|
|
33
33
|
context: {
|
|
34
34
|
tokenAddress: _invisi_labs_core.Address;
|
|
@@ -87,7 +87,7 @@ declare class PreparedTransaction {
|
|
|
87
87
|
toJSON(): {
|
|
88
88
|
transaction: boolean;
|
|
89
89
|
id: string;
|
|
90
|
-
kind: "
|
|
90
|
+
kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
91
91
|
status: OperationStatus;
|
|
92
92
|
};
|
|
93
93
|
}
|
|
@@ -185,7 +185,7 @@ declare class Operation {
|
|
|
185
185
|
estimateGas(): GasReference;
|
|
186
186
|
preview(): {
|
|
187
187
|
id: string;
|
|
188
|
-
kind: "
|
|
188
|
+
kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
189
189
|
status: OperationStatus;
|
|
190
190
|
context: {
|
|
191
191
|
tokenAddress: _invisi_labs_core.Address;
|
|
@@ -245,7 +245,7 @@ declare class Operation {
|
|
|
245
245
|
}): Promise<Operation>;
|
|
246
246
|
toJSON(): {
|
|
247
247
|
id: string;
|
|
248
|
-
kind: "
|
|
248
|
+
kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
249
249
|
status: OperationStatus;
|
|
250
250
|
};
|
|
251
251
|
}
|
package/dist/index.js
CHANGED
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
signOperationFunding,
|
|
20
20
|
statement,
|
|
21
21
|
walletBalance
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-7TFLU2Z6.js";
|
|
23
23
|
import {
|
|
24
24
|
EthersAddressResolver,
|
|
25
25
|
EthersChainReader,
|
|
26
26
|
EthersFundingSigner,
|
|
27
27
|
EthersFundingVerifier
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-4HMM7ZKY.js";
|
|
29
29
|
|
|
30
30
|
// src/explicit-preparation.ts
|
|
31
31
|
import { getAddress } from "ethers";
|
package/dist/indexeddb.cjs
CHANGED
|
@@ -30,6 +30,9 @@ var import_ethers = require("ethers");
|
|
|
30
30
|
var import_contracts = require("@invisi-labs/protocol/contracts");
|
|
31
31
|
var import_address = require("@invisi-labs/core/address");
|
|
32
32
|
var getAddress = (value) => (0, import_ethers.getAddress)(value);
|
|
33
|
+
var erc1271Abi = [
|
|
34
|
+
"function isValidSignature(bytes32 hash, bytes signature) view returns (bytes4)"
|
|
35
|
+
];
|
|
33
36
|
function check(value, message) {
|
|
34
37
|
if (!value) {
|
|
35
38
|
throw new Error(message);
|
|
@@ -61,6 +64,28 @@ var EthersChainReader = class {
|
|
|
61
64
|
async getChainId() {
|
|
62
65
|
return (await this.client.getNetwork()).chainId;
|
|
63
66
|
}
|
|
67
|
+
async isValidRegistrationSignature(owner, digest, signature) {
|
|
68
|
+
try {
|
|
69
|
+
const result = await this.client.call({
|
|
70
|
+
to: getAddress(owner),
|
|
71
|
+
data: new import_ethers.Interface(erc1271Abi).encodeFunctionData("isValidSignature", [
|
|
72
|
+
digest,
|
|
73
|
+
signature
|
|
74
|
+
])
|
|
75
|
+
});
|
|
76
|
+
return result.length >= 66 && result.slice(0, 66).toLowerCase() === "0x1626ba7e" + "00".repeat(28);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
if ((0, import_ethers.isError)(error, "CALL_EXCEPTION")) return false;
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async getProtocolAddressRegistry(address2) {
|
|
83
|
+
return getAddress(
|
|
84
|
+
await new import_ethers.Contract(getAddress(address2), import_contracts.invisiProtocolAbi, this.client).getFunction(
|
|
85
|
+
"addressRegistry"
|
|
86
|
+
)()
|
|
87
|
+
);
|
|
88
|
+
}
|
|
64
89
|
async getProtocolVersion(address2) {
|
|
65
90
|
return BigInt(
|
|
66
91
|
await new import_ethers.Contract(getAddress(address2), import_contracts.invisiProtocolAbi, this.client).getFunction(
|