Skip to content

Commit

Permalink
feat: adjust etna builder props (#882)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
erictaylor authored Oct 14, 2024
1 parent 24ceab1 commit ad65b27
Show file tree
Hide file tree
Showing 16 changed files with 317 additions and 307 deletions.
2 changes: 1 addition & 1 deletion examples/p-chain/etna/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const main = async () => {
feeState,
fromAddressesBytes: [utils.bech32ToBytes(X_CHAIN_ADDRESS)],
sourceChainId: context.xBlockchainID,
toAddresses: [utils.bech32ToBytes(P_CHAIN_ADDRESS)],
toAddressesBytes: [utils.bech32ToBytes(P_CHAIN_ADDRESS)],
utxos,
},
context,
Expand Down
2 changes: 1 addition & 1 deletion src/vms/avm/utxoCalculationFns/useAvmAndCorethUTXOs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const useAvmAndCorethUTXOs = ({
.filter((utxo) => !!isTransferOut(utxo.output as TransferOutput)),
(utxo) => utxo.output as TransferOutput,
fromAddresses,
options,
options.minIssuanceTime,
).forEach(({ sigData, data: utxo }) => {
const utxoTransferout = utxo.output as TransferOutput;

Expand Down
2 changes: 1 addition & 1 deletion src/vms/common/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export type SpendOptions = {

export type SpendOptionsRequired = Required<SpendOptions>;

//the strign is address in hex
//the string is address in hex
export type SigMapping = Map<string, number>;
export type SigMappings = SigMapping[];
60 changes: 16 additions & 44 deletions src/vms/pvm/etna-builder/builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
fromAddressesBytes,
feeState,
outputs: [transferableOutput],
options: {
memo,
},
memo,
utxos,
},
testContext,
Expand Down Expand Up @@ -244,11 +242,9 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
{
fromAddressesBytes,
feeState,
options: {
memo,
},
memo,
sourceChainId: testContext.cBlockchainID,
toAddresses: [testAddress1],
toAddressesBytes: [testAddress1],
utxos,
},
testContext,
Expand Down Expand Up @@ -310,9 +306,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
destinationChainId: testContext.cBlockchainID,
feeState,
fromAddressesBytes,
options: {
memo,
},
memo,
outputs: [tnsOut],
utxos,
},
Expand Down Expand Up @@ -363,9 +357,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
{
fromAddressesBytes,
feeState,
options: {
memo,
},
memo,
subnetOwners: [toAddress],
utxos: [getValidUtxo(new BigIntPr(utxoInputAmt))],
},
Expand Down Expand Up @@ -406,9 +398,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
fromAddressesBytes,
fxIds: [],
genesisData: testGenesisData,
options: {
memo,
},
memo,
subnetAuth: [0],
subnetId: Id.fromHex(testSubnetId).toString(),
utxos: [getValidUtxo(new BigIntPr(utxoInputAmt))],
Expand Down Expand Up @@ -455,9 +445,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
feeState,
fromAddressesBytes,
nodeId,
options: {
memo,
},
memo,
subnetAuth: [0],
subnetId: Id.fromHex(testSubnetId).toString(),
start: 100n,
Expand Down Expand Up @@ -506,9 +494,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
fromAddressesBytes,
feeState,
nodeId,
options: {
memo,
},
memo,
subnetAuth: [0],
subnetId: Id.fromHex(testSubnetId).toString(),
utxos: [getValidUtxo(new BigIntPr(utxoInputAmt))],
Expand Down Expand Up @@ -553,9 +539,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
feeState,
fromAddressesBytes,
nodeId,
options: {
memo,
},
memo,
publicKey: blsPublicKeyBytes(),
rewardAddresses: [],
shares: 1,
Expand Down Expand Up @@ -621,9 +605,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
feeState,
fromAddressesBytes,
nodeId,
options: {
memo,
},
memo,
publicKey: blsPublicKeyBytes(),
rewardAddresses: [],
shares: 1,
Expand Down Expand Up @@ -690,9 +672,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
feeState,
fromAddressesBytes,
nodeId,
options: {
memo,
},
memo,
publicKey: blsPublicKeyBytes(),
rewardAddresses: [],
shares: 1,
Expand Down Expand Up @@ -750,9 +730,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
feeState,
fromAddressesBytes,
nodeId,
options: {
memo,
},
memo,
rewardAddresses: [],
start: 0n,
subnetId: PrimaryNetworkID.toString(),
Expand Down Expand Up @@ -811,9 +789,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
feeState,
fromAddressesBytes,
nodeId,
options: {
memo,
},
memo,
rewardAddresses: [],
start: 0n,
subnetId: Id.fromHex(testSubnetId).toString(),
Expand Down Expand Up @@ -873,9 +849,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
feeState,
fromAddressesBytes,
nodeId,
options: {
memo,
},
memo,
rewardAddresses: [],
stakingAssetId: stakingAssetId.toString(),
start: 0n,
Expand Down Expand Up @@ -930,9 +904,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
{
fromAddressesBytes,
feeState,
options: {
memo,
},
memo,
subnetAuth,
subnetId: Id.fromHex(testSubnetId).toString(),
subnetOwners: [toAddress],
Expand Down Expand Up @@ -988,7 +960,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
fromAddressesBytes,
feeState,
sourceChainId: testContext.cBlockchainID,
toAddresses: [testAddress1],
toAddressesBytes: [testAddress1],
utxos,
},
testContext,
Expand Down
Loading

0 comments on commit ad65b27

Please sign in to comment.