@ledgerhq/coin-framework 5.2.1-nightly.0 → 5.3.0-next.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +20 -3
- package/lib/api/types.d.ts +10 -67
- package/lib/api/types.d.ts.map +1 -1
- package/lib/config.d.ts +0 -3
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js.map +1 -1
- package/lib-es/api/types.d.ts +10 -67
- package/lib-es/api/types.d.ts.map +1 -1
- package/lib-es/config.d.ts +0 -3
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/config.js.map +1 -1
- package/package.json +5 -5
- package/src/api/types.ts +23 -100
- package/src/config.ts +0 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @ledgerhq/coin-framework@5.
|
|
2
|
+
> @ledgerhq/coin-framework@5.3.0-next.0 build /home/runner/work/ledger-live/ledger-live/libs/coin-framework
|
|
3
3
|
> tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
# @ledgerhq/coin-framework
|
|
2
2
|
|
|
3
|
-
## 5.
|
|
3
|
+
## 5.3.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#10551](https://github.com/LedgerHQ/ledger-live/pull/10551) [`99385c9`](https://github.com/LedgerHQ/ledger-live/commit/99385c9a7ecac9328ffa29c039e8c0cf2317c431) Thanks [@Wozacosta](https://github.com/Wozacosta)! - fix: revert generic bridge xrp
|
|
8
|
+
|
|
9
|
+
## 5.3.0-next.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#10422](https://github.com/LedgerHQ/ledger-live/pull/10422) [`18bc0d4`](https://github.com/LedgerHQ/ledger-live/commit/18bc0d4a27696491400df6ce26b915a88b56792f) Thanks [@Moustafa-Koterba](https://github.com/Moustafa-Koterba)! - Logic implementation for sanctioned addresses
|
|
14
|
+
|
|
15
|
+
- [#10217](https://github.com/LedgerHQ/ledger-live/pull/10217) [`e04d215`](https://github.com/LedgerHQ/ledger-live/commit/e04d21576919fa21cb3ab6e1c4e8e50fb6c17eca) Thanks [@Wozacosta](https://github.com/Wozacosta)! - feat: update transactionintent generic types + remove xrp bridge and introduce the generic alpaca bridge in LLC
|
|
16
|
+
|
|
17
|
+
- [#10171](https://github.com/LedgerHQ/ledger-live/pull/10171) [`1535307`](https://github.com/LedgerHQ/ledger-live/commit/1535307f78d345d7f652ac2c91c8a67e62fedef2) Thanks [@Wozacosta](https://github.com/Wozacosta)! - fix: ensure btc transactionSequenceNumber is preserved when input sequence is 0 (previously resulted in undefined)
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
6
20
|
|
|
7
|
-
- Updated dependencies [[`
|
|
8
|
-
- @ledgerhq/
|
|
21
|
+
- Updated dependencies [[`8551c28`](https://github.com/LedgerHQ/ledger-live/commit/8551c280f24f7bd4475c6cc12f1b1d92636d9357), [`b7d3d59`](https://github.com/LedgerHQ/ledger-live/commit/b7d3d59d299c3d3541d598536651b9047fda4526)]:
|
|
22
|
+
- @ledgerhq/live-env@2.10.0-next.0
|
|
23
|
+
- @ledgerhq/types-live@6.73.0-next.0
|
|
24
|
+
- @ledgerhq/cryptoassets@13.18.1-next.0
|
|
25
|
+
- @ledgerhq/live-network@2.0.10-next.0
|
|
9
26
|
|
|
10
27
|
## 5.2.0
|
|
11
28
|
|
package/lib/api/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Unit } from "@ledgerhq/types-cryptoassets";
|
|
2
1
|
export type BlockInfo = {
|
|
3
2
|
height: number;
|
|
4
3
|
hash?: string;
|
|
@@ -10,23 +9,13 @@ export type Asset<TokenInfo extends TokenInfoCommon = never> = {
|
|
|
10
9
|
} | (TokenInfo extends never ? TokenInfo : {
|
|
11
10
|
type: "token";
|
|
12
11
|
} & TokenInfo);
|
|
13
|
-
export type Operation<AssetInfo extends Asset<TokenInfoCommon
|
|
12
|
+
export type Operation<AssetInfo extends Asset<TokenInfoCommon>> = {
|
|
14
13
|
id: string;
|
|
15
14
|
type: string;
|
|
16
15
|
senders: string[];
|
|
17
16
|
recipients: string[];
|
|
18
17
|
value: bigint;
|
|
19
18
|
asset: AssetInfo;
|
|
20
|
-
/**
|
|
21
|
-
* Optional memo associated with the operation.
|
|
22
|
-
* Use a `Memo` interface like `StringMemo<"text">`, `MapMemo<Kind, Value>`, or `MyMemo`.
|
|
23
|
-
* Defaults to `MemoNotSupported`.
|
|
24
|
-
*/
|
|
25
|
-
memo?: MemoType;
|
|
26
|
-
/**
|
|
27
|
-
* Arbitrary per-blockchain extra fields.
|
|
28
|
-
* This can include things like status, error messages, swap info, etc.
|
|
29
|
-
*/
|
|
30
19
|
details?: Record<string, unknown>;
|
|
31
20
|
tx: {
|
|
32
21
|
hash: string;
|
|
@@ -41,78 +30,32 @@ export type Transaction = {
|
|
|
41
30
|
amount: bigint;
|
|
42
31
|
fee: bigint;
|
|
43
32
|
} & Record<string, unknown>;
|
|
44
|
-
export type Account = {
|
|
45
|
-
currencyName: string;
|
|
46
|
-
address: string;
|
|
47
|
-
balance: bigint;
|
|
48
|
-
currencyUnit: Unit;
|
|
49
|
-
};
|
|
50
33
|
export type Balance<AssetInfo extends Asset<TokenInfoCommon>> = {
|
|
51
34
|
value: bigint;
|
|
52
|
-
locked?: bigint;
|
|
53
35
|
asset: AssetInfo;
|
|
54
36
|
};
|
|
55
|
-
export
|
|
56
|
-
type: string;
|
|
57
|
-
}
|
|
58
|
-
export interface MemoNotSupported extends Memo {
|
|
59
|
-
type: "none";
|
|
60
|
-
}
|
|
61
|
-
export interface StringMemo<Kind extends string = "text"> extends Memo {
|
|
62
|
-
type: "string";
|
|
63
|
-
kind: Kind;
|
|
64
|
-
value: string;
|
|
65
|
-
}
|
|
66
|
-
export interface MapMemo<Kind extends string, Value> extends Memo {
|
|
67
|
-
type: "map";
|
|
68
|
-
memos: Map<Kind, Value>;
|
|
69
|
-
}
|
|
70
|
-
export interface TypedMapMemo<KindToValueMap extends Record<string, unknown>> extends Memo {
|
|
71
|
-
type: "map";
|
|
72
|
-
memos: Map<keyof KindToValueMap, KindToValueMap[keyof KindToValueMap]>;
|
|
73
|
-
}
|
|
74
|
-
type MaybeMemo<MemoType extends Memo> = MemoType extends MemoNotSupported ? {} : {
|
|
75
|
-
memo: MemoType;
|
|
76
|
-
};
|
|
77
|
-
export type TransactionIntent<AssetInfo extends Asset<TokenInfoCommon>, MemoType extends Memo = MemoNotSupported> = {
|
|
37
|
+
export type TransactionIntent<AssetInfo extends Asset<TokenInfoCommon>, Extra = Record<string, unknown>, Sender extends Record<string, string> | string = string> = {
|
|
78
38
|
type: string;
|
|
79
|
-
sender:
|
|
80
|
-
senderPublicKey?: string;
|
|
81
|
-
expiration?: number;
|
|
39
|
+
sender: Sender;
|
|
82
40
|
recipient: string;
|
|
83
41
|
amount: bigint;
|
|
84
42
|
asset: AssetInfo;
|
|
85
|
-
} &
|
|
86
|
-
export type
|
|
87
|
-
errors: Record<string, Error>;
|
|
88
|
-
warnings: Record<string, Error>;
|
|
89
|
-
estimatedFees: bigint;
|
|
90
|
-
amount: bigint;
|
|
91
|
-
totalSpent: bigint;
|
|
92
|
-
};
|
|
93
|
-
export type FeeEstimation = {
|
|
43
|
+
} & Extra;
|
|
44
|
+
export type FeeEstimation<FeeParameters extends Record<string, bigint> = never> = {
|
|
94
45
|
value: bigint;
|
|
95
|
-
parameters?:
|
|
96
|
-
storageLimit: bigint;
|
|
97
|
-
gasLimit: bigint;
|
|
98
|
-
gasPrice?: bigint;
|
|
99
|
-
};
|
|
46
|
+
parameters?: FeeParameters;
|
|
100
47
|
};
|
|
101
48
|
export type Pagination = {
|
|
102
49
|
minHeight: number;
|
|
103
50
|
};
|
|
104
|
-
export type
|
|
51
|
+
export type Api<AssetInfo extends Asset<TokenInfoCommon>, TxExtra = Record<string, unknown>, Sender extends Record<string, string> | string = string, FeeParameters extends Record<string, bigint> = never> = {
|
|
105
52
|
broadcast: (tx: string) => Promise<string>;
|
|
106
|
-
combine: (tx: string, signature: string, pubkey?: string) => string
|
|
107
|
-
estimateFees: (transactionIntent: TransactionIntent<AssetInfo,
|
|
108
|
-
craftTransaction: (transactionIntent: TransactionIntent<AssetInfo,
|
|
53
|
+
combine: (tx: string, signature: string, pubkey?: string) => string;
|
|
54
|
+
estimateFees: (transactionIntent: TransactionIntent<AssetInfo, TxExtra, Sender>) => Promise<FeeEstimation<FeeParameters>>;
|
|
55
|
+
craftTransaction: (transactionIntent: TransactionIntent<AssetInfo, TxExtra, Sender>, customFees?: bigint) => Promise<string>;
|
|
109
56
|
getBalance: (address: string) => Promise<Balance<AssetInfo>[]>;
|
|
110
57
|
lastBlock: () => Promise<BlockInfo>;
|
|
111
58
|
listOperations: (address: string, pagination: Pagination) => Promise<[Operation<AssetInfo>[], string]>;
|
|
112
59
|
};
|
|
113
|
-
export type BridgeApi = {
|
|
114
|
-
validateIntent: (account: Account, transaction: Transaction) => Promise<TransactionValidation>;
|
|
115
|
-
};
|
|
116
|
-
export type Api<AssetInfo extends Asset<TokenInfoCommon>, MemoType extends Memo = MemoNotSupported> = AlpacaApi<AssetInfo, MemoType> & BridgeApi;
|
|
117
60
|
export {};
|
|
118
61
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/api/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IA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AO,EAAE,MAAM,CAAC,EAChE,UAAU,CAAC,EAAE,MAAM,KAChB,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC/D,SAAS,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,cAAc,EAAE,CACd,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,KACnB,OAAO,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;CAChD,CAAC"}
|
package/lib/config.d.ts
CHANGED
|
@@ -25,9 +25,6 @@ export type CurrencyConfig = {
|
|
|
25
25
|
[key: string]: unknown;
|
|
26
26
|
};
|
|
27
27
|
export type CoinConfig<T extends CurrencyConfig> = (currency?: CryptoCurrency) => T;
|
|
28
|
-
export type SharedConfig = {
|
|
29
|
-
checkBlacklistAddress?: boolean;
|
|
30
|
-
};
|
|
31
28
|
declare function buildCoinConfig<T extends CurrencyConfig>(): {
|
|
32
29
|
setCoinConfig: (config: CoinConfig<T>) => void;
|
|
33
30
|
getCoinConfig: (currency?: CryptoCurrency) => T;
|
package/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhF,KAAK,YAAY,GACb;IACE,IAAI,EAAE,QAAQ,CAAC;CAChB,GACD;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI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ChC,GACD;IACE,IAAI,EAAE,oBAAoB,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;CACzB,GACD;IACE,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEN,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,QAAQ,CAAC,EAAE,cAAc,KAAK,CAAC,CAAC;AAEpF,iBAAS,eAAe,CAAC,CAAC,SAAS,cAAc;4BAGhB,WAAW,CAAC,CAAC,KAAG,IAAI;+BAIjB,cAAc,KAAG,CAAC;EAYrD;AAED,eAAe,eAAe,CAAC"}
|
package/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;AACA,qCAA6C;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;AACA,qCAA6C;AA+C7C,SAAS,eAAe;IACtB,IAAI,UAAqC,CAAC;IAE1C,MAAM,aAAa,GAAG,CAAC,MAAqB,EAAQ,EAAE;QACpD,UAAU,GAAG,MAAM,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,CAAC,QAAyB,EAAK,EAAE;QACrD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,0BAAiB,EAAE,CAAC;QAChC,CAAC;QAED,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC,CAAC;IAEF,OAAO;QACL,aAAa;QACb,aAAa;KACd,CAAC;AACJ,CAAC;AAED,kBAAe,eAAe,CAAC"}
|
package/lib-es/api/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Unit } from "@ledgerhq/types-cryptoassets";
|
|
2
1
|
export type BlockInfo = {
|
|
3
2
|
height: number;
|
|
4
3
|
hash?: string;
|
|
@@ -10,23 +9,13 @@ export type Asset<TokenInfo extends TokenInfoCommon = never> = {
|
|
|
10
9
|
} | (TokenInfo extends never ? TokenInfo : {
|
|
11
10
|
type: "token";
|
|
12
11
|
} & TokenInfo);
|
|
13
|
-
export type Operation<AssetInfo extends Asset<TokenInfoCommon
|
|
12
|
+
export type Operation<AssetInfo extends Asset<TokenInfoCommon>> = {
|
|
14
13
|
id: string;
|
|
15
14
|
type: string;
|
|
16
15
|
senders: string[];
|
|
17
16
|
recipients: string[];
|
|
18
17
|
value: bigint;
|
|
19
18
|
asset: AssetInfo;
|
|
20
|
-
/**
|
|
21
|
-
* Optional memo associated with the operation.
|
|
22
|
-
* Use a `Memo` interface like `StringMemo<"text">`, `MapMemo<Kind, Value>`, or `MyMemo`.
|
|
23
|
-
* Defaults to `MemoNotSupported`.
|
|
24
|
-
*/
|
|
25
|
-
memo?: MemoType;
|
|
26
|
-
/**
|
|
27
|
-
* Arbitrary per-blockchain extra fields.
|
|
28
|
-
* This can include things like status, error messages, swap info, etc.
|
|
29
|
-
*/
|
|
30
19
|
details?: Record<string, unknown>;
|
|
31
20
|
tx: {
|
|
32
21
|
hash: string;
|
|
@@ -41,78 +30,32 @@ export type Transaction = {
|
|
|
41
30
|
amount: bigint;
|
|
42
31
|
fee: bigint;
|
|
43
32
|
} & Record<string, unknown>;
|
|
44
|
-
export type Account = {
|
|
45
|
-
currencyName: string;
|
|
46
|
-
address: string;
|
|
47
|
-
balance: bigint;
|
|
48
|
-
currencyUnit: Unit;
|
|
49
|
-
};
|
|
50
33
|
export type Balance<AssetInfo extends Asset<TokenInfoCommon>> = {
|
|
51
34
|
value: bigint;
|
|
52
|
-
locked?: bigint;
|
|
53
35
|
asset: AssetInfo;
|
|
54
36
|
};
|
|
55
|
-
export
|
|
56
|
-
type: string;
|
|
57
|
-
}
|
|
58
|
-
export interface MemoNotSupported extends Memo {
|
|
59
|
-
type: "none";
|
|
60
|
-
}
|
|
61
|
-
export interface StringMemo<Kind extends string = "text"> extends Memo {
|
|
62
|
-
type: "string";
|
|
63
|
-
kind: Kind;
|
|
64
|
-
value: string;
|
|
65
|
-
}
|
|
66
|
-
export interface MapMemo<Kind extends string, Value> extends Memo {
|
|
67
|
-
type: "map";
|
|
68
|
-
memos: Map<Kind, Value>;
|
|
69
|
-
}
|
|
70
|
-
export interface TypedMapMemo<KindToValueMap extends Record<string, unknown>> extends Memo {
|
|
71
|
-
type: "map";
|
|
72
|
-
memos: Map<keyof KindToValueMap, KindToValueMap[keyof KindToValueMap]>;
|
|
73
|
-
}
|
|
74
|
-
type MaybeMemo<MemoType extends Memo> = MemoType extends MemoNotSupported ? {} : {
|
|
75
|
-
memo: MemoType;
|
|
76
|
-
};
|
|
77
|
-
export type TransactionIntent<AssetInfo extends Asset<TokenInfoCommon>, MemoType extends Memo = MemoNotSupported> = {
|
|
37
|
+
export type TransactionIntent<AssetInfo extends Asset<TokenInfoCommon>, Extra = Record<string, unknown>, Sender extends Record<string, string> | string = string> = {
|
|
78
38
|
type: string;
|
|
79
|
-
sender:
|
|
80
|
-
senderPublicKey?: string;
|
|
81
|
-
expiration?: number;
|
|
39
|
+
sender: Sender;
|
|
82
40
|
recipient: string;
|
|
83
41
|
amount: bigint;
|
|
84
42
|
asset: AssetInfo;
|
|
85
|
-
} &
|
|
86
|
-
export type
|
|
87
|
-
errors: Record<string, Error>;
|
|
88
|
-
warnings: Record<string, Error>;
|
|
89
|
-
estimatedFees: bigint;
|
|
90
|
-
amount: bigint;
|
|
91
|
-
totalSpent: bigint;
|
|
92
|
-
};
|
|
93
|
-
export type FeeEstimation = {
|
|
43
|
+
} & Extra;
|
|
44
|
+
export type FeeEstimation<FeeParameters extends Record<string, bigint> = never> = {
|
|
94
45
|
value: bigint;
|
|
95
|
-
parameters?:
|
|
96
|
-
storageLimit: bigint;
|
|
97
|
-
gasLimit: bigint;
|
|
98
|
-
gasPrice?: bigint;
|
|
99
|
-
};
|
|
46
|
+
parameters?: FeeParameters;
|
|
100
47
|
};
|
|
101
48
|
export type Pagination = {
|
|
102
49
|
minHeight: number;
|
|
103
50
|
};
|
|
104
|
-
export type
|
|
51
|
+
export type Api<AssetInfo extends Asset<TokenInfoCommon>, TxExtra = Record<string, unknown>, Sender extends Record<string, string> | string = string, FeeParameters extends Record<string, bigint> = never> = {
|
|
105
52
|
broadcast: (tx: string) => Promise<string>;
|
|
106
|
-
combine: (tx: string, signature: string, pubkey?: string) => string
|
|
107
|
-
estimateFees: (transactionIntent: TransactionIntent<AssetInfo,
|
|
108
|
-
craftTransaction: (transactionIntent: TransactionIntent<AssetInfo,
|
|
53
|
+
combine: (tx: string, signature: string, pubkey?: string) => string;
|
|
54
|
+
estimateFees: (transactionIntent: TransactionIntent<AssetInfo, TxExtra, Sender>) => Promise<FeeEstimation<FeeParameters>>;
|
|
55
|
+
craftTransaction: (transactionIntent: TransactionIntent<AssetInfo, TxExtra, Sender>, customFees?: bigint) => Promise<string>;
|
|
109
56
|
getBalance: (address: string) => Promise<Balance<AssetInfo>[]>;
|
|
110
57
|
lastBlock: () => Promise<BlockInfo>;
|
|
111
58
|
listOperations: (address: string, pagination: Pagination) => Promise<[Operation<AssetInfo>[], string]>;
|
|
112
59
|
};
|
|
113
|
-
export type BridgeApi = {
|
|
114
|
-
validateIntent: (account: Account, transaction: Transaction) => Promise<TransactionValidation>;
|
|
115
|
-
};
|
|
116
|
-
export type Api<AssetInfo extends Asset<TokenInfoCommon>, MemoType extends Memo = MemoNotSupported> = AlpacaApi<AssetInfo, MemoType> & BridgeApi;
|
|
117
60
|
export {};
|
|
118
61
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"A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,aAAa,CAAC,CAAC,CAAC;IAC3C,gBAAgB,EAAE,CAChB,iBAAiB,EAAE,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EAChE,UAAU,CAAC,EAAE,MAAM,KAChB,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC/D,SAAS,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,cAAc,EAAE,CACd,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,KACnB,OAAO,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;CAChD,CAAC"}
|
package/lib-es/config.d.ts
CHANGED
|
@@ -25,9 +25,6 @@ export type CurrencyConfig = {
|
|
|
25
25
|
[key: string]: unknown;
|
|
26
26
|
};
|
|
27
27
|
export type CoinConfig<T extends CurrencyConfig> = (currency?: CryptoCurrency) => T;
|
|
28
|
-
export type SharedConfig = {
|
|
29
|
-
checkBlacklistAddress?: boolean;
|
|
30
|
-
};
|
|
31
28
|
declare function buildCoinConfig<T extends CurrencyConfig>(): {
|
|
32
29
|
setCoinConfig: (config: CoinConfig<T>) => void;
|
|
33
30
|
getCoinConfig: (currency?: CryptoCurrency) => T;
|
package/lib-es/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhF,KAAK,YAAY,GACb;IACE,IAAI,EAAE,QAAQ,CAAC;CAChB,GACD;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,WAAW,CAAC;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Ae,GACf,kBAAkB,GAClB,MAAM,GACN,SAAS,GACT,gBAAgB,GAChB,kBAAkB,GAClB,SAAS,GACT,0BAA0B,CAAC;CAChC,GACD;IACE,IAAI,EAAE,oBAAoB,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;CACzB,GACD;IACE,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEN,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,QAAQ,CAAC,EAAE,cAAc,KAAK,CAAC,CAAC;AAEpF,iBAAS,eAAe,CAAC,CAAC,SAAS,cAAc;4BAGhB,WAAW,CAAC,CAAC,KAAG,IAAI;+BAIjB,cAAc,KAAG,CAAC;EAYrD;AAED,eAAe,eAAe,CAAC"}
|
package/lib-es/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AA+C7C,SAAS,eAAe;IACtB,IAAI,UAAqC,CAAC;IAE1C,MAAM,aAAa,GAAG,CAAC,MAAqB,EAAQ,EAAE;QACpD,UAAU,GAAG,MAAM,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,CAAC,QAAyB,EAAK,EAAE;QACrD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,iBAAiB,EAAE,CAAC;QAChC,CAAC;QAED,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC,CAAC;IAEF,OAAO;QACL,aAAa;QACb,aAAa;KACd,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-framework",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0-next.1",
|
|
4
4
|
"description": "Ledger framework for Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -91,14 +91,14 @@
|
|
|
91
91
|
"lodash": "^4.17.21",
|
|
92
92
|
"prando": "^6.0.1",
|
|
93
93
|
"rxjs": "^7.8.1",
|
|
94
|
-
"@ledgerhq/cryptoassets": "^13.18.1-
|
|
94
|
+
"@ledgerhq/cryptoassets": "^13.18.1-next.0",
|
|
95
95
|
"@ledgerhq/devices": "8.4.6",
|
|
96
96
|
"@ledgerhq/errors": "^6.21.0",
|
|
97
|
-
"@ledgerhq/live-env": "^2.
|
|
97
|
+
"@ledgerhq/live-env": "^2.10.0-next.0",
|
|
98
|
+
"@ledgerhq/live-network": "^2.0.10-next.0",
|
|
98
99
|
"@ledgerhq/logs": "^6.13.0",
|
|
99
100
|
"@ledgerhq/types-cryptoassets": "^7.23.0",
|
|
100
|
-
"@ledgerhq/types-live": "^6.73.0-
|
|
101
|
-
"@ledgerhq/live-network": "^2.0.9"
|
|
101
|
+
"@ledgerhq/types-live": "^6.73.0-next.0"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@types/invariant": "^2.2.2",
|
package/src/api/types.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Unit } from "@ledgerhq/types-cryptoassets";
|
|
2
|
-
|
|
3
1
|
export type BlockInfo = {
|
|
4
2
|
height: number;
|
|
5
3
|
hash?: string;
|
|
@@ -15,37 +13,23 @@ export type Asset<TokenInfo extends TokenInfoCommon = never> =
|
|
|
15
13
|
| { type: "native" }
|
|
16
14
|
| (TokenInfo extends never ? TokenInfo : { type: "token" } & TokenInfo);
|
|
17
15
|
|
|
18
|
-
export type Operation<
|
|
19
|
-
AssetInfo extends Asset<TokenInfoCommon> = Asset<TokenInfoCommon>,
|
|
20
|
-
MemoType extends Memo = MemoNotSupported,
|
|
21
|
-
> = {
|
|
16
|
+
export type Operation<AssetInfo extends Asset<TokenInfoCommon>> = {
|
|
22
17
|
id: string;
|
|
23
18
|
type: string;
|
|
24
|
-
|
|
25
19
|
senders: string[];
|
|
26
20
|
recipients: string[];
|
|
27
|
-
|
|
28
21
|
value: bigint;
|
|
29
22
|
asset: AssetInfo;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Optional memo associated with the operation.
|
|
33
|
-
* Use a `Memo` interface like `StringMemo<"text">`, `MapMemo<Kind, Value>`, or `MyMemo`.
|
|
34
|
-
* Defaults to `MemoNotSupported`.
|
|
35
|
-
*/
|
|
36
|
-
memo?: MemoType;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Arbitrary per-blockchain extra fields.
|
|
40
|
-
* This can include things like status, error messages, swap info, etc.
|
|
41
|
-
*/
|
|
23
|
+
// Field containing dedicated value for each blockchain
|
|
42
24
|
details?: Record<string, unknown>;
|
|
43
|
-
|
|
44
25
|
tx: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
// One tx can trigger multiple operations, hence multiple operations with the same hash
|
|
27
|
+
hash: string;
|
|
28
|
+
// In which block this operation's related tx was included
|
|
29
|
+
block: BlockInfo;
|
|
30
|
+
fees: bigint;
|
|
31
|
+
// see BlockInfo.time comment
|
|
32
|
+
date: Date;
|
|
49
33
|
};
|
|
50
34
|
};
|
|
51
35
|
|
|
@@ -56,79 +40,26 @@ export type Transaction = {
|
|
|
56
40
|
fee: bigint;
|
|
57
41
|
} & Record<string, unknown>; // Field containing dedicated value for each blockchain
|
|
58
42
|
|
|
59
|
-
// Other coins take differents parameters What do we want to do ?
|
|
60
|
-
export type Account = {
|
|
61
|
-
currencyName: string;
|
|
62
|
-
address: string;
|
|
63
|
-
balance: bigint;
|
|
64
|
-
currencyUnit: Unit;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
43
|
export type Balance<AssetInfo extends Asset<TokenInfoCommon>> = {
|
|
68
44
|
value: bigint;
|
|
69
|
-
locked?: bigint;
|
|
70
45
|
asset: AssetInfo;
|
|
71
46
|
};
|
|
72
47
|
|
|
73
|
-
export interface Memo {
|
|
74
|
-
type: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// generic implementations that cover many coins (in coin-framework)
|
|
78
|
-
export interface MemoNotSupported extends Memo {
|
|
79
|
-
type: "none";
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Specialized version, not extending the above
|
|
83
|
-
export interface StringMemo<Kind extends string = "text"> extends Memo {
|
|
84
|
-
type: "string";
|
|
85
|
-
kind: Kind;
|
|
86
|
-
value: string;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface MapMemo<Kind extends string, Value> extends Memo {
|
|
90
|
-
type: "map";
|
|
91
|
-
memos: Map<Kind, Value>;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface TypedMapMemo<KindToValueMap extends Record<string, unknown>> extends Memo {
|
|
95
|
-
type: "map";
|
|
96
|
-
memos: Map<keyof KindToValueMap, KindToValueMap[keyof KindToValueMap]>;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// FIXME: find better maybeMemo type without disabling the rule
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
101
|
-
type MaybeMemo<MemoType extends Memo> = MemoType extends MemoNotSupported ? {} : { memo: MemoType };
|
|
102
|
-
|
|
103
48
|
export type TransactionIntent<
|
|
104
49
|
AssetInfo extends Asset<TokenInfoCommon>,
|
|
105
|
-
|
|
50
|
+
Extra = Record<string, unknown>,
|
|
51
|
+
Sender extends Record<string, string> | string = string,
|
|
106
52
|
> = {
|
|
107
53
|
type: string;
|
|
108
|
-
sender:
|
|
109
|
-
senderPublicKey?: string;
|
|
110
|
-
expiration?: number;
|
|
54
|
+
sender: Sender;
|
|
111
55
|
recipient: string;
|
|
112
56
|
amount: bigint;
|
|
113
57
|
asset: AssetInfo;
|
|
114
|
-
} &
|
|
58
|
+
} & Extra;
|
|
115
59
|
|
|
116
|
-
export type
|
|
117
|
-
errors: Record<string, Error>;
|
|
118
|
-
warnings: Record<string, Error>;
|
|
119
|
-
estimatedFees: bigint;
|
|
120
|
-
amount: bigint;
|
|
121
|
-
totalSpent: bigint;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export type FeeEstimation = {
|
|
60
|
+
export type FeeEstimation<FeeParameters extends Record<string, bigint> = never> = {
|
|
125
61
|
value: bigint;
|
|
126
|
-
parameters?:
|
|
127
|
-
storageLimit: bigint;
|
|
128
|
-
gasLimit: bigint;
|
|
129
|
-
// Optional gas price, only for Aptos (need to improve)
|
|
130
|
-
gasPrice?: bigint;
|
|
131
|
-
};
|
|
62
|
+
parameters?: FeeParameters;
|
|
132
63
|
};
|
|
133
64
|
|
|
134
65
|
// TODO rename start to minHeight
|
|
@@ -138,18 +69,19 @@ export type FeeEstimation = {
|
|
|
138
69
|
// limit is unused for now
|
|
139
70
|
// see design document at https://ledgerhq.atlassian.net/wiki/spaces/BE/pages/5446205788/coin-modules+lama-adapter+APIs+refinements
|
|
140
71
|
export type Pagination = { minHeight: number };
|
|
141
|
-
|
|
142
|
-
export type AlpacaApi<
|
|
72
|
+
export type Api<
|
|
143
73
|
AssetInfo extends Asset<TokenInfoCommon>,
|
|
144
|
-
|
|
74
|
+
TxExtra = Record<string, unknown>,
|
|
75
|
+
Sender extends Record<string, string> | string = string,
|
|
76
|
+
FeeParameters extends Record<string, bigint> = never,
|
|
145
77
|
> = {
|
|
146
78
|
broadcast: (tx: string) => Promise<string>;
|
|
147
|
-
combine: (tx: string, signature: string, pubkey?: string) => string
|
|
79
|
+
combine: (tx: string, signature: string, pubkey?: string) => string;
|
|
148
80
|
estimateFees: (
|
|
149
|
-
transactionIntent: TransactionIntent<AssetInfo,
|
|
150
|
-
) => Promise<FeeEstimation
|
|
81
|
+
transactionIntent: TransactionIntent<AssetInfo, TxExtra, Sender>,
|
|
82
|
+
) => Promise<FeeEstimation<FeeParameters>>;
|
|
151
83
|
craftTransaction: (
|
|
152
|
-
transactionIntent: TransactionIntent<AssetInfo,
|
|
84
|
+
transactionIntent: TransactionIntent<AssetInfo, TxExtra, Sender>,
|
|
153
85
|
customFees?: bigint,
|
|
154
86
|
) => Promise<string>;
|
|
155
87
|
getBalance: (address: string) => Promise<Balance<AssetInfo>[]>;
|
|
@@ -159,12 +91,3 @@ export type AlpacaApi<
|
|
|
159
91
|
pagination: Pagination,
|
|
160
92
|
) => Promise<[Operation<AssetInfo>[], string]>;
|
|
161
93
|
};
|
|
162
|
-
|
|
163
|
-
export type BridgeApi = {
|
|
164
|
-
validateIntent: (account: Account, transaction: Transaction) => Promise<TransactionValidation>;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export type Api<
|
|
168
|
-
AssetInfo extends Asset<TokenInfoCommon>,
|
|
169
|
-
MemoType extends Memo = MemoNotSupported,
|
|
170
|
-
> = AlpacaApi<AssetInfo, MemoType> & BridgeApi;
|
package/src/config.ts
CHANGED
|
@@ -46,10 +46,6 @@ export type CurrencyConfig = {
|
|
|
46
46
|
|
|
47
47
|
export type CoinConfig<T extends CurrencyConfig> = (currency?: CryptoCurrency) => T;
|
|
48
48
|
|
|
49
|
-
export type SharedConfig = {
|
|
50
|
-
checkBlacklistAddress?: boolean;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
49
|
function buildCoinConfig<T extends CurrencyConfig>() {
|
|
54
50
|
let coinConfig: CoinConfig<T> | undefined;
|
|
55
51
|
|