@talismn/balances 0.0.0-pr555-20230215165605 → 0.0.0-pr563-20230221193038
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
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
# @talismn/balances
|
2
2
|
|
3
|
-
## 0.0.0-
|
3
|
+
## 0.0.0-pr563-20230221193038
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 536eddb: fix: ported useDbCache related perf fixes to @talismn/balances-react
|
8
|
+
|
9
|
+
## 0.3.3
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- c651551c: build: move `@polkadot` dependencies to `peerDependencies`
|
14
|
+
- Updated dependencies [c651551c]
|
15
|
+
- @talismn/chain-connector@0.4.2
|
16
|
+
- @talismn/util@0.1.7
|
17
|
+
- @talismn/chain-connector-evm@0.4.2
|
18
|
+
- @talismn/chaindata-provider@0.4.2
|
19
|
+
- @talismn/token-rates@0.1.14
|
4
20
|
|
5
21
|
## 0.3.2
|
6
22
|
|
@@ -1,28 +1,46 @@
|
|
1
|
+
import { UnsignedTransaction } from "@substrate/txwrapper-core";
|
1
2
|
import { ChainConnector } from "@talismn/chain-connector";
|
2
3
|
import { ChainConnectorEvm } from "@talismn/chain-connector-evm";
|
3
4
|
import { ChainId, ChaindataProvider, IToken } from "@talismn/chaindata-provider";
|
5
|
+
import { ethers } from "ethers";
|
4
6
|
import { AddressesByToken, Balances, SubscriptionCallback, UnsubscribeFn } from "./types";
|
5
|
-
export interface BalanceModule<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig> extends BalanceModuleSubstrate<TModuleType, TTokenType, TChainMeta, TModuleConfig>, BalanceModuleEvm<TModuleType, TTokenType, TChainMeta, TModuleConfig> {
|
6
|
-
}
|
7
|
-
export declare const DefaultBalanceModule: <TModuleType extends string, TTokenType extends IToken, TChainMeta extends ExtendableChainMeta = undefined, TModuleConfig extends ExtendableModuleConfig = undefined>(type: TModuleType) => BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig>;
|
8
7
|
export type ExtendableTokenType = IToken;
|
9
8
|
export type ExtendableChainMeta = Record<string, unknown> | undefined;
|
10
9
|
export type DefaultChainMeta = undefined;
|
11
10
|
export type ExtendableModuleConfig = Record<string, unknown> | undefined;
|
12
11
|
export type DefaultModuleConfig = undefined;
|
13
|
-
|
12
|
+
export type BaseTransferParams = {
|
13
|
+
tokenId: string;
|
14
|
+
from: string;
|
15
|
+
to: string;
|
16
|
+
amount: string;
|
17
|
+
};
|
18
|
+
export type ExtendableTransferParams = BaseTransferParams | undefined;
|
19
|
+
export type DefaultTransferParams = undefined;
|
20
|
+
export type NewTransferParamsType<T extends Record<string, unknown>> = BaseTransferParams & T;
|
21
|
+
export type TransferTokenTx = {
|
22
|
+
type: "substrate";
|
23
|
+
tx: UnsignedTransaction;
|
24
|
+
} | {
|
25
|
+
type: "evm";
|
26
|
+
tx: ethers.providers.TransactionRequest;
|
27
|
+
};
|
28
|
+
export interface BalanceModule<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> extends BalanceModuleSubstrate<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTransferParams>, BalanceModuleEvm<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTransferParams> {
|
29
|
+
}
|
30
|
+
export declare const DefaultBalanceModule: <TModuleType extends string, TTokenType extends IToken, TChainMeta extends ExtendableChainMeta = undefined, TModuleConfig extends ExtendableModuleConfig = undefined, TTransferParams extends ExtendableTransferParams = undefined>(type: TModuleType) => BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTransferParams>;
|
31
|
+
interface BalanceModuleSubstrate<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> extends BalanceModuleCommon<TModuleType, TTokenType, TTransferParams> {
|
14
32
|
/** Pre-processes any substrate chain metadata required by this module ahead of time */
|
15
33
|
fetchSubstrateChainMeta(chainConnector: ChainConnector, chaindataProvider: ChaindataProvider, chainId: ChainId, moduleConfig: TModuleConfig | undefined): Promise<TChainMeta | null>;
|
16
34
|
/** Detects which tokens are available on a given substrate chain */
|
17
35
|
fetchSubstrateChainTokens(chainConnector: ChainConnector, chaindataProvider: ChaindataProvider, chainId: ChainId, chainMeta: TChainMeta, moduleConfig: TModuleConfig | undefined): Promise<Record<TTokenType["id"], TTokenType>>;
|
18
36
|
}
|
19
|
-
interface BalanceModuleEvm<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig> extends BalanceModuleCommon<TModuleType, TTokenType> {
|
37
|
+
interface BalanceModuleEvm<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams> extends BalanceModuleCommon<TModuleType, TTokenType, TTransferParams> {
|
20
38
|
/** Pre-processes any evm chain metadata required by this module ahead of time */
|
21
39
|
fetchEvmChainMeta(chainConnector: ChainConnectorEvm, chaindataProvider: ChaindataProvider, chainId: ChainId, moduleConfig: TModuleConfig | undefined): Promise<TChainMeta | null>;
|
22
40
|
/** Detects which tokens are available on a given evm chain */
|
23
41
|
fetchEvmChainTokens(chainConnector: ChainConnectorEvm, chaindataProvider: ChaindataProvider, chainId: ChainId, chainMeta: TChainMeta, moduleConfig: TModuleConfig | undefined): Promise<Record<TTokenType["id"], TTokenType>>;
|
24
42
|
}
|
25
|
-
interface BalanceModuleCommon<TModuleType extends string, TTokenType extends ExtendableTokenType> {
|
43
|
+
interface BalanceModuleCommon<TModuleType extends string, TTokenType extends ExtendableTokenType, TTransferParams extends ExtendableTransferParams> {
|
26
44
|
get type(): TModuleType;
|
27
45
|
/**
|
28
46
|
* Subscribe to balances for this module with optional filtering.
|
@@ -38,6 +56,10 @@ interface BalanceModuleCommon<TModuleType extends string, TTokenType extends Ext
|
|
38
56
|
substrate?: ChainConnector;
|
39
57
|
evm?: ChainConnectorEvm;
|
40
58
|
}, chaindataProvider: ChaindataProvider, addressesByToken: AddressesByToken<TTokenType>): Promise<Balances>;
|
59
|
+
transferToken(chainConnectors: {
|
60
|
+
substrate?: ChainConnector;
|
61
|
+
evm?: ChainConnectorEvm;
|
62
|
+
}, chaindataProvider: ChaindataProvider, transferParams: TTransferParams): Promise<TransferTokenTx | null>;
|
41
63
|
[x: string | number | symbol]: unknown;
|
42
64
|
}
|
43
65
|
export {};
|
@@ -2,17 +2,17 @@ import { TypeRegistry } from "@polkadot/types";
|
|
2
2
|
import { ChainConnector } from "@talismn/chain-connector";
|
3
3
|
import { ChainConnectorEvm } from "@talismn/chain-connector-evm";
|
4
4
|
import { ChaindataProvider } from "@talismn/chaindata-provider";
|
5
|
-
import { BalanceModule, DefaultChainMeta, DefaultModuleConfig, ExtendableChainMeta, ExtendableModuleConfig, ExtendableTokenType } from "./BalanceModule";
|
5
|
+
import { BalanceModule, DefaultChainMeta, DefaultModuleConfig, DefaultTransferParams, ExtendableChainMeta, ExtendableModuleConfig, ExtendableTokenType, ExtendableTransferParams } from "./BalanceModule";
|
6
6
|
import { AddressesByToken, Balance, Balances, SubscriptionCallback, UnsubscribeFn } from "./types";
|
7
7
|
/**
|
8
8
|
* Wraps a BalanceModule's fetch/subscribe methods with a single `balances` method.
|
9
9
|
* This `balances` method will subscribe if a callback parameter is provided, or otherwise fetch.
|
10
10
|
*/
|
11
|
-
export declare function balances<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig>(balanceModule: BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig>, chainConnectors: {
|
11
|
+
export declare function balances<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams>(balanceModule: BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTransferParams>, chainConnectors: {
|
12
12
|
substrate?: ChainConnector;
|
13
13
|
evm?: ChainConnectorEvm;
|
14
14
|
}, chaindataProvider: ChaindataProvider, addressesByToken: AddressesByToken<TTokenType>): Promise<Balances>;
|
15
|
-
export declare function balances<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig>(balanceModule: BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig>, chainConnectors: {
|
15
|
+
export declare function balances<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig, TTransferParams extends ExtendableTransferParams = DefaultTransferParams>(balanceModule: BalanceModule<TModuleType, TTokenType, TChainMeta, TModuleConfig, TTransferParams>, chainConnectors: {
|
16
16
|
substrate?: ChainConnector;
|
17
17
|
evm?: ChainConnectorEvm;
|
18
18
|
}, chaindataProvider: ChaindataProvider, addressesByToken: AddressesByToken<TTokenType>, callback: SubscriptionCallback<Balances>): Promise<UnsubscribeFn>;
|
@@ -41,6 +41,9 @@ const DefaultBalanceModule = type => ({
|
|
41
41
|
},
|
42
42
|
async fetchBalances() {
|
43
43
|
throw new Error("Balance fetching is not implemented in this module.");
|
44
|
+
},
|
45
|
+
async transferToken() {
|
46
|
+
throw new Error("Token transfers are not implemented in this module.");
|
44
47
|
}
|
45
48
|
});
|
46
49
|
|
@@ -71,7 +74,7 @@ const db = new TalismanBalancesDatabase();
|
|
71
74
|
|
72
75
|
var packageJson = {
|
73
76
|
name: "@talismn/balances",
|
74
|
-
version: "0.0.0-
|
77
|
+
version: "0.0.0-pr563-20230221193038",
|
75
78
|
author: "Talisman",
|
76
79
|
homepage: "https://talisman.xyz",
|
77
80
|
license: "UNLICENSED",
|
@@ -98,18 +101,18 @@ var packageJson = {
|
|
98
101
|
clean: "rm -rf dist && rm -rf .turbo rm -rf node_modules"
|
99
102
|
},
|
100
103
|
dependencies: {
|
101
|
-
"@polkadot/types": "9.10.5",
|
102
104
|
"@talismn/chain-connector": "workspace:^",
|
103
105
|
"@talismn/chain-connector-evm": "workspace:^",
|
104
106
|
"@talismn/chaindata-provider": "workspace:^",
|
105
107
|
"@talismn/token-rates": "workspace:^",
|
106
108
|
"@talismn/util": "workspace:^",
|
107
109
|
anylogger: "^1.0.11",
|
108
|
-
dexie: "^3.2.
|
110
|
+
dexie: "^3.2.3",
|
109
111
|
lodash: "^4.17.21",
|
110
112
|
"typescript-memoize": "^1.1.0"
|
111
113
|
},
|
112
114
|
devDependencies: {
|
115
|
+
"@polkadot/types": "^9.10.5",
|
113
116
|
"@talismn/eslint-config": "workspace:^",
|
114
117
|
"@talismn/tsconfig": "workspace:^",
|
115
118
|
"@types/jest": "^27.5.1",
|
@@ -118,6 +121,9 @@ var packageJson = {
|
|
118
121
|
"ts-jest": "^28.0.2",
|
119
122
|
typescript: "^4.6.4"
|
120
123
|
},
|
124
|
+
peerDependencies: {
|
125
|
+
"@polkadot/types": "9.x"
|
126
|
+
},
|
121
127
|
preconstruct: {
|
122
128
|
entrypoints: [
|
123
129
|
"index.ts",
|
@@ -41,6 +41,9 @@ const DefaultBalanceModule = type => ({
|
|
41
41
|
},
|
42
42
|
async fetchBalances() {
|
43
43
|
throw new Error("Balance fetching is not implemented in this module.");
|
44
|
+
},
|
45
|
+
async transferToken() {
|
46
|
+
throw new Error("Token transfers are not implemented in this module.");
|
44
47
|
}
|
45
48
|
});
|
46
49
|
|
@@ -71,7 +74,7 @@ const db = new TalismanBalancesDatabase();
|
|
71
74
|
|
72
75
|
var packageJson = {
|
73
76
|
name: "@talismn/balances",
|
74
|
-
version: "0.0.0-
|
77
|
+
version: "0.0.0-pr563-20230221193038",
|
75
78
|
author: "Talisman",
|
76
79
|
homepage: "https://talisman.xyz",
|
77
80
|
license: "UNLICENSED",
|
@@ -98,18 +101,18 @@ var packageJson = {
|
|
98
101
|
clean: "rm -rf dist && rm -rf .turbo rm -rf node_modules"
|
99
102
|
},
|
100
103
|
dependencies: {
|
101
|
-
"@polkadot/types": "9.10.5",
|
102
104
|
"@talismn/chain-connector": "workspace:^",
|
103
105
|
"@talismn/chain-connector-evm": "workspace:^",
|
104
106
|
"@talismn/chaindata-provider": "workspace:^",
|
105
107
|
"@talismn/token-rates": "workspace:^",
|
106
108
|
"@talismn/util": "workspace:^",
|
107
109
|
anylogger: "^1.0.11",
|
108
|
-
dexie: "^3.2.
|
110
|
+
dexie: "^3.2.3",
|
109
111
|
lodash: "^4.17.21",
|
110
112
|
"typescript-memoize": "^1.1.0"
|
111
113
|
},
|
112
114
|
devDependencies: {
|
115
|
+
"@polkadot/types": "^9.10.5",
|
113
116
|
"@talismn/eslint-config": "workspace:^",
|
114
117
|
"@talismn/tsconfig": "workspace:^",
|
115
118
|
"@types/jest": "^27.5.1",
|
@@ -118,6 +121,9 @@ var packageJson = {
|
|
118
121
|
"ts-jest": "^28.0.2",
|
119
122
|
typescript: "^4.6.4"
|
120
123
|
},
|
124
|
+
peerDependencies: {
|
125
|
+
"@polkadot/types": "9.x"
|
126
|
+
},
|
121
127
|
preconstruct: {
|
122
128
|
entrypoints: [
|
123
129
|
"index.ts",
|
@@ -32,6 +32,9 @@ const DefaultBalanceModule = type => ({
|
|
32
32
|
},
|
33
33
|
async fetchBalances() {
|
34
34
|
throw new Error("Balance fetching is not implemented in this module.");
|
35
|
+
},
|
36
|
+
async transferToken() {
|
37
|
+
throw new Error("Token transfers are not implemented in this module.");
|
35
38
|
}
|
36
39
|
});
|
37
40
|
|
@@ -62,7 +65,7 @@ const db = new TalismanBalancesDatabase();
|
|
62
65
|
|
63
66
|
var packageJson = {
|
64
67
|
name: "@talismn/balances",
|
65
|
-
version: "0.0.0-
|
68
|
+
version: "0.0.0-pr563-20230221193038",
|
66
69
|
author: "Talisman",
|
67
70
|
homepage: "https://talisman.xyz",
|
68
71
|
license: "UNLICENSED",
|
@@ -89,18 +92,18 @@ var packageJson = {
|
|
89
92
|
clean: "rm -rf dist && rm -rf .turbo rm -rf node_modules"
|
90
93
|
},
|
91
94
|
dependencies: {
|
92
|
-
"@polkadot/types": "9.10.5",
|
93
95
|
"@talismn/chain-connector": "workspace:^",
|
94
96
|
"@talismn/chain-connector-evm": "workspace:^",
|
95
97
|
"@talismn/chaindata-provider": "workspace:^",
|
96
98
|
"@talismn/token-rates": "workspace:^",
|
97
99
|
"@talismn/util": "workspace:^",
|
98
100
|
anylogger: "^1.0.11",
|
99
|
-
dexie: "^3.2.
|
101
|
+
dexie: "^3.2.3",
|
100
102
|
lodash: "^4.17.21",
|
101
103
|
"typescript-memoize": "^1.1.0"
|
102
104
|
},
|
103
105
|
devDependencies: {
|
106
|
+
"@polkadot/types": "^9.10.5",
|
104
107
|
"@talismn/eslint-config": "workspace:^",
|
105
108
|
"@talismn/tsconfig": "workspace:^",
|
106
109
|
"@types/jest": "^27.5.1",
|
@@ -109,6 +112,9 @@ var packageJson = {
|
|
109
112
|
"ts-jest": "^28.0.2",
|
110
113
|
typescript: "^4.6.4"
|
111
114
|
},
|
115
|
+
peerDependencies: {
|
116
|
+
"@polkadot/types": "9.x"
|
117
|
+
},
|
112
118
|
preconstruct: {
|
113
119
|
entrypoints: [
|
114
120
|
"index.ts",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@talismn/balances",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-pr563-20230221193038",
|
4
4
|
"author": "Talisman",
|
5
5
|
"homepage": "https://talisman.xyz",
|
6
6
|
"license": "UNLICENSED",
|
@@ -27,18 +27,18 @@
|
|
27
27
|
"clean": "rm -rf dist && rm -rf .turbo rm -rf node_modules"
|
28
28
|
},
|
29
29
|
"dependencies": {
|
30
|
-
"@
|
31
|
-
"@talismn/chain-connector": "^0.4.
|
32
|
-
"@talismn/
|
33
|
-
"@talismn/
|
34
|
-
"@talismn/
|
35
|
-
"@talismn/util": "^0.1.6",
|
30
|
+
"@talismn/chain-connector": "^0.4.2",
|
31
|
+
"@talismn/chain-connector-evm": "^0.4.2",
|
32
|
+
"@talismn/chaindata-provider": "^0.4.2",
|
33
|
+
"@talismn/token-rates": "^0.1.14",
|
34
|
+
"@talismn/util": "^0.1.7",
|
36
35
|
"anylogger": "^1.0.11",
|
37
|
-
"dexie": "^3.2.
|
36
|
+
"dexie": "^3.2.3",
|
38
37
|
"lodash": "^4.17.21",
|
39
38
|
"typescript-memoize": "^1.1.0"
|
40
39
|
},
|
41
40
|
"devDependencies": {
|
41
|
+
"@polkadot/types": "^9.10.5",
|
42
42
|
"@talismn/eslint-config": "^0.0.1",
|
43
43
|
"@talismn/tsconfig": "^0.0.2",
|
44
44
|
"@types/jest": "^27.5.1",
|
@@ -47,6 +47,9 @@
|
|
47
47
|
"ts-jest": "^28.0.2",
|
48
48
|
"typescript": "^4.6.4"
|
49
49
|
},
|
50
|
+
"peerDependencies": {
|
51
|
+
"@polkadot/types": "9.x"
|
52
|
+
},
|
50
53
|
"preconstruct": {
|
51
54
|
"entrypoints": [
|
52
55
|
"index.ts",
|