@human-protocol/sdk 6.0.0 → 6.1.0
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/CHANGELOG.md +13 -0
- package/dist/base.d.ts +4 -2
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +14 -0
- package/dist/constants.d.ts +0 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +7 -8
- package/dist/escrow.d.ts +13 -13
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +17 -21
- package/dist/interfaces.d.ts +2 -2
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts +5 -5
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +3 -3
- package/dist/staking.d.ts +7 -7
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +5 -5
- package/dist/transaction.d.ts +2 -2
- package/dist/transaction.js +4 -4
- package/dist/types.d.ts +14 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -2
- package/package.json +2 -2
- package/src/base.ts +38 -2
- package/src/constants.ts +6 -8
- package/src/escrow.ts +123 -111
- package/src/interfaces.ts +2 -2
- package/src/kvstore.ts +22 -14
- package/src/staking.ts +42 -26
- package/src/transaction.ts +4 -4
- package/src/types.ts +16 -1
- package/src/utils.ts +2 -6
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TransactionLike } from 'ethers';
|
|
1
|
+
import { Overrides, TransactionLike } from 'ethers';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Enum for escrow statuses.
|
|
@@ -86,4 +86,19 @@ export type NetworkData = {
|
|
|
86
86
|
oldFactoryAddress: string;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Options that configure how long to wait for transaction confirmations.
|
|
91
|
+
*/
|
|
92
|
+
export type WaitOptions = {
|
|
93
|
+
/** Number of block confirmations to wait for. */
|
|
94
|
+
confirmations?: number;
|
|
95
|
+
/** Milliseconds to wait before aborting `tx.wait()`. */
|
|
96
|
+
timeoutMs?: number;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Extends ethers overrides with `wait()` options that control confirmation count and timeout.
|
|
101
|
+
*/
|
|
102
|
+
export type TransactionOverrides = Overrides & WaitOptions;
|
|
103
|
+
|
|
89
104
|
export type TransactionLikeWithNonce = TransactionLike & { nonce: number };
|
package/src/utils.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { ethers } from 'ethers';
|
|
|
3
3
|
import gqlFetch from 'graphql-request';
|
|
4
4
|
|
|
5
5
|
import { isURL } from 'validator';
|
|
6
|
-
import { SUBGRAPH_API_KEY_PLACEHOLDER } from './constants';
|
|
7
6
|
import { ChainId } from './enums';
|
|
8
7
|
import {
|
|
9
8
|
ContractExecutionError,
|
|
@@ -17,8 +16,8 @@ import {
|
|
|
17
16
|
TransactionReplaced,
|
|
18
17
|
WarnSubgraphApiKeyNotProvided,
|
|
19
18
|
} from './error';
|
|
20
|
-
import { NetworkData } from './types';
|
|
21
19
|
import { SubgraphOptions } from './interfaces';
|
|
20
|
+
import { NetworkData } from './types';
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* Handles and throws appropriate error types based on the Ethereum error.
|
|
@@ -88,10 +87,7 @@ export const isValidJson = (input: string): boolean => {
|
|
|
88
87
|
export const getSubgraphUrl = (networkData: NetworkData) => {
|
|
89
88
|
let subgraphUrl = networkData.subgraphUrl;
|
|
90
89
|
if (process.env.SUBGRAPH_API_KEY) {
|
|
91
|
-
subgraphUrl = networkData.subgraphUrlApiKey
|
|
92
|
-
SUBGRAPH_API_KEY_PLACEHOLDER,
|
|
93
|
-
process.env.SUBGRAPH_API_KEY
|
|
94
|
-
);
|
|
90
|
+
subgraphUrl = networkData.subgraphUrlApiKey;
|
|
95
91
|
} else if (networkData.chainId !== ChainId.LOCALHOST) {
|
|
96
92
|
// eslint-disable-next-line no-console
|
|
97
93
|
console.warn(WarnSubgraphApiKeyNotProvided);
|