@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/memory.js
CHANGED
package/dist/sqlite.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(
|