Skip to content

Commit ad65b27

Browse files
authored
feat: adjust etna builder props (#882)
* feat: move memo and minIssuanceTime props on etna builder * feat: add changeAddressesBytes to etna builder * fix: optional signature and public key on NewAddPermissionlessValidatorTxProps * feat: consolidate spend change props
1 parent 24ceab1 commit ad65b27

File tree

16 files changed

+317
-307
lines changed

16 files changed

+317
-307
lines changed

examples/p-chain/etna/import.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const main = async () => {
1818
feeState,
1919
fromAddressesBytes: [utils.bech32ToBytes(X_CHAIN_ADDRESS)],
2020
sourceChainId: context.xBlockchainID,
21-
toAddresses: [utils.bech32ToBytes(P_CHAIN_ADDRESS)],
21+
toAddressesBytes: [utils.bech32ToBytes(P_CHAIN_ADDRESS)],
2222
utxos,
2323
},
2424
context,

src/vms/avm/utxoCalculationFns/useAvmAndCorethUTXOs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const useAvmAndCorethUTXOs = ({
3535
.filter((utxo) => !!isTransferOut(utxo.output as TransferOutput)),
3636
(utxo) => utxo.output as TransferOutput,
3737
fromAddresses,
38-
options,
38+
options.minIssuanceTime,
3939
).forEach(({ sigData, data: utxo }) => {
4040
const utxoTransferout = utxo.output as TransferOutput;
4141

src/vms/common/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ export type SpendOptions = {
88

99
export type SpendOptionsRequired = Required<SpendOptions>;
1010

11-
//the strign is address in hex
11+
//the string is address in hex
1212
export type SigMapping = Map<string, number>;
1313
export type SigMappings = SigMapping[];

src/vms/pvm/etna-builder/builder.test.ts

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
204204
fromAddressesBytes,
205205
feeState,
206206
outputs: [transferableOutput],
207-
options: {
208-
memo,
209-
},
207+
memo,
210208
utxos,
211209
},
212210
testContext,
@@ -244,11 +242,9 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
244242
{
245243
fromAddressesBytes,
246244
feeState,
247-
options: {
248-
memo,
249-
},
245+
memo,
250246
sourceChainId: testContext.cBlockchainID,
251-
toAddresses: [testAddress1],
247+
toAddressesBytes: [testAddress1],
252248
utxos,
253249
},
254250
testContext,
@@ -310,9 +306,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
310306
destinationChainId: testContext.cBlockchainID,
311307
feeState,
312308
fromAddressesBytes,
313-
options: {
314-
memo,
315-
},
309+
memo,
316310
outputs: [tnsOut],
317311
utxos,
318312
},
@@ -363,9 +357,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
363357
{
364358
fromAddressesBytes,
365359
feeState,
366-
options: {
367-
memo,
368-
},
360+
memo,
369361
subnetOwners: [toAddress],
370362
utxos: [getValidUtxo(new BigIntPr(utxoInputAmt))],
371363
},
@@ -406,9 +398,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
406398
fromAddressesBytes,
407399
fxIds: [],
408400
genesisData: testGenesisData,
409-
options: {
410-
memo,
411-
},
401+
memo,
412402
subnetAuth: [0],
413403
subnetId: Id.fromHex(testSubnetId).toString(),
414404
utxos: [getValidUtxo(new BigIntPr(utxoInputAmt))],
@@ -455,9 +445,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
455445
feeState,
456446
fromAddressesBytes,
457447
nodeId,
458-
options: {
459-
memo,
460-
},
448+
memo,
461449
subnetAuth: [0],
462450
subnetId: Id.fromHex(testSubnetId).toString(),
463451
start: 100n,
@@ -506,9 +494,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
506494
fromAddressesBytes,
507495
feeState,
508496
nodeId,
509-
options: {
510-
memo,
511-
},
497+
memo,
512498
subnetAuth: [0],
513499
subnetId: Id.fromHex(testSubnetId).toString(),
514500
utxos: [getValidUtxo(new BigIntPr(utxoInputAmt))],
@@ -553,9 +539,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
553539
feeState,
554540
fromAddressesBytes,
555541
nodeId,
556-
options: {
557-
memo,
558-
},
542+
memo,
559543
publicKey: blsPublicKeyBytes(),
560544
rewardAddresses: [],
561545
shares: 1,
@@ -621,9 +605,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
621605
feeState,
622606
fromAddressesBytes,
623607
nodeId,
624-
options: {
625-
memo,
626-
},
608+
memo,
627609
publicKey: blsPublicKeyBytes(),
628610
rewardAddresses: [],
629611
shares: 1,
@@ -690,9 +672,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
690672
feeState,
691673
fromAddressesBytes,
692674
nodeId,
693-
options: {
694-
memo,
695-
},
675+
memo,
696676
publicKey: blsPublicKeyBytes(),
697677
rewardAddresses: [],
698678
shares: 1,
@@ -750,9 +730,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
750730
feeState,
751731
fromAddressesBytes,
752732
nodeId,
753-
options: {
754-
memo,
755-
},
733+
memo,
756734
rewardAddresses: [],
757735
start: 0n,
758736
subnetId: PrimaryNetworkID.toString(),
@@ -811,9 +789,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
811789
feeState,
812790
fromAddressesBytes,
813791
nodeId,
814-
options: {
815-
memo,
816-
},
792+
memo,
817793
rewardAddresses: [],
818794
start: 0n,
819795
subnetId: Id.fromHex(testSubnetId).toString(),
@@ -873,9 +849,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
873849
feeState,
874850
fromAddressesBytes,
875851
nodeId,
876-
options: {
877-
memo,
878-
},
852+
memo,
879853
rewardAddresses: [],
880854
stakingAssetId: stakingAssetId.toString(),
881855
start: 0n,
@@ -930,9 +904,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
930904
{
931905
fromAddressesBytes,
932906
feeState,
933-
options: {
934-
memo,
935-
},
907+
memo,
936908
subnetAuth,
937909
subnetId: Id.fromHex(testSubnetId).toString(),
938910
subnetOwners: [toAddress],
@@ -988,7 +960,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
988960
fromAddressesBytes,
989961
feeState,
990962
sourceChainId: testContext.cBlockchainID,
991-
toAddresses: [testAddress1],
963+
toAddressesBytes: [testAddress1],
992964
utxos,
993965
},
994966
testContext,

0 commit comments

Comments
 (0)