@huuduynvc/permit2-sdk 1.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Uniswap Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # permit2-sdk
2
+
3
+ ## Local Development
4
+
5
+ ### Run Unit Tests
6
+ - `yarn test`
7
+
8
+ ### Run Forge tests
9
+ - `yarn build`
10
+ - `yarn interop`
11
+ - `(cd permit2 && forge build)`
12
+ - `forge test`
@@ -0,0 +1,36 @@
1
+ import { TypedDataDomain, TypedDataField } from '@ethersproject/abstract-signer';
2
+ import { BigNumberish } from '@ethersproject/bignumber';
3
+ export interface PermitDetails {
4
+ token: string;
5
+ amount: BigNumberish;
6
+ expiration: BigNumberish;
7
+ nonce: BigNumberish;
8
+ }
9
+ export interface PermitSingle {
10
+ details: PermitDetails;
11
+ spender: string;
12
+ sigDeadline: BigNumberish;
13
+ }
14
+ export interface PermitBatch {
15
+ details: PermitDetails[];
16
+ spender: string;
17
+ sigDeadline: BigNumberish;
18
+ }
19
+ export declare type PermitSingleData = {
20
+ domain: TypedDataDomain;
21
+ types: Record<string, TypedDataField[]>;
22
+ values: PermitSingle;
23
+ };
24
+ export declare type PermitBatchData = {
25
+ domain: TypedDataDomain;
26
+ types: Record<string, TypedDataField[]>;
27
+ values: PermitBatch;
28
+ };
29
+ export declare abstract class AllowanceTransfer {
30
+ /**
31
+ * Cannot be constructed.
32
+ */
33
+ private constructor();
34
+ static getPermitData(permit: PermitSingle | PermitBatch, permit2Address: string, chainId: number): PermitSingleData | PermitBatchData;
35
+ static hash(permit: PermitSingle | PermitBatch, permit2Address: string, chainId: number): string;
36
+ }
@@ -0,0 +1,13 @@
1
+ import { BigNumber } from '@ethersproject/bignumber';
2
+ export declare const PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
3
+ export declare function permit2Address(chainId?: number): string;
4
+ export declare const MaxUint48: BigNumber;
5
+ export declare const MaxUint160: BigNumber;
6
+ export declare const MaxUint256: BigNumber;
7
+ export declare const MaxAllowanceTransferAmount: BigNumber;
8
+ export declare const MaxAllowanceExpiration: BigNumber;
9
+ export declare const MaxOrderedNonce: BigNumber;
10
+ export declare const MaxSignatureTransferAmount: BigNumber;
11
+ export declare const MaxUnorderedNonce: BigNumber;
12
+ export declare const MaxSigDeadline: BigNumber;
13
+ export declare const InstantExpiration: BigNumber;
@@ -0,0 +1,7 @@
1
+ import { TypedDataDomain, TypedDataField } from '@ethersproject/abstract-signer';
2
+ export declare function permit2Domain(permit2Address: string, chainId: number): TypedDataDomain;
3
+ export declare type PermitData = {
4
+ domain: TypedDataDomain;
5
+ types: Record<string, TypedDataField[]>;
6
+ values: any;
7
+ };
@@ -0,0 +1,4 @@
1
+ export * from './allowanceTransfer';
2
+ export * from './signatureTransfer';
3
+ export * from './providers';
4
+ export * from './constants';
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+
2
+ 'use strict'
3
+
4
+ if (process.env.NODE_ENV === 'production') {
5
+ module.exports = require('./permit2-sdk.cjs.production.min.js')
6
+ } else {
7
+ module.exports = require('./permit2-sdk.cjs.development.js')
8
+ }