@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/indexeddb.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TransactionalWalletStore
3
- } from "./chunk-T246CYQ7.js";
4
- import "./chunk-NAEEEZMH.js";
3
+ } from "./chunk-7TFLU2Z6.js";
4
+ import "./chunk-4HMM7ZKY.js";
5
5
 
6
6
  // src/integrations/indexeddb.ts
7
7
  var IndexedDBAtomicRecords = class {
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(