@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/indexeddb.js
CHANGED
package/dist/memory.cjs
CHANGED
|
@@ -80,6 +80,9 @@ var import_ethers = require("ethers");
|
|
|
80
80
|
var import_contracts = require("@invisi-labs/protocol/contracts");
|
|
81
81
|
var import_address = require("@invisi-labs/core/address");
|
|
82
82
|
var getAddress = (value) => (0, import_ethers.getAddress)(value);
|
|
83
|
+
var erc1271Abi = [
|
|
84
|
+
"function isValidSignature(bytes32 hash, bytes signature) view returns (bytes4)"
|
|
85
|
+
];
|
|
83
86
|
function check(value, message) {
|
|
84
87
|
if (!value) {
|
|
85
88
|
throw new Error(message);
|
|
@@ -111,6 +114,28 @@ var EthersChainReader = class {
|
|
|
111
114
|
async getChainId() {
|
|
112
115
|
return (await this.client.getNetwork()).chainId;
|
|
113
116
|
}
|
|
117
|
+
async isValidRegistrationSignature(owner, digest, signature) {
|
|
118
|
+
try {
|
|
119
|
+
const result = await this.client.call({
|
|
120
|
+
to: getAddress(owner),
|
|
121
|
+
data: new import_ethers.Interface(erc1271Abi).encodeFunctionData("isValidSignature", [
|
|
122
|
+
digest,
|
|
123
|
+
signature
|
|
124
|
+
])
|
|
125
|
+
});
|
|
126
|
+
return result.length >= 66 && result.slice(0, 66).toLowerCase() === "0x1626ba7e" + "00".repeat(28);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if ((0, import_ethers.isError)(error, "CALL_EXCEPTION")) return false;
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async getProtocolAddressRegistry(address2) {
|
|
133
|
+
return getAddress(
|
|
134
|
+
await new import_ethers.Contract(getAddress(address2), import_contracts.invisiProtocolAbi, this.client).getFunction(
|
|
135
|
+
"addressRegistry"
|
|
136
|
+
)()
|
|
137
|
+
);
|
|
138
|
+
}
|
|
114
139
|
async getProtocolVersion(address2) {
|
|
115
140
|
return BigInt(
|
|
116
141
|
await new import_ethers.Contract(getAddress(address2), import_contracts.invisiProtocolAbi, this.client).getFunction(
|