@bitgo-beta/sdk-coin-flrp 1.0.1-beta.1000 → 1.0.1-beta.1002
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/dist/src/flrp.d.ts +56 -1
- package/dist/src/flrp.d.ts.map +1 -1
- package/dist/src/flrp.js +253 -12
- package/dist/test/unit/flrp.js +594 -12
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
package/dist/src/flrp.d.ts
CHANGED
|
@@ -22,8 +22,9 @@ export declare class Flrp extends BaseCoin {
|
|
|
22
22
|
*
|
|
23
23
|
* @param {ITransactionRecipient[]} recipients expected recipients and info
|
|
24
24
|
* @param {FlrpLib.TransactionExplanation} explainedTx explained export transaction
|
|
25
|
+
* @param {FlrpLib.Transaction} tx parsed transaction, used to distinguish the export direction
|
|
25
26
|
*/
|
|
26
|
-
validateExportTx(recipients: ITransactionRecipient[], explainedTx: FlrpLib.TransactionExplanation): void;
|
|
27
|
+
validateExportTx(recipients: ITransactionRecipient[], explainedTx: FlrpLib.TransactionExplanation, tx: FlrpLib.Transaction): void;
|
|
27
28
|
/**
|
|
28
29
|
* Check if import txn into P is valid, based on expected tx params.
|
|
29
30
|
*
|
|
@@ -31,6 +32,47 @@ export declare class Flrp extends BaseCoin {
|
|
|
31
32
|
* @param {FlrpTransactionParams} txParams expected tx info to check against
|
|
32
33
|
*/
|
|
33
34
|
validateImportTx(explainedTxInputs: FlrpEntry[], txParams: FlrpTransactionParams): void;
|
|
35
|
+
/**
|
|
36
|
+
* Check that an import to P-chain pays the wallet's own address (CECHO-2717).
|
|
37
|
+
* The expected destination comes from txParams recipients when supplied, else from
|
|
38
|
+
* the wallet's rootAddress. Addresses are tilde-joined owner sets; comparison is
|
|
39
|
+
* order- and case-insensitive over the sorted owner set.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} outputAddress P-chain destination of the import output (from the parsed prebuild)
|
|
42
|
+
* @param {FlrpVerifyTransactionOptions} params verification params carrying intent and wallet
|
|
43
|
+
* @throws Error when no expected destination is available or the destination does not match
|
|
44
|
+
*/
|
|
45
|
+
validateImportDestination(outputAddress: string, params: FlrpVerifyTransactionOptions): void;
|
|
46
|
+
/**
|
|
47
|
+
* Bind the import-to-P output's spend policy (review hardening for CECHO-2717):
|
|
48
|
+
* the output must be immediately spendable (locktime 0), consume at least one UTXO,
|
|
49
|
+
* and be structurally sound (threshold between 1 and the owner count).
|
|
50
|
+
*
|
|
51
|
+
* The output threshold is deliberately NOT bound to the consumed UTXOs' thresholds:
|
|
52
|
+
* those are set by whoever created the atomic UTXO (the earlier export) and may
|
|
53
|
+
* legitimately differ from the wallet's output threshold — importing a 1-of-N UTXO
|
|
54
|
+
* into a 2-of-3 output is valid, and equality here would reject flows the base branch
|
|
55
|
+
* verified. No client-side authoritative expected threshold exists either (TSS
|
|
56
|
+
* wallets use 1, custodial m-of-n uses m, and neither reaches verifyTransaction),
|
|
57
|
+
* so threshold weakening within the wallet's own owner set is not verifiable here —
|
|
58
|
+
* the owner-set binding in validateImportDestination is what keeps the funds on
|
|
59
|
+
* wallet-controlled addresses.
|
|
60
|
+
*
|
|
61
|
+
* @param {FlrpLib.Transaction} tx the parsed transaction carrying the raw outputs
|
|
62
|
+
* @throws Error when the output locktime is nonzero, the import consumes no UTXOs,
|
|
63
|
+
* or the output threshold is structurally invalid
|
|
64
|
+
*/
|
|
65
|
+
validateImportOutputPolicy(tx: FlrpLib.Transaction): void;
|
|
66
|
+
/**
|
|
67
|
+
* Bound the fee burned by an import (review hardening for CECHO-2717): the
|
|
68
|
+
* difference between consumed input value and the output value is burned as the
|
|
69
|
+
* import fee. Without this check, a prebuild paying the right destination a dust
|
|
70
|
+
* amount while burning the rest as fee would pass verification.
|
|
71
|
+
*
|
|
72
|
+
* @param {FlrpLib.TransactionExplanation} explainedTx parsed import explanation
|
|
73
|
+
* @throws Error when the burned fee exceeds the network's maxImportFee
|
|
74
|
+
*/
|
|
75
|
+
validateImportFee(explainedTx: FlrpLib.TransactionExplanation): void;
|
|
34
76
|
/**
|
|
35
77
|
* Validate AddPermissionlessDelegator transaction parameters.
|
|
36
78
|
* Validates both expected txParams and the parsed explainedTx for consistency.
|
|
@@ -39,6 +81,19 @@ export declare class Flrp extends BaseCoin {
|
|
|
39
81
|
* @param {FlrpLib.TransactionExplanation} explainedTx - Parsed transaction explanation
|
|
40
82
|
*/
|
|
41
83
|
validateDelegationTx(txParams: FlrpTransactionParams, explainedTx: FlrpLib.TransactionExplanation): void;
|
|
84
|
+
/**
|
|
85
|
+
* Bind the delegation's stake and reward ownership (review hardening for CECHO-2717):
|
|
86
|
+
* a compromised platform can serve a delegation to the right node for the right
|
|
87
|
+
* amount while returning the stake to an attacker owner set or paying rewards to an
|
|
88
|
+
* attacker address. The stake owner set is bound to the wallet's own addresses when
|
|
89
|
+
* an anchor is available, and the delegator rewards owner must equal the requested
|
|
90
|
+
* stakingOptions.rewardAddress (P-/C- prefix-insensitive). Fails closed when the
|
|
91
|
+
* parsed transaction exposes no stake outputs or no rewards owner.
|
|
92
|
+
*
|
|
93
|
+
* @param {FlrpLib.Transaction} tx parsed delegation transaction
|
|
94
|
+
* @param {FlrpVerifyTransactionOptions} params verification params carrying intent and wallet
|
|
95
|
+
*/
|
|
96
|
+
validateDelegationOwners(tx: FlrpLib.Transaction, params: FlrpVerifyTransactionOptions): void;
|
|
42
97
|
private getBuilder;
|
|
43
98
|
/**
|
|
44
99
|
* Check if address is valid, then make sure it matches the root address.
|
package/dist/src/flrp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flrp.d.ts","sourceRoot":"","sources":["../../src/flrp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,UAAU,EAAuB,MAAM,qBAAqB,CAAC;AACnG,OAAO,EACL,uBAAuB,EACvB,QAAQ,EACR,SAAS,EACT,OAAO,EACP,YAAY,EACZ,YAAY,EAEZ,iBAAiB,EACjB,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