@ledgerhq/types-live 6.22.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/LICENSE +202 -0
- package/README.md +743 -0
- package/lib/account.d.ts +198 -0
- package/lib/account.d.ts.map +1 -0
- package/lib/account.js +3 -0
- package/lib/account.js.map +1 -0
- package/lib/bridge.d.ts +91 -0
- package/lib/bridge.d.ts.map +1 -0
- package/lib/bridge.js +3 -0
- package/lib/bridge.js.map +1 -0
- package/lib/derivation.d.ts +5 -0
- package/lib/derivation.d.ts.map +1 -0
- package/lib/derivation.js +3 -0
- package/lib/derivation.js.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/lib/nft.d.ts +44 -0
- package/lib/nft.d.ts.map +1 -0
- package/lib/nft.js +3 -0
- package/lib/nft.js.map +1 -0
- package/lib/operation.d.ts +59 -0
- package/lib/operation.d.ts.map +1 -0
- package/lib/operation.js +3 -0
- package/lib/operation.js.map +1 -0
- package/lib/pagination.d.ts +18 -0
- package/lib/pagination.d.ts.map +1 -0
- package/lib/pagination.js +3 -0
- package/lib/pagination.js.map +1 -0
- package/lib/portfolio.d.ts +98 -0
- package/lib/portfolio.d.ts.map +1 -0
- package/lib/portfolio.js +3 -0
- package/lib/portfolio.js.map +1 -0
- package/lib/swap.d.ts +28 -0
- package/lib/swap.d.ts.map +1 -0
- package/lib/swap.js +3 -0
- package/lib/swap.js.map +1 -0
- package/lib/transaction.d.ts +157 -0
- package/lib/transaction.d.ts.map +1 -0
- package/lib/transaction.js +3 -0
- package/lib/transaction.js.map +1 -0
- package/lib-es/account.d.ts +198 -0
- package/lib-es/account.d.ts.map +1 -0
- package/lib-es/account.js +2 -0
- package/lib-es/account.js.map +1 -0
- package/lib-es/bridge.d.ts +91 -0
- package/lib-es/bridge.d.ts.map +1 -0
- package/lib-es/bridge.js +2 -0
- package/lib-es/bridge.js.map +1 -0
- package/lib-es/derivation.d.ts +5 -0
- package/lib-es/derivation.d.ts.map +1 -0
- package/lib-es/derivation.js +2 -0
- package/lib-es/derivation.js.map +1 -0
- package/lib-es/index.d.ts +9 -0
- package/lib-es/index.d.ts.map +1 -0
- package/lib-es/index.js +9 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/nft.d.ts +44 -0
- package/lib-es/nft.d.ts.map +1 -0
- package/lib-es/nft.js +2 -0
- package/lib-es/nft.js.map +1 -0
- package/lib-es/operation.d.ts +59 -0
- package/lib-es/operation.d.ts.map +1 -0
- package/lib-es/operation.js +2 -0
- package/lib-es/operation.js.map +1 -0
- package/lib-es/pagination.d.ts +18 -0
- package/lib-es/pagination.d.ts.map +1 -0
- package/lib-es/pagination.js +2 -0
- package/lib-es/pagination.js.map +1 -0
- package/lib-es/portfolio.d.ts +98 -0
- package/lib-es/portfolio.d.ts.map +1 -0
- package/lib-es/portfolio.js +2 -0
- package/lib-es/portfolio.js.map +1 -0
- package/lib-es/swap.d.ts +28 -0
- package/lib-es/swap.d.ts.map +1 -0
- package/lib-es/swap.js +2 -0
- package/lib-es/swap.js.map +1 -0
- package/lib-es/transaction.d.ts +157 -0
- package/lib-es/transaction.d.ts.map +1 -0
- package/lib-es/transaction.js +2 -0
- package/lib-es/transaction.js.map +1 -0
- package/package.json +35 -0
- package/src/account.ts +295 -0
- package/src/bridge.ts +149 -0
- package/src/derivation.ts +4 -0
- package/src/index.ts +8 -0
- package/src/nft.ts +53 -0
- package/src/operation.ts +130 -0
- package/src/pagination.ts +21 -0
- package/src/portfolio.ts +118 -0
- package/src/swap.ts +29 -0
- package/src/transaction.ts +188 -0
- package/tsconfig.json +7 -0
package/lib/account.d.ts
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { BigNumber } from "bignumber.js";
|
|
2
|
+
import type { CryptoCurrency, TokenCurrency, Unit } from "@ledgerhq/types-cryptoassets";
|
|
3
|
+
import type { OperationRaw, Operation } from "./operation";
|
|
4
|
+
import type { DerivationMode } from "./derivation";
|
|
5
|
+
import type { SwapOperation, SwapOperationRaw } from "./swap";
|
|
6
|
+
import type { NFT, NFTRaw } from "./nft";
|
|
7
|
+
export declare type GranularityId = "HOUR" | "DAY" | "WEEK";
|
|
8
|
+
export declare type BalanceHistoryCache = Record<GranularityId, BalanceHistoryDataCache>;
|
|
9
|
+
export declare type BalanceHistoryDataCache = {
|
|
10
|
+
latestDate: number | null | undefined;
|
|
11
|
+
balances: number[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A token belongs to an Account and share the parent account address
|
|
15
|
+
*/
|
|
16
|
+
export declare type TokenAccount = {
|
|
17
|
+
type: "TokenAccount";
|
|
18
|
+
id: string;
|
|
19
|
+
parentId: string;
|
|
20
|
+
token: TokenCurrency;
|
|
21
|
+
balance: BigNumber;
|
|
22
|
+
spendableBalance: BigNumber;
|
|
23
|
+
compoundBalance?: BigNumber;
|
|
24
|
+
creationDate: Date;
|
|
25
|
+
operationsCount: number;
|
|
26
|
+
operations: Operation[];
|
|
27
|
+
pendingOperations: Operation[];
|
|
28
|
+
starred: boolean;
|
|
29
|
+
balanceHistoryCache: BalanceHistoryCache;
|
|
30
|
+
swapHistory: SwapOperation[];
|
|
31
|
+
approvals?: Array<{
|
|
32
|
+
sender: string;
|
|
33
|
+
value: string;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A child account belongs to an Account but has its own address.
|
|
38
|
+
*/
|
|
39
|
+
export declare type ChildAccount = {
|
|
40
|
+
type: "ChildAccount";
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
starred: boolean;
|
|
44
|
+
parentId: string;
|
|
45
|
+
currency: CryptoCurrency;
|
|
46
|
+
address: string;
|
|
47
|
+
balance: BigNumber;
|
|
48
|
+
creationDate: Date;
|
|
49
|
+
operationsCount: number;
|
|
50
|
+
operations: Operation[];
|
|
51
|
+
pendingOperations: Operation[];
|
|
52
|
+
balanceHistoryCache: BalanceHistoryCache;
|
|
53
|
+
swapHistory: SwapOperation[];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
export declare type Address = {
|
|
59
|
+
address: string;
|
|
60
|
+
derivationPath: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Account type is the main level account of a blockchain currency.
|
|
64
|
+
* Each family maybe need an extra field, to solve this, you can have some subtyping like this:
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
export type BitcoinAccount = Account & { bitcoinResources: BitcoinResources }
|
|
68
|
+
|
|
69
|
+
and all parts where we would need it, we would need to cast,
|
|
70
|
+
|
|
71
|
+
const bitcoinAccount = account as BitcoinAccount;
|
|
72
|
+
|
|
73
|
+
and that BitcoinAccount type would be part of a coin integration family specific indeed.
|
|
74
|
+
*/
|
|
75
|
+
export declare type Account = {
|
|
76
|
+
type: "Account";
|
|
77
|
+
id: string;
|
|
78
|
+
seedIdentifier: string;
|
|
79
|
+
xpub?: string;
|
|
80
|
+
derivationMode: DerivationMode;
|
|
81
|
+
index: number;
|
|
82
|
+
freshAddress: string;
|
|
83
|
+
freshAddressPath: string;
|
|
84
|
+
freshAddresses: Address[];
|
|
85
|
+
name: string;
|
|
86
|
+
starred: boolean;
|
|
87
|
+
used: boolean;
|
|
88
|
+
balance: BigNumber;
|
|
89
|
+
spendableBalance: BigNumber;
|
|
90
|
+
creationDate: Date;
|
|
91
|
+
blockHeight: number;
|
|
92
|
+
currency: CryptoCurrency;
|
|
93
|
+
unit: Unit;
|
|
94
|
+
operationsCount: number;
|
|
95
|
+
operations: Operation[];
|
|
96
|
+
pendingOperations: Operation[];
|
|
97
|
+
lastSyncDate: Date;
|
|
98
|
+
subAccounts?: SubAccount[];
|
|
99
|
+
balanceHistoryCache: BalanceHistoryCache;
|
|
100
|
+
swapHistory: SwapOperation[];
|
|
101
|
+
syncHash?: string;
|
|
102
|
+
nfts?: NFT[];
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* super type that is either a token or a child account
|
|
106
|
+
*/
|
|
107
|
+
export declare type SubAccount = TokenAccount | ChildAccount;
|
|
108
|
+
/**
|
|
109
|
+
* One of the Account type
|
|
110
|
+
*/
|
|
111
|
+
export declare type AccountLike = Account | SubAccount;
|
|
112
|
+
/**
|
|
113
|
+
* an array of AccountLikes
|
|
114
|
+
*/
|
|
115
|
+
export declare type AccountLikeArray = AccountLike[] | TokenAccount[] | ChildAccount[] | Account[];
|
|
116
|
+
/**
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
119
|
+
export declare type TokenAccountRaw = {
|
|
120
|
+
type: "TokenAccountRaw";
|
|
121
|
+
id: string;
|
|
122
|
+
starred?: boolean;
|
|
123
|
+
parentId: string;
|
|
124
|
+
tokenId: string;
|
|
125
|
+
creationDate?: string;
|
|
126
|
+
operationsCount?: number;
|
|
127
|
+
operations: OperationRaw[];
|
|
128
|
+
pendingOperations: OperationRaw[];
|
|
129
|
+
balance: string;
|
|
130
|
+
spendableBalance?: string;
|
|
131
|
+
compoundBalance?: string;
|
|
132
|
+
balanceHistoryCache?: BalanceHistoryCache;
|
|
133
|
+
swapHistory?: SwapOperationRaw[];
|
|
134
|
+
approvals?: Array<{
|
|
135
|
+
sender: string;
|
|
136
|
+
value: string;
|
|
137
|
+
}>;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
*/
|
|
142
|
+
export declare type ChildAccountRaw = {
|
|
143
|
+
type: "ChildAccountRaw";
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
starred?: boolean;
|
|
147
|
+
parentId: string;
|
|
148
|
+
currencyId: string;
|
|
149
|
+
address: string;
|
|
150
|
+
creationDate?: string;
|
|
151
|
+
operationsCount?: number;
|
|
152
|
+
operations: OperationRaw[];
|
|
153
|
+
pendingOperations: OperationRaw[];
|
|
154
|
+
balance: string;
|
|
155
|
+
balanceHistoryCache?: BalanceHistoryCache;
|
|
156
|
+
swapHistory?: SwapOperationRaw[];
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
161
|
+
export declare type AccountRaw = {
|
|
162
|
+
id: string;
|
|
163
|
+
seedIdentifier: string;
|
|
164
|
+
xpub?: string;
|
|
165
|
+
derivationMode: DerivationMode;
|
|
166
|
+
index: number;
|
|
167
|
+
freshAddress: string;
|
|
168
|
+
freshAddressPath: string;
|
|
169
|
+
freshAddresses: Address[];
|
|
170
|
+
name: string;
|
|
171
|
+
starred?: boolean;
|
|
172
|
+
used?: boolean;
|
|
173
|
+
balance: string;
|
|
174
|
+
spendableBalance?: string;
|
|
175
|
+
blockHeight: number;
|
|
176
|
+
creationDate?: string;
|
|
177
|
+
operationsCount?: number;
|
|
178
|
+
currencyId: string;
|
|
179
|
+
operations: OperationRaw[];
|
|
180
|
+
pendingOperations: OperationRaw[];
|
|
181
|
+
unitMagnitude: number;
|
|
182
|
+
lastSyncDate: string;
|
|
183
|
+
endpointConfig?: string | null | undefined;
|
|
184
|
+
subAccounts?: SubAccountRaw[];
|
|
185
|
+
balanceHistoryCache?: BalanceHistoryCache;
|
|
186
|
+
swapHistory?: SwapOperationRaw[];
|
|
187
|
+
syncHash?: string;
|
|
188
|
+
nfts?: NFTRaw[];
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
*
|
|
192
|
+
*/
|
|
193
|
+
export declare type SubAccountRaw = TokenAccountRaw | ChildAccountRaw;
|
|
194
|
+
/**
|
|
195
|
+
*
|
|
196
|
+
*/
|
|
197
|
+
export declare type AccountRawLike = AccountRaw | SubAccountRaw;
|
|
198
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,E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,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAC9B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AACF;;GAEG;AACH,oBAAY,aAAa,GAAG,eAAe,GAAG,eAAe,CAAC;AAC9D;;GAEG;AACH,oBAAY,cAAc,GAAG,UAAU,GAAG,aAAa,CAAC"}
|
package/lib/account.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":""}
|
package/lib/bridge.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
import type { Observable } from "rxjs";
|
|
3
|
+
import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
|
+
import type { AccountLike, Account, AccountRaw } from "./account";
|
|
5
|
+
import type { TransactionStatus, SignOperationEvent, SignedOperation } from "./transaction";
|
|
6
|
+
import type { Operation } from "./operation";
|
|
7
|
+
import type { DerivationMode } from "./derivation";
|
|
8
|
+
import type { SyncConfig } from "./pagination";
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export declare type ScanAccountEvent = {
|
|
13
|
+
type: "discovered";
|
|
14
|
+
account: Account;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* more events will come in the future
|
|
18
|
+
*/
|
|
19
|
+
export declare type ScanAccountEventRaw = {
|
|
20
|
+
type: "discovered";
|
|
21
|
+
account: AccountRaw;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* unique identifier of a device. it will depends on the underlying implementation.
|
|
25
|
+
*/
|
|
26
|
+
export declare type DeviceId = string;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export declare type PreloadStrategy = Partial<{
|
|
31
|
+
preloadMaxAge: number;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
export declare type BroadcastArg0 = {
|
|
37
|
+
account: Account;
|
|
38
|
+
signedOperation: SignedOperation;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
export declare type SignOperationArg0<T> = {
|
|
44
|
+
account: Account;
|
|
45
|
+
transaction: T;
|
|
46
|
+
deviceId: DeviceId;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
export declare type SignOperationFnSignature<T> = (arg0: SignOperationArg0<T>) => Observable<SignOperationEvent>;
|
|
52
|
+
export declare type BroadcastFnSignature = (arg0: BroadcastArg0) => Promise<Operation>;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
56
|
+
export interface CurrencyBridge {
|
|
57
|
+
preload(currency: CryptoCurrency): Promise<Record<string, any>>;
|
|
58
|
+
hydrate(data: unknown, currency: CryptoCurrency): void;
|
|
59
|
+
scanAccounts(arg0: {
|
|
60
|
+
currency: CryptoCurrency;
|
|
61
|
+
deviceId: DeviceId;
|
|
62
|
+
scheme?: DerivationMode | null | undefined;
|
|
63
|
+
syncConfig: SyncConfig;
|
|
64
|
+
preferredNewAccountScheme?: DerivationMode;
|
|
65
|
+
}): Observable<ScanAccountEvent>;
|
|
66
|
+
getPreloadStrategy?: (currency: CryptoCurrency) => PreloadStrategy;
|
|
67
|
+
}
|
|
68
|
+
export interface AccountBridge<T> {
|
|
69
|
+
sync(initialAccount: Account, syncConfig: SyncConfig): Observable<(arg0: Account) => Account>;
|
|
70
|
+
receive(account: Account, arg1: {
|
|
71
|
+
verify?: boolean;
|
|
72
|
+
deviceId: string;
|
|
73
|
+
subAccountId?: string;
|
|
74
|
+
freshAddressIndex?: number;
|
|
75
|
+
}): Observable<{
|
|
76
|
+
address: string;
|
|
77
|
+
path: string;
|
|
78
|
+
}>;
|
|
79
|
+
createTransaction(account: Account): T;
|
|
80
|
+
updateTransaction(t: T, patch: Partial<T>): T;
|
|
81
|
+
prepareTransaction(account: Account, transaction: T): Promise<T>;
|
|
82
|
+
getTransactionStatus(account: Account, transaction: T): Promise<TransactionStatus>;
|
|
83
|
+
estimateMaxSpendable(arg0: {
|
|
84
|
+
account: AccountLike;
|
|
85
|
+
parentAccount?: Account | null | undefined;
|
|
86
|
+
transaction?: T | null | undefined;
|
|
87
|
+
}): Promise<BigNumber>;
|
|
88
|
+
signOperation: SignOperationFnSignature<T>;
|
|
89
|
+
broadcast: BroadcastFnSignature;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,YAAY,CAAC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AAS,EAAE,oBAAoB,CAAC;CACjC"}
|
package/lib/bridge.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivation.d.ts","sourceRoot":"","sources":["../src/derivation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,cAAc,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivation.js","sourceRoot":"","sources":["../src/derivation.ts"],"names":[],"mappings":""}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./derivation";
|
|
2
|
+
export * from "./account";
|
|
3
|
+
export * from "./operation";
|
|
4
|
+
export * from "./portfolio";
|
|
5
|
+
export * from "./transaction";
|
|
6
|
+
export * from "./bridge";
|
|
7
|
+
export * from "./pagination";
|
|
8
|
+
export * from "./nft";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
exports.__esModule = true;
|
|
13
|
+
__exportStar(require("./derivation"), exports);
|
|
14
|
+
__exportStar(require("./account"), exports);
|
|
15
|
+
__exportStar(require("./operation"), exports);
|
|
16
|
+
__exportStar(require("./portfolio"), exports);
|
|
17
|
+
__exportStar(require("./transaction"), exports);
|
|
18
|
+
__exportStar(require("./bridge"), exports);
|
|
19
|
+
__exportStar(require("./pagination"), exports);
|
|
20
|
+
__exportStar(require("./nft"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA6B;AAC7B,4CAA0B;AAC1B,8CAA4B;AAC5B,8CAA4B;AAC5B,gDAA8B;AAC9B,2CAAyB;AACzB,+CAA6B;AAC7B,wCAAsB"}
|
package/lib/nft.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type BigNumber from "bignumber.js";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export declare type NFTStandards = "ERC721" | "ERC1155";
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export declare type NFT = {
|
|
10
|
+
id: string;
|
|
11
|
+
tokenId: string;
|
|
12
|
+
amount: BigNumber;
|
|
13
|
+
collection: {
|
|
14
|
+
contract: string;
|
|
15
|
+
standard: NFTStandards | string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare type NFTRaw = Omit<NFT, "amount"> & {
|
|
22
|
+
amount: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export declare type NFTMetadataLinksProviders = "opensea" | "rarible" | "etherscan";
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
export declare type NFTMetadataResponse = {
|
|
32
|
+
status: 200 | 404 | 500;
|
|
33
|
+
result?: {
|
|
34
|
+
contract: string;
|
|
35
|
+
tokenId: string;
|
|
36
|
+
tokenName: string | null;
|
|
37
|
+
nftName: string | null;
|
|
38
|
+
media: string | null;
|
|
39
|
+
description: string | null;
|
|
40
|
+
properties: Array<Record<"key" | "value", string>>;
|
|
41
|
+
links: Record<NFTMetadataLinksProviders, string>;
|
|
42
|
+
} | null;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=nft.d.ts.map
|
package/lib/nft.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nft.d.ts","sourceRoot":"","sources":["../src/nft.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,oBAAY,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhD;;GAEG;AACH,oBAAY,GAAG,GAAG;IAEhB,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,CAAC;IAClB,UAAU,EAAE;QAGV,QAAQ,EAAE,MAAM,CAAC;QAEjB,QAAQ,EAAE,YAAY,GAAG,MAAM,CAAC;KACjC,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,oBAAY,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,oBAAY,yBAAyB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;AAE5E;;GAEG;AACH,oBAAY,mBAAmB,GAAG;IAChC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACxB,MAAM,CAAC,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QACnD,KAAK,EAAE,MAAM,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;KAClD,GAAG,IAAI,CAAC;CACV,CAAC"}
|
package/lib/nft.js
ADDED
package/lib/nft.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nft.js","sourceRoot":"","sources":["../src/nft.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { BigNumber } from "bignumber.js";
|
|
2
|
+
import { NFTStandards } from "./nft";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare type OperationType = "IN" | "OUT" | "NONE" | "CREATE" | "REVEAL" | "DELEGATE" | "UNDELEGATE" | "REDELEGATE" | "REWARD" | "FEES" | "FREEZE" | "UNFREEZE" | "VOTE" | "REWARD_PAYOUT" | "BOND" | "UNBOND" | "WITHDRAW_UNBONDED" | "SET_CONTROLLER" | "SLASH" | "NOMINATE" | "CHILL" | "SUPPLY" | "REDEEM" | "APPROVE" | "OPT_IN" | "OPT_OUT" | "NFT_IN" | "NFT_OUT";
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare type Operation = {
|
|
11
|
+
id: string;
|
|
12
|
+
hash: string;
|
|
13
|
+
type: OperationType;
|
|
14
|
+
value: BigNumber;
|
|
15
|
+
fee: BigNumber;
|
|
16
|
+
senders: string[];
|
|
17
|
+
recipients: string[];
|
|
18
|
+
blockHeight: number | null | undefined;
|
|
19
|
+
blockHash: string | null | undefined;
|
|
20
|
+
transactionSequenceNumber?: number;
|
|
21
|
+
accountId: string;
|
|
22
|
+
standard?: NFTStandards | string;
|
|
23
|
+
operator?: string;
|
|
24
|
+
contract?: string;
|
|
25
|
+
tokenId?: string;
|
|
26
|
+
date: Date;
|
|
27
|
+
extra: Record<string, any>;
|
|
28
|
+
hasFailed?: boolean;
|
|
29
|
+
subOperations?: Operation[];
|
|
30
|
+
internalOperations?: Operation[];
|
|
31
|
+
nftOperations?: Operation[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
export declare type OperationRaw = {
|
|
37
|
+
id: string;
|
|
38
|
+
hash: string;
|
|
39
|
+
type: OperationType;
|
|
40
|
+
value: string;
|
|
41
|
+
fee: string;
|
|
42
|
+
senders: string[];
|
|
43
|
+
recipients: string[];
|
|
44
|
+
blockHeight: number | null | undefined;
|
|
45
|
+
blockHash: string | null | undefined;
|
|
46
|
+
transactionSequenceNumber?: number;
|
|
47
|
+
accountId: string;
|
|
48
|
+
hasFailed?: boolean;
|
|
49
|
+
standard?: NFTStandards | string;
|
|
50
|
+
operator?: string;
|
|
51
|
+
contract?: string;
|
|
52
|
+
tokenId?: string;
|
|
53
|
+
date: string;
|
|
54
|
+
extra: Record<string, any>;
|
|
55
|
+
subOperations?: OperationRaw[];
|
|
56
|
+
internalOperations?: OperationRaw[];
|
|
57
|
+
nftOperations?: OperationRaw[];
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../src/operation.ts"],"names":[],"mappings":"AAAA,OAAO,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AC;IAG5B,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;IAEjC,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,oBAAY,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACrC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,QAAQ,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE3B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAG/B,kBAAkB,CAAC,EAAE,YAAY,EAAE,CAAC;IAEpC,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC,CAAC"}
|
package/lib/operation.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../src/operation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pagination config holds the user's pagination state
|
|
3
|
+
* this is a state that usually should leave during the app lifecycle, but is not persisted
|
|
4
|
+
* it drives the number of operations to poll in accounts
|
|
5
|
+
* when a user paginate more, the number should accordingly be incremented
|
|
6
|
+
* The UI should manage scrolling ahead of time (e.g. if 30 ops is displayed and UI have pages of 20 ops, the UI can already request to poll 70 ops so it have 2 pages in advance)
|
|
7
|
+
* The UI must always do max() to keep the increasing the counter and not going back to lower value: that optim the sync to not recompute things too much
|
|
8
|
+
*/
|
|
9
|
+
export declare type PaginationConfig = {
|
|
10
|
+
operationsPerAccountId?: Record<string, number>;
|
|
11
|
+
operations?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare type SyncConfig = {
|
|
14
|
+
paginationConfig: PaginationConfig;
|
|
15
|
+
withoutSynchronize?: boolean;
|
|
16
|
+
blacklistedTokenIds?: string[];
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,oBAAY,gBAAgB,GAAG;IAE7B,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGhD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AACF,oBAAY,UAAU,GAAG;IACvB,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { BigNumber } from "bignumber.js";
|
|
2
|
+
import type { AccountLike, AccountLikeArray } from "./account";
|
|
3
|
+
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export declare type BalanceHistoryData = {
|
|
8
|
+
date: Date;
|
|
9
|
+
value: BigNumber;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare type BalanceHistory = BalanceHistoryData[];
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export declare type BalanceHistoryRaw = Array<[string, string]>;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export declare type BalanceHistoryWithCountervalue = Array<{
|
|
23
|
+
date: Date;
|
|
24
|
+
value: BigNumber;
|
|
25
|
+
countervalue: BigNumber;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export declare type ValueChange = {
|
|
31
|
+
percentage: BigNumber | null | undefined;
|
|
32
|
+
value: BigNumber;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
export declare type AccountPortfolio = {
|
|
38
|
+
history: BalanceHistoryWithCountervalue;
|
|
39
|
+
countervalueAvailable: boolean;
|
|
40
|
+
countervalueReceiveSum: BigNumber;
|
|
41
|
+
countervalueSendSum: BigNumber;
|
|
42
|
+
cryptoChange: ValueChange;
|
|
43
|
+
countervalueChange: ValueChange;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
export declare type CurrencyPortfolio = {
|
|
49
|
+
history: BalanceHistoryWithCountervalue;
|
|
50
|
+
countervalueAvailable: boolean;
|
|
51
|
+
histories: BalanceHistoryWithCountervalue[];
|
|
52
|
+
accounts: AccountLikeArray;
|
|
53
|
+
cryptoChange: ValueChange;
|
|
54
|
+
countervalueChange: ValueChange;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
export declare type Portfolio = {
|
|
60
|
+
balanceHistory: BalanceHistory;
|
|
61
|
+
balanceAvailable: boolean;
|
|
62
|
+
availableAccounts: AccountLike[];
|
|
63
|
+
unavailableCurrencies: (CryptoCurrency | TokenCurrency)[];
|
|
64
|
+
accounts: AccountLike[];
|
|
65
|
+
range: PortfolioRange;
|
|
66
|
+
histories: BalanceHistoryWithCountervalue[];
|
|
67
|
+
countervalueReceiveSum: BigNumber;
|
|
68
|
+
countervalueSendSum: BigNumber;
|
|
69
|
+
countervalueChange: ValueChange;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
export declare type PortfolioRangeConfig = {
|
|
75
|
+
count: number;
|
|
76
|
+
granularityId: "HOUR" | "DAY" | "WEEK";
|
|
77
|
+
startOf: (arg0: Date) => Date;
|
|
78
|
+
increment: number;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
*
|
|
82
|
+
*/
|
|
83
|
+
export declare type PortfolioRange = "year" | "month" | "week" | "day";
|
|
84
|
+
/**
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
87
|
+
export declare type AssetsDistribution = {
|
|
88
|
+
isAvailable: boolean;
|
|
89
|
+
list: Array<{
|
|
90
|
+
currency: CryptoCurrency | TokenCurrency;
|
|
91
|
+
distribution: number;
|
|
92
|
+
amount: BigNumber;
|
|
93
|
+
countervalue: BigNumber;
|
|
94
|
+
}>;
|
|
95
|
+
showFirst: number;
|
|
96
|
+
sum: BigNumber;
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=portfolio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolio.d.ts","sourceRoot":"","sources":["../src/portfolio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,8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