Skip to content

Commit baba4c4

Browse files
nooxxloicttn
authored andcommitted
wip
1 parent eceb8d9 commit baba4c4

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/services/ada.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,20 @@ export class AdaService extends Service {
7070
.build(),
7171
);
7272

73-
const poolHash = this.testnet ? '3496527c1e1b20d56cc9d4e5615c76ba2421ad3f13e2561a1ad4d6c6' : '78da8fa2f5089964963a0ab7ad1402e8c656f203bef622cf9f5ee3c6';
74-
const wasmWalletAddress = CardanoWasm.Address.from_bech32(walletAddress);
75-
const baseWalletAddress = CardanoWasm.BaseAddress.from_address(wasmWalletAddress);
76-
77-
7873
// Set TTL to +2h from currentSlot
7974
// If the transaction is not included in a block before that slot it will be cancelled.
8075
const ttl = currentSlot + 7200;
8176
txBuilder.set_ttl(ttl);
8277

83-
// Add delegation
84-
const poolKeyHash = CardanoWasm.Ed25519KeyHash.from_hex(poolHash);
85-
const stakeCredentials = baseWalletAddress?.stake_cred();
86-
if(!stakeCredentials){
87-
throw new Error('Could not generate stake credentials');
78+
// Add delegation (stake registration + stake delegation certificates)
79+
const poolHash = this.testnet ? '3496527c1e1b20d56cc9d4e5615c76ba2421ad3f13e2561a1ad4d6c6' : '78da8fa2f5089964963a0ab7ad1402e8c656f203bef622cf9f5ee3c6';
80+
const wasmWalletAddress = CardanoWasm.Address.from_bech32(walletAddress);
81+
const baseWalletAddress = CardanoWasm.BaseAddress.from_address(wasmWalletAddress);
82+
if(!baseWalletAddress){
83+
throw new Error('Could not generate base wallet address');
8884
}
89-
85+
const poolKeyHash = CardanoWasm.Ed25519KeyHash.from_hex(poolHash);
86+
const stakeCredentials = baseWalletAddress.stake_cred();
9087
const certificates = CardanoWasm.Certificates.new();
9188
const stakeRegistration = CardanoWasm.StakeRegistration.new(stakeCredentials);
9289
const stakeDelegation = CardanoWasm.StakeDelegation.new(stakeCredentials, poolKeyHash);
@@ -170,7 +167,7 @@ export class AdaService extends Service {
170167
}
171168
};
172169

173-
const fbTx = await this.fbSigner.signWithFB(payload, 'ADA_TEST');
170+
const fbTx = await this.fbSigner.signWithFB(payload, this.testnet ? 'ADA_TEST' : 'ADA');
174171

175172
const pubKey = CardanoWasm.PublicKey.from_hex(fbTx.signedMessages![0].publicKey);
176173
const vKey = CardanoWasm.Vkey.new(pubKey);

0 commit comments

Comments
 (0)