Skip to content

Commit 0c5d4ca

Browse files
Merge pull request #4984 from BitGo/WIN-3569
refactor(sdk-coin-xrp): move interfaces to `/lib`
2 parents 59337c2 + 8c42a30 commit 0c5d4ca

File tree

3 files changed

+84
-67
lines changed

3 files changed

+84
-67
lines changed

modules/sdk-coin-xrp/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './xrp';
22
export * from './txrp';
33
export * from './register';
4+
export * from './lib/iface';

modules/sdk-coin-xrp/src/lib/iface.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import {
2+
InitiateRecoveryOptions as BaseInitiateRecoveryOptions,
3+
SignTransactionOptions as BaseSignTransactionOptions,
4+
TransactionPrebuild,
5+
VerifyAddressOptions as BaseVerifyAddressOptions,
6+
TransactionExplanation,
7+
} from '@bitgo/sdk-core';
8+
9+
export interface Address {
10+
address: string;
11+
destinationTag?: number;
12+
}
13+
14+
export interface FeeInfo {
15+
date: string;
16+
height: number;
17+
baseReserve: string;
18+
baseFee: string;
19+
}
20+
21+
export interface SignTransactionOptions extends BaseSignTransactionOptions {
22+
txPrebuild: TransactionPrebuild;
23+
prv: string;
24+
isLastSignature?: boolean;
25+
}
26+
27+
export interface ExplainTransactionOptions {
28+
txHex?: string;
29+
halfSigned?: {
30+
txHex: string; // txHex is poorly named here; it is just a wrapped JSON object
31+
};
32+
}
33+
34+
export interface VerifyAddressOptions extends BaseVerifyAddressOptions {
35+
rootAddress: string;
36+
}
37+
38+
export interface RecoveryInfo extends TransactionExplanation {
39+
txHex: string;
40+
backupKey?: string;
41+
coin?: string;
42+
}
43+
44+
export interface RecoveryTransaction {
45+
txHex: string;
46+
}
47+
48+
export interface InitiateRecoveryOptions extends BaseInitiateRecoveryOptions {
49+
krsProvider?: string;
50+
}
51+
52+
export interface RecoveryOptions {
53+
backupKey: string;
54+
userKey: string;
55+
rootAddress: string;
56+
recoveryDestination: string;
57+
bitgoKey?: string;
58+
walletPassphrase: string;
59+
krsProvider?: string;
60+
}
61+
62+
export interface HalfSignedTransaction {
63+
halfSigned: {
64+
txHex: string;
65+
};
66+
}
67+
68+
export interface SupplementGenerateWalletOptions {
69+
rootPrivateKey?: string;
70+
}

modules/sdk-coin-xrp/src/xrp.ts

Lines changed: 13 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -17,84 +17,30 @@ import {
1717
BitGoBase,
1818
checkKrsProvider,
1919
getBip32Keys,
20-
InitiateRecoveryOptions as BaseInitiateRecoveryOptions,
2120
InvalidAddressError,
2221
KeyPair,
2322
ParsedTransaction,
2423
ParseTransactionOptions,
2524
promiseProps,
26-
SignTransactionOptions as BaseSignTransactionOptions,
2725
TransactionExplanation,
28-
TransactionPrebuild,
2926
UnexpectedAddressError,
30-
VerifyAddressOptions as BaseVerifyAddressOptions,
3127
VerifyTransactionOptions,
3228
} from '@bitgo/sdk-core';
3329

3430
import ripple from './ripple';
35-
36-
interface Address {
37-
address: string;
38-
destinationTag?: number;
39-
}
40-
41-
interface FeeInfo {
42-
date: string;
43-
height: number;
44-
baseReserve: string;
45-
baseFee: string;
46-
}
47-
48-
interface SignTransactionOptions extends BaseSignTransactionOptions {
49-
txPrebuild: TransactionPrebuild;
50-
prv: string;
51-
isLastSignature?: boolean;
52-
}
53-
54-
interface ExplainTransactionOptions {
55-
txHex?: string;
56-
halfSigned?: {
57-
txHex: string; // txHex is poorly named here; it is just a wrapped JSON object
58-
};
59-
}
60-
61-
interface VerifyAddressOptions extends BaseVerifyAddressOptions {
62-
rootAddress: string;
63-
}
64-
65-
interface RecoveryInfo extends TransactionExplanation {
66-
txHex: string;
67-
backupKey?: string;
68-
coin?: string;
69-
}
70-
71-
export interface RecoveryTransaction {
72-
txHex: string;
73-
}
74-
75-
export interface InitiateRecoveryOptions extends BaseInitiateRecoveryOptions {
76-
krsProvider?: string;
77-
}
78-
79-
export interface RecoveryOptions {
80-
backupKey: string;
81-
userKey: string;
82-
rootAddress: string;
83-
recoveryDestination: string;
84-
bitgoKey?: string;
85-
walletPassphrase: string;
86-
krsProvider?: string;
87-
}
88-
89-
interface HalfSignedTransaction {
90-
halfSigned: {
91-
txHex: string;
92-
};
93-
}
94-
95-
interface SupplementGenerateWalletOptions {
96-
rootPrivateKey?: string;
97-
}
31+
import {
32+
Address,
33+
ExplainTransactionOptions,
34+
FeeInfo,
35+
HalfSignedTransaction,
36+
InitiateRecoveryOptions,
37+
RecoveryInfo,
38+
RecoveryOptions,
39+
RecoveryTransaction,
40+
SignTransactionOptions,
41+
SupplementGenerateWalletOptions,
42+
VerifyAddressOptions,
43+
} from './lib/iface';
9844

9945
export class Xrp extends BaseCoin {
10046
protected constructor(bitgo: BitGoBase) {

0 commit comments

Comments
 (0)