@0xsequence/replacer 1.1.0 → 1.1.2

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.
@@ -41,17 +41,17 @@ function eip5719Contract(address, provider) {
41
41
  // TODO: for some reason walletContracts is not being loaded from local
42
42
  // remove this code once fixed
43
43
  const abi = [{
44
- "inputs": [{
45
- "internalType": "bytes32",
46
- "type": "bytes32"
44
+ inputs: [{
45
+ internalType: 'bytes32',
46
+ type: 'bytes32'
47
47
  }],
48
- "name": "getAlternativeSignature",
49
- "outputs": [{
50
- "internalType": "string",
51
- "type": "string"
48
+ name: 'getAlternativeSignature',
49
+ outputs: [{
50
+ internalType: 'string',
51
+ type: 'string'
52
52
  }],
53
- "stateMutability": "view",
54
- "type": "function"
53
+ stateMutability: 'view',
54
+ type: 'function'
55
55
  }];
56
56
  return new ethers.ethers.Contract(address, abi, provider);
57
57
  }
@@ -41,17 +41,17 @@ function eip5719Contract(address, provider) {
41
41
  // TODO: for some reason walletContracts is not being loaded from local
42
42
  // remove this code once fixed
43
43
  const abi = [{
44
- "inputs": [{
45
- "internalType": "bytes32",
46
- "type": "bytes32"
44
+ inputs: [{
45
+ internalType: 'bytes32',
46
+ type: 'bytes32'
47
47
  }],
48
- "name": "getAlternativeSignature",
49
- "outputs": [{
50
- "internalType": "string",
51
- "type": "string"
48
+ name: 'getAlternativeSignature',
49
+ outputs: [{
50
+ internalType: 'string',
51
+ type: 'string'
52
52
  }],
53
- "stateMutability": "view",
54
- "type": "function"
53
+ stateMutability: 'view',
54
+ type: 'function'
55
55
  }];
56
56
  return new ethers.ethers.Contract(address, abi, provider);
57
57
  }
@@ -37,17 +37,17 @@ function eip5719Contract(address, provider) {
37
37
  // TODO: for some reason walletContracts is not being loaded from local
38
38
  // remove this code once fixed
39
39
  const abi = [{
40
- "inputs": [{
41
- "internalType": "bytes32",
42
- "type": "bytes32"
40
+ inputs: [{
41
+ internalType: 'bytes32',
42
+ type: 'bytes32'
43
43
  }],
44
- "name": "getAlternativeSignature",
45
- "outputs": [{
46
- "internalType": "string",
47
- "type": "string"
44
+ name: 'getAlternativeSignature',
45
+ outputs: [{
46
+ internalType: 'string',
47
+ type: 'string'
48
48
  }],
49
- "stateMutability": "view",
50
- "type": "function"
49
+ stateMutability: 'view',
50
+ type: 'function'
51
51
  }];
52
52
  return new ethers.Contract(address, abi, provider);
53
53
  }
@@ -1,4 +1,4 @@
1
- import { ethers } from "ethers";
1
+ import { ethers } from 'ethers';
2
2
  import { URISolver } from "./index.js";
3
3
  export declare class CachedEIP5719 {
4
4
  provider: ethers.providers.Provider;
@@ -1,4 +1,4 @@
1
- import { ethers } from "ethers";
1
+ import { ethers } from 'ethers';
2
2
  export * from "./cached.js";
3
3
  export declare function eip5719Contract(address: string, provider: ethers.providers.Provider): ethers.Contract;
4
4
  export declare function eip1271Contract(address: string, provider: ethers.providers.Provider): ethers.Contract;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/replacer",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "EIP-5719 client implementation",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/replacer",
6
6
  "source": "src/index.ts",
@@ -9,8 +9,8 @@
9
9
  "author": "Horizon Blockchain Games",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
- "@0xsequence/core": "1.1.0",
13
- "@0xsequence/abi": "1.1.0"
12
+ "@0xsequence/abi": "1.1.2",
13
+ "@0xsequence/core": "1.1.2"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "ethers": ">=5.5"
package/src/cached.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ethers } from "ethers";
2
- import { runByEIP5719, URISolver } from ".";
1
+ import { ethers } from 'ethers'
2
+ import { runByEIP5719, URISolver } from '.'
3
3
 
4
4
  export class CachedEIP5719 {
5
5
  constructor(
@@ -8,16 +8,15 @@ export class CachedEIP5719 {
8
8
  public window: number = 1000
9
9
  ) {}
10
10
 
11
- private pending: Map<string, {
12
- timestamp: number
13
- promise: Promise<ethers.BytesLike>
14
- }> = new Map()
11
+ private pending: Map<
12
+ string,
13
+ {
14
+ timestamp: number
15
+ promise: Promise<ethers.BytesLike>
16
+ }
17
+ > = new Map()
15
18
 
16
- async runByEIP5719(
17
- address: string,
18
- digest: ethers.BytesLike,
19
- signature: ethers.BytesLike
20
- ): Promise<ethers.BytesLike> {
19
+ async runByEIP5719(address: string, digest: ethers.BytesLike, signature: ethers.BytesLike): Promise<ethers.BytesLike> {
21
20
  const key = `${address}-${digest}-${signature}`
22
21
  const now = Date.now()
23
22
 
@@ -29,4 +28,4 @@ export class CachedEIP5719 {
29
28
  this.pending.set(key, { timestamp: now, promise })
30
29
  return promise
31
30
  }
32
- }
31
+ }
package/src/index.ts CHANGED
@@ -1,31 +1,30 @@
1
+ import { ethers } from 'ethers'
2
+ import { walletContracts } from '@0xsequence/abi'
3
+ import { isIPFS, useGateway } from './ipfs'
4
+ import { commons } from '@0xsequence/core'
1
5
 
2
- import { ethers } from "ethers"
3
- import { walletContracts } from "@0xsequence/abi"
4
- import { isIPFS, useGateway } from "./ipfs"
5
- import { commons } from "@0xsequence/core"
6
-
7
- export * from "./cached"
6
+ export * from './cached'
8
7
 
9
8
  export function eip5719Contract(address: string, provider: ethers.providers.Provider): ethers.Contract {
10
9
  // TODO: for some reason walletContracts is not being loaded from local
11
10
  // remove this code once fixed
12
11
  const abi = [
13
12
  {
14
- "inputs": [
13
+ inputs: [
15
14
  {
16
- "internalType": "bytes32",
17
- "type": "bytes32"
15
+ internalType: 'bytes32',
16
+ type: 'bytes32'
18
17
  }
19
18
  ],
20
- "name": "getAlternativeSignature",
21
- "outputs": [
19
+ name: 'getAlternativeSignature',
20
+ outputs: [
22
21
  {
23
- "internalType": "string",
24
- "type": "string"
22
+ internalType: 'string',
23
+ type: 'string'
25
24
  }
26
25
  ],
27
- "stateMutability": "view",
28
- "type": "function"
26
+ stateMutability: 'view',
27
+ type: 'function'
29
28
  }
30
29
  ]
31
30
 
package/src/ipfs.ts CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  export function useGateway(uri: string, gateway: string) {
3
2
  const clean = uri.replace('ipfs://ipfs/', '').replace('ipfs://', '')
4
3
  if (uri.startsWith('ipfs://')) return `${gateway}${clean}`