Skip to content

Commit 0298e0b

Browse files
authored
add atom redelegate (#73)
1 parent 6c8a6ac commit 0298e0b

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/integrations/fb_signer.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ export class FbSigner {
4848
if (tx.status == TransactionStatus.BLOCKED || tx.status == TransactionStatus.FAILED || tx.status == TransactionStatus.REJECTED || tx.status == TransactionStatus.CANCELLED) {
4949
throw Error(`Fireblocks signer: the transaction has been ${tx.status}`);
5050
}
51-
setTimeout(() => {
52-
}, 4000);
5351
tx = await this.fireblocks.getTransactionById(fbTx.id);
5452
}
5553

src/services/atom.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,34 @@ export class AtomService extends Service {
101101
}
102102
}
103103

104+
/**
105+
* Craft atom redelegate transaction
106+
* @param pubkey wallet pubkey, this is different from the wallet address
107+
* @param validatorSourceAddress validator address of the current delegation
108+
* @param validatorDestinationAddress validator address to which the delegation will be moved
109+
* @param amountAtom how many tokens to redelegate in ATOM
110+
*/
111+
async craftRedelegateTx(
112+
pubkey: string,
113+
validatorSourceAddress: string,
114+
validatorDestinationAddress: string,
115+
amountAtom?: number,
116+
): Promise<AtomTx> {
117+
try {
118+
const { data } = await api.post<AtomTx>(
119+
`/v1/atom/transaction/redelegate`,
120+
{
121+
pubkey: pubkey,
122+
validator_source: validatorSourceAddress,
123+
validator_destination: validatorDestinationAddress,
124+
amount_uatom: amountAtom ? this.atomToUatom(amountAtom.toString()) : undefined,
125+
});
126+
return data;
127+
} catch (err: any) {
128+
throw new Error(err);
129+
}
130+
}
131+
104132
/**
105133
* Sign transaction with given integration
106134
* @param integration custody solution to sign with

0 commit comments

Comments
 (0)