@@ -133,12 +133,11 @@ function CardanoAddress({ bb02 }: Props) {
133
133
< ShowError err = { err } />
134
134
</ form >
135
135
</ div >
136
-
137
136
) ;
138
137
}
139
138
140
139
function CardanoSignTransaction ( { bb02 } : Props ) {
141
- type TxType = 'normal' | 'zero-ttl' | 'tokens' | 'delegate' | 'withdraw-staking-rewards' ;
140
+ type TxType = 'normal' | 'zero-ttl' | 'tokens' | 'delegate' | 'vote-delegation' | 'vote-delegation-keyhash' | ' withdraw-staking-rewards';
142
141
const [ txType , setTxType ] = useState < TxType > ( 'normal' ) ;
143
142
const [ running , setRunning ] = useState ( false ) ;
144
143
const [ result , setResult ] = useState < bitbox . CardanoSignTransactionResult | undefined > ( ) ;
@@ -151,6 +150,8 @@ function CardanoSignTransaction({ bb02 }: Props) {
151
150
[ 'zero-ttl' , 'Transaction with TTL=0' ] ,
152
151
[ 'tokens' , 'Transaction sending tokens' ] ,
153
152
[ 'delegate' , 'Delegate staking to a pool' ] ,
153
+ [ 'vote-delegation' , 'Delegate vote to a dRep' ] ,
154
+ [ 'vote-delegation-keyhash' , 'Delegate vote to a dRep with a keyhash' ] ,
154
155
[ 'withdraw-staking-rewards' , 'Withdraw staking rewards' ] ,
155
156
] ;
156
157
@@ -176,6 +177,8 @@ function CardanoSignTransaction({ bb02 }: Props) {
176
177
} ;
177
178
178
179
const changeAddress = await bb02 . cardanoAddress ( network , changeConfig , false ) ;
180
+ const drepType : bitbox . CardanoDrepType = 'alwaysAbstain' ;
181
+ const drepKeyHashType : bitbox . CardanoDrepType = 'keyHash' ;
179
182
const transaction = ( ) => {
180
183
switch ( txType ) {
181
184
case 'normal' :
@@ -290,6 +293,57 @@ function CardanoSignTransaction({ bb02 }: Props) {
290
293
validityIntervalStart : BigInt ( 41110811 ) ,
291
294
allowZeroTTL : false ,
292
295
} ;
296
+ case 'vote-delegation' :
297
+ return {
298
+ network,
299
+ inputs,
300
+ outputs : [
301
+ {
302
+ encodedAddress : changeAddress ,
303
+ value : BigInt ( 2741512 ) ,
304
+ scriptConfig : changeConfig ,
305
+ } ,
306
+ ] ,
307
+ fee : BigInt ( 191681 ) ,
308
+ ttl : BigInt ( 41539125 ) ,
309
+ certificates : [
310
+ {
311
+ voteDelegation : {
312
+ keypath : "m/1852'/1815'/0'/2/0" ,
313
+ type : drepType ,
314
+ } ,
315
+ } ,
316
+ ] ,
317
+ withdrawals : [ ] ,
318
+ validityIntervalStart : BigInt ( 41110811 ) ,
319
+ allowZeroTTL : false ,
320
+ } ;
321
+ case 'vote-delegation-keyhash' :
322
+ return {
323
+ network,
324
+ inputs,
325
+ outputs : [
326
+ {
327
+ encodedAddress : changeAddress ,
328
+ value : BigInt ( 2741512 ) ,
329
+ scriptConfig : changeConfig ,
330
+ } ,
331
+ ] ,
332
+ fee : BigInt ( 191681 ) ,
333
+ ttl : BigInt ( 41539125 ) ,
334
+ certificates : [
335
+ {
336
+ voteDelegation : {
337
+ keypath : "m/1852'/1815'/0'/2/0" ,
338
+ type : drepKeyHashType ,
339
+ drepCredhash : new Uint8Array ( hexToArrayBuffer ( "abababababababababababababababababababababababababababab" ) ) ,
340
+ } ,
341
+ } ,
342
+ ] ,
343
+ withdrawals : [ ] ,
344
+ validityIntervalStart : BigInt ( 41110811 ) ,
345
+ allowZeroTTL : false ,
346
+ } ;
293
347
case 'withdraw-staking-rewards' :
294
348
return {
295
349
network,
0 commit comments