From 05fc4c4d83137eb3137583ca0bb443825eac1445 Mon Sep 17 00:00:00 2001 From: Martynas Kazlauskas Date: Tue, 8 Aug 2023 18:29:28 +0300 Subject: [PATCH] refactor!: rename/replace occurences of 'staking' with 'stake' where appropriate 'staking' refers to an action, while reward account balance is 'stake', keys are 'stake keys' and credentials are 'stake credentials' BREAKING CHANGE: rename AddressEntity.stakingCredentialHash -> stakeCredentialHash - rename BaseAddress.getStakingCredential -> getStakeCredential --- .../core/src/Cardano/Address/BaseAddress.ts | 16 +++++----- .../src/Cardano/Address/PointerAddress.ts | 8 ++--- .../core/src/Cardano/Address/RewardAddress.ts | 6 ++-- .../src/Cardano/util/addressesShareAnyKey.ts | 15 +++++----- .../core/test/Cardano/Address/Address.test.ts | 20 ++++++------- .../test/Cardano/Address/BaseAddress.test.ts | 2 +- .../Cardano/Address/RewardAddress.test.ts | 2 +- .../Cardano/util/addressesShareAnyKey.test.ts | 2 +- .../scripts/pools/update-node-utils.sh | 30 +++++++++---------- .../test/web-extension/specs/wallet.spec.ts | 4 +-- .../src/transformers/requiredSigners.ts | 16 +++++----- .../hardware-ledger/src/transformers/txOut.ts | 10 +++---- .../src/util/ownSignatureKeyPaths.ts | 10 +++---- packages/util-dev/src/Cip19TestVectors.ts | 2 +- .../src/mockProviders/mockRewardsProvider.ts | 2 +- .../AddressDiscovery/HDSequentialDiscovery.ts | 2 +- .../DynamicChangeAddressResolver.ts | 8 ++--- .../services/addressDiscovery/mockData.ts | 6 ++-- 18 files changed, 80 insertions(+), 81 deletions(-) diff --git a/packages/core/src/Cardano/Address/BaseAddress.ts b/packages/core/src/Cardano/Address/BaseAddress.ts index 3c32bd15efd..846d39c70ae 100644 --- a/packages/core/src/Cardano/Address/BaseAddress.ts +++ b/packages/core/src/Cardano/Address/BaseAddress.ts @@ -5,9 +5,9 @@ import { InvalidArgumentError } from '@cardano-sdk/util'; import { NetworkId } from '../ChainId'; /** - * A base address directly specifies the staking key that should control the stake for that address. The staking rights - * associated with funds held in this address may be exercised by the owner of the staking key. Base addresses can be - * used in transactions without registering the staking key in advance. + * A base address directly specifies the stake key that should control the stake for that address. The staking rights + * associated with funds held in this address may be exercised by the owner of the stake key. Base addresses can be + * used in transactions without registering the stake key in advance. * * The stake rights can only be exercised by registering the stake key and delegating to a stake pool. Once the stake * key is registered, the stake rights can be exercised for base addresses used in transactions before or after the key @@ -37,7 +37,7 @@ export class BaseAddress { * * @param networkId The Network identifier. * @param payment The payment credential. - * @param stake The staking credential. + * @param stake The stake credential. */ static fromCredentials(networkId: NetworkId, payment: Credential, stake: Credential): BaseAddress { let type = AddressType.BasePaymentKeyStakeKey; @@ -62,9 +62,9 @@ export class BaseAddress { } /** - * Gets the payment staking part of the base address. + * Gets the stake credential part of the base address. */ - getStakingCredential(): Credential { + getStakeCredential(): Credential { return this.#delegationPart; } @@ -131,7 +131,7 @@ export class BaseAddress { const network = data[0] & 0b0000_1111; const paymentCredential = Hash28ByteBase16(Buffer.from(data.slice(1, 29)).toString('hex')); - const stakingCredential = Hash28ByteBase16(Buffer.from(data.slice(29, 57)).toString('hex')); + const stakeCredential = Hash28ByteBase16(Buffer.from(data.slice(29, 57)).toString('hex')); const delegationCredType = type === AddressType.BasePaymentKeyStakeScript || type === AddressType.BasePaymentScriptStakeScript @@ -145,7 +145,7 @@ export class BaseAddress { return new Address({ delegationPart: { - hash: stakingCredential, + hash: stakeCredential, type: delegationCredType }, networkId: network, diff --git a/packages/core/src/Cardano/Address/PointerAddress.ts b/packages/core/src/Cardano/Address/PointerAddress.ts index 3b14313d106..4ca28b12092 100644 --- a/packages/core/src/Cardano/Address/PointerAddress.ts +++ b/packages/core/src/Cardano/Address/PointerAddress.ts @@ -65,7 +65,7 @@ export type CertIndex = OpaqueNumber<'CertIndex'>; export const CertIndex = (value: number): CertIndex => value as unknown as CertIndex; /** - * A pointer that indirectly specifies the staking key that should control the stake for the address. It references + * A pointer that indirectly specifies the stake key that should control the stake for the address. It references * a stake key by a location on the blockchain of the stake key registration certificate. */ export type Pointer = { @@ -75,7 +75,7 @@ export type Pointer = { }; /** - * A pointer address indirectly specifies the staking key that should control the stake for the address. It references + * A pointer address indirectly specifies the stake key that should control the stake for the address. It references * a stake key by a stake key pointer, which is a location on the blockchain of the stake key registration certificate * for that key. */ @@ -103,7 +103,7 @@ export class PointerAddress { * * @param networkId The Network identifier. * @param payment The payment credential. - * @param pointer A pointer that indirectly specifies the staking key location on chain. + * @param pointer A pointer that indirectly specifies the stake key location on chain. */ static fromCredentials(networkId: NetworkId, payment: Credential, pointer: Pointer): PointerAddress { let type = AddressType.PointerKey; @@ -126,7 +126,7 @@ export class PointerAddress { } /** - * The stake credential pointer. This pointer indirectly specifies the staking key that should control + * The stake credential pointer. This pointer indirectly specifies the stake key that should control * the stake for the address. */ getStakePointer(): Pointer { diff --git a/packages/core/src/Cardano/Address/RewardAddress.ts b/packages/core/src/Cardano/Address/RewardAddress.ts index 186b9cc2afc..824c3d523c2 100644 --- a/packages/core/src/Cardano/Address/RewardAddress.ts +++ b/packages/core/src/Cardano/Address/RewardAddress.ts @@ -5,7 +5,7 @@ import { InvalidArgumentError } from '@cardano-sdk/util'; import { NetworkId } from '../ChainId'; /** - * A reward address is a cryptographic hash of the public staking key of the address. Reward account addresses are used + * A reward address is a cryptographic hash of the public stake key of the address. Reward account addresses are used * to distribute rewards for participating in the proof-of-stake protocol (either directly or via delegation). */ export class RewardAddress { @@ -47,7 +47,7 @@ export class RewardAddress { /** * Gets the payment credential part of the reward address. * - * Note: by convention, the key inside reward addresses are NOT considered staking credentials, + * Note: by convention, the key inside reward addresses are NOT considered stake credentials, * pointer addresses and the chain history is required to resolve its associated credential */ getPaymentCredential(): Credential { @@ -116,7 +116,7 @@ export class RewardAddress { return new Address({ networkId: network, - // Note: by convention, the key inside reward addresses are NOT considered staking credentials, + // Note: by convention, the key inside reward addresses are NOT considered stake credentials, // pointer addresses and the chain history is required to resolve its associated credential paymentPart: { hash: stakeCredential, diff --git a/packages/core/src/Cardano/util/addressesShareAnyKey.ts b/packages/core/src/Cardano/util/addressesShareAnyKey.ts index 6f5645b2893..dab6be8a0fb 100644 --- a/packages/core/src/Cardano/util/addressesShareAnyKey.ts +++ b/packages/core/src/Cardano/util/addressesShareAnyKey.ts @@ -5,8 +5,8 @@ import { PaymentAddress } from '../Address/PaymentAddress'; import { Pointer } from '../Address/PointerAddress'; type PaymentId = { credential: Credential } | { byronRoot: Hash28ByteBase16 }; -type StakingId = { credential: Credential } | { pointer: Pointer }; -type AddressKeyIDs = { paymentId?: PaymentId; stakingId?: StakingId }; +type StakeId = { credential: Credential } | { pointer: Pointer }; +type AddressKeyIDs = { paymentId?: PaymentId; stakeId?: StakeId }; /** * Payment ID is either @@ -31,7 +31,7 @@ const getAddressKeyIDs = (input: Address | PaymentAddress): AddressKeyIDs => { const baseAddr = address.asBase()!; return { paymentId: { credential: baseAddr.getPaymentCredential() }, - stakingId: { credential: baseAddr.getStakingCredential() } + stakeId: { credential: baseAddr.getStakeCredential() } }; } case AddressType.Byron: @@ -50,14 +50,14 @@ const getAddressKeyIDs = (input: Address | PaymentAddress): AddressKeyIDs => { const pointerAddr = address.asPointer()!; return { paymentId: { credential: pointerAddr.getPaymentCredential() }, - stakingId: { pointer: pointerAddr.getStakePointer() } + stakeId: { pointer: pointerAddr.getStakePointer() } }; } case AddressType.RewardKey: case AddressType.RewardScript: { const rewardAddr = address.asReward()!; return { - stakingId: { credential: rewardAddr.getPaymentCredential() } + stakeId: { credential: rewardAddr.getPaymentCredential() } }; } } @@ -74,7 +74,7 @@ const isPaymentIdPresentAndEquals = (id1: PaymentId | undefined, id2: PaymentId return false; }; -const isStakingIdPresentAndEquals = (id1: StakingId | undefined, id2: StakingId | undefined) => { +const isStakeIdPresentAndEquals = (id1: StakeId | undefined, id2: StakeId | undefined) => { if (!id1 || !id2) return false; if ('credential' in id1 && 'credential' in id2) { return id1.credential.hash === id2.credential.hash; @@ -94,7 +94,6 @@ export const addressesShareAnyKey = (address1: PaymentAddress, address2: Payment const ids1 = getAddressKeyIDs(address1); const ids2 = getAddressKeyIDs(address2); return ( - isPaymentIdPresentAndEquals(ids1.paymentId, ids2.paymentId) || - isStakingIdPresentAndEquals(ids1.stakingId, ids2.stakingId) + isPaymentIdPresentAndEquals(ids1.paymentId, ids2.paymentId) || isStakeIdPresentAndEquals(ids1.stakeId, ids2.stakeId) ); }; diff --git a/packages/core/test/Cardano/Address/Address.test.ts b/packages/core/test/Cardano/Address/Address.test.ts index 6b995c95904..a3f8d187b61 100644 --- a/packages/core/test/Cardano/Address/Address.test.ts +++ b/packages/core/test/Cardano/Address/Address.test.ts @@ -118,7 +118,7 @@ describe('Cardano/Address', () => { expect(address.asEnterprise()).toBeUndefined(); expect(baseAddress!.getPaymentCredential()).toEqual(cip19TestVectors.KEY_PAYMENT_CREDENTIAL); - expect(baseAddress!.getStakingCredential()).toEqual(cip19TestVectors.KEY_STAKING_CREDENTIAL); + expect(baseAddress!.getStakeCredential()).toEqual(cip19TestVectors.KEY_STAKE_CREDENTIAL); expect(address.getNetworkId()).toBe(Cardano.NetworkId.Mainnet); expect(address.getType()).toBe(Cardano.AddressType.BasePaymentKeyStakeKey); expect(address.toBech32()).toBe(cip19TestVectors.basePaymentKeyStakeKey); @@ -140,7 +140,7 @@ describe('Cardano/Address', () => { expect(address.asEnterprise()).toBeUndefined(); expect(baseAddress!.getPaymentCredential()).toEqual(cip19TestVectors.KEY_PAYMENT_CREDENTIAL); - expect(baseAddress!.getStakingCredential()).toEqual(cip19TestVectors.KEY_STAKING_CREDENTIAL); + expect(baseAddress!.getStakeCredential()).toEqual(cip19TestVectors.KEY_STAKE_CREDENTIAL); expect(address.getNetworkId()).toBe(Cardano.NetworkId.Testnet); expect(address.getType()).toBe(Cardano.AddressType.BasePaymentKeyStakeKey); expect(address.toBech32()).toBe(cip19TestVectors.testnetBasePaymentKeyStakeKey); @@ -164,7 +164,7 @@ describe('Cardano/Address', () => { expect(address.asEnterprise()).toBeUndefined(); expect(baseAddress!.getPaymentCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); - expect(baseAddress!.getStakingCredential()).toEqual(cip19TestVectors.KEY_STAKING_CREDENTIAL); + expect(baseAddress!.getStakeCredential()).toEqual(cip19TestVectors.KEY_STAKE_CREDENTIAL); expect(address.getNetworkId()).toBe(Cardano.NetworkId.Mainnet); expect(address.getType()).toBe(Cardano.AddressType.BasePaymentScriptStakeKey); expect(address.toBech32()).toBe(cip19TestVectors.basePaymentScriptStakeKey); @@ -186,7 +186,7 @@ describe('Cardano/Address', () => { expect(address.asEnterprise()).toBeUndefined(); expect(baseAddress!.getPaymentCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); - expect(baseAddress!.getStakingCredential()).toEqual(cip19TestVectors.KEY_STAKING_CREDENTIAL); + expect(baseAddress!.getStakeCredential()).toEqual(cip19TestVectors.KEY_STAKE_CREDENTIAL); expect(address.getNetworkId()).toBe(Cardano.NetworkId.Testnet); expect(address.getType()).toBe(Cardano.AddressType.BasePaymentScriptStakeKey); expect(address.toBech32()).toBe(cip19TestVectors.testnetBasePaymentScriptStakeKey); @@ -210,7 +210,7 @@ describe('Cardano/Address', () => { expect(address.asEnterprise()).toBeUndefined(); expect(baseAddress!.getPaymentCredential()).toEqual(cip19TestVectors.KEY_PAYMENT_CREDENTIAL); - expect(baseAddress!.getStakingCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); + expect(baseAddress!.getStakeCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); expect(address.getNetworkId()).toBe(Cardano.NetworkId.Mainnet); expect(address.getType()).toBe(Cardano.AddressType.BasePaymentKeyStakeScript); expect(address.toBech32()).toBe(cip19TestVectors.basePaymentKeyStakeScript); @@ -232,7 +232,7 @@ describe('Cardano/Address', () => { expect(address.asEnterprise()).toBeUndefined(); expect(baseAddress!.getPaymentCredential()).toEqual(cip19TestVectors.KEY_PAYMENT_CREDENTIAL); - expect(baseAddress!.getStakingCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); + expect(baseAddress!.getStakeCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); expect(address.getNetworkId()).toBe(Cardano.NetworkId.Testnet); expect(address.getType()).toBe(Cardano.AddressType.BasePaymentKeyStakeScript); expect(address.toBech32()).toBe(cip19TestVectors.testnetBasePaymentKeyStakeScript); @@ -256,7 +256,7 @@ describe('Cardano/Address', () => { expect(address.asEnterprise()).toBeUndefined(); expect(baseAddress!.getPaymentCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); - expect(baseAddress!.getStakingCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); + expect(baseAddress!.getStakeCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); expect(address.getNetworkId()).toBe(Cardano.NetworkId.Mainnet); expect(address.getType()).toBe(Cardano.AddressType.BasePaymentScriptStakeScript); expect(address.toBech32()).toBe(cip19TestVectors.basePaymentScriptStakeScript); @@ -278,7 +278,7 @@ describe('Cardano/Address', () => { expect(address.asEnterprise()).toBeUndefined(); expect(baseAddress!.getPaymentCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); - expect(baseAddress!.getStakingCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); + expect(baseAddress!.getStakeCredential()).toEqual(cip19TestVectors.SCRIPT_CREDENTIAL); expect(address.getNetworkId()).toBe(Cardano.NetworkId.Testnet); expect(address.getType()).toBe(Cardano.AddressType.BasePaymentScriptStakeScript); expect(address.toBech32()).toBe(cip19TestVectors.testnetBasePaymentScriptStakeScript); @@ -509,7 +509,7 @@ describe('Cardano/Address', () => { expect(address.asBase()).toBeUndefined(); expect(address.asPointer()).toBeUndefined(); - expect(reward!.getPaymentCredential()).toEqual(cip19TestVectors.KEY_STAKING_CREDENTIAL); + expect(reward!.getPaymentCredential()).toEqual(cip19TestVectors.KEY_STAKE_CREDENTIAL); expect(address.getNetworkId()).toBe(Cardano.NetworkId.Mainnet); expect(address.getType()).toBe(Cardano.AddressType.RewardKey); expect(address.toBech32()).toBe(cip19TestVectors.rewardKey); @@ -528,7 +528,7 @@ describe('Cardano/Address', () => { expect(address.asBase()).toBeUndefined(); expect(address.asPointer()).toBeUndefined(); - expect(reward!.getPaymentCredential()).toEqual(cip19TestVectors.KEY_STAKING_CREDENTIAL); + expect(reward!.getPaymentCredential()).toEqual(cip19TestVectors.KEY_STAKE_CREDENTIAL); expect(address.getNetworkId()).toBe(Cardano.NetworkId.Testnet); expect(address.getType()).toBe(Cardano.AddressType.RewardKey); expect(address.toBech32()).toBe(cip19TestVectors.testnetRewardKey); diff --git a/packages/core/test/Cardano/Address/BaseAddress.test.ts b/packages/core/test/Cardano/Address/BaseAddress.test.ts index 4b653be4301..3ecb2462b69 100644 --- a/packages/core/test/Cardano/Address/BaseAddress.test.ts +++ b/packages/core/test/Cardano/Address/BaseAddress.test.ts @@ -6,7 +6,7 @@ describe('Cardano/Address/BaseAddress', () => { const address = Cardano.BaseAddress.fromCredentials( Cardano.NetworkId.Mainnet, cip19TestVectors.KEY_PAYMENT_CREDENTIAL, - cip19TestVectors.KEY_STAKING_CREDENTIAL + cip19TestVectors.KEY_STAKE_CREDENTIAL ); expect(address.toAddress().toBech32()).toEqual(cip19TestVectors.basePaymentKeyStakeKey); }); diff --git a/packages/core/test/Cardano/Address/RewardAddress.test.ts b/packages/core/test/Cardano/Address/RewardAddress.test.ts index 4e2f341e06c..78e81edd177 100644 --- a/packages/core/test/Cardano/Address/RewardAddress.test.ts +++ b/packages/core/test/Cardano/Address/RewardAddress.test.ts @@ -5,7 +5,7 @@ describe('Cardano/Address/RewardAddress', () => { it('fromCredentials can build the correct RewardAddress instance', () => { const address = Cardano.RewardAddress.fromCredentials( Cardano.NetworkId.Mainnet, - cip19TestVectors.KEY_STAKING_CREDENTIAL + cip19TestVectors.KEY_STAKE_CREDENTIAL ); expect(address.toAddress().toBech32()).toEqual(cip19TestVectors.rewardKey); }); diff --git a/packages/core/test/Cardano/util/addressesShareAnyKey.test.ts b/packages/core/test/Cardano/util/addressesShareAnyKey.test.ts index 5e99b4a37a0..1f38e201acf 100644 --- a/packages/core/test/Cardano/util/addressesShareAnyKey.test.ts +++ b/packages/core/test/Cardano/util/addressesShareAnyKey.test.ts @@ -95,7 +95,7 @@ describe('addressesShareAnyKey', () => { ).toBe(true); }); - it('returns true when addresses have the same staking credential key hash', () => { + it('returns true when addresses have the same stake credential key hash', () => { const addr1 = Cardano.BaseAddress.fromCredentials( Cardano.NetworkId.Mainnet, { diff --git a/packages/e2e/local-network/scripts/pools/update-node-utils.sh b/packages/e2e/local-network/scripts/pools/update-node-utils.sh index 375f5edfd8d..dc81a4cb1d4 100755 --- a/packages/e2e/local-network/scripts/pools/update-node-utils.sh +++ b/packages/e2e/local-network/scripts/pools/update-node-utils.sh @@ -67,22 +67,22 @@ updatePool() coldKey=network-files/pools/cold"${SP_NODE_ID}".skey vrfKey=network-files/pools/vrf"${SP_NODE_ID}".vkey delegatorPaymentKey=network-files/stake-delegator-keys/payment"${SP_NODE_ID}".vkey - delegatorStakingKey=network-files/stake-delegator-keys/staking"${SP_NODE_ID}".vkey + delegatorStakeKey=network-files/stake-delegator-keys/staking"${SP_NODE_ID}".vkey delegatorPaymentSKey=network-files/stake-delegator-keys/payment"${SP_NODE_ID}".skey - delegatorStakingSKey=network-files/stake-delegator-keys/staking"${SP_NODE_ID}".skey + delegatorStakeSKey=network-files/stake-delegator-keys/staking"${SP_NODE_ID}".skey POOL_ID=$(cardano-cli stake-pool id --cold-verification-key-file "$coldVKey" --output-format "hex") # funding pool owner stake address - stakingAddr=$(cardano-cli address build --payment-verification-key-file "$genesisVKey" --stake-verification-key-file "$stakeVKey" --testnet-magic 888) - currentBalance=$(getAddressBalance "$stakingAddr") + stakeAddr=$(cardano-cli address build --payment-verification-key-file "$genesisVKey" --stake-verification-key-file "$stakeVKey" --testnet-magic 888) + currentBalance=$(getAddressBalance "$stakeAddr") utxo=$(cardano-cli query utxo --address "$genesisAddr" --testnet-magic 888 | awk 'NR == 3 {printf("%s#%s", $1, $2)}') cardano-cli transaction build \ --babbage-era \ --change-address "$genesisAddr" \ --tx-in "$utxo" \ - --tx-out "$stakingAddr"+"$POOL_OWNER_STAKE" \ + --tx-out "$stakeAddr"+"$POOL_OWNER_STAKE" \ --testnet-magic 888 \ --out-file wallets-tx.raw 2>&1 @@ -94,11 +94,11 @@ updatePool() cardano-cli transaction submit --testnet-magic 888 --tx-file wallets-tx.signed 2>&1 - updatedBalance=$(getAddressBalance "$stakingAddr") + updatedBalance=$(getAddressBalance "$stakeAddr") while [ "$currentBalance" -eq "$updatedBalance" ] do - updatedBalance=$(getAddressBalance "$stakingAddr") + updatedBalance=$(getAddressBalance "$stakeAddr") sleep 1 done @@ -216,12 +216,12 @@ updatePool() # register delegator stake address echo "Registering delegator stake certificate ${SP_NODE_ID}..." - paymentAddr=$(cardano-cli address build --payment-verification-key-file "$delegatorPaymentKey" --stake-verification-key-file "$delegatorStakingKey" --testnet-magic 888) + paymentAddr=$(cardano-cli address build --payment-verification-key-file "$delegatorPaymentKey" --stake-verification-key-file "$delegatorStakeKey" --testnet-magic 888) currentBalance=$(getAddressBalance "$paymentAddr") # create pool delegation certificate cardano-cli stake-address delegation-certificate \ - --stake-verification-key-file "$delegatorStakingKey" \ + --stake-verification-key-file "$delegatorStakeKey" \ --stake-pool-id "$POOL_ID" \ --out-file deleg.cert @@ -258,7 +258,7 @@ updatePool() cardano-cli transaction sign \ --tx-body-file tx.raw \ --signing-key-file "$delegatorPaymentSKey" \ - --signing-key-file "$delegatorStakingSKey" \ + --signing-key-file "$delegatorStakeSKey" \ --testnet-magic 888 \ --out-file tx.signed @@ -384,21 +384,21 @@ deregisterPool() coldVKey=network-files/pools/cold"${SP_NODE_ID}".vkey coldKey=network-files/pools/cold"${SP_NODE_ID}".skey delegatorPaymentKey=network-files/stake-delegator-keys/payment"${SP_NODE_ID}".vkey - delegatorStakingKey=network-files/stake-delegator-keys/staking"${SP_NODE_ID}".vkey + delegatorStakeKey=network-files/stake-delegator-keys/staking"${SP_NODE_ID}".vkey delegatorPaymentSKey=network-files/stake-delegator-keys/payment"${SP_NODE_ID}".skey - delegatorStakingSKey=network-files/stake-delegator-keys/staking"${SP_NODE_ID}".skey + delegatorStakeSKey=network-files/stake-delegator-keys/staking"${SP_NODE_ID}".skey # We are going to redelegate this stake to dbSync can index it properly. echo "Registering delegator stake certificate ${SP_NODE_ID}..." - paymentAddr=$(cardano-cli address build --payment-verification-key-file "$delegatorPaymentKey" --stake-verification-key-file "$delegatorStakingKey" --testnet-magic 888) + paymentAddr=$(cardano-cli address build --payment-verification-key-file "$delegatorPaymentKey" --stake-verification-key-file "$delegatorStakeKey" --testnet-magic 888) currentBalance=$(getAddressBalance "$paymentAddr") POOL_ID=$(cardano-cli stake-pool id --cold-verification-key-file "$coldVKey" --output-format "hex") # create pool delegation certificate cardano-cli stake-address delegation-certificate \ - --stake-verification-key-file "$delegatorStakingKey" \ + --stake-verification-key-file "$delegatorStakeKey" \ --stake-pool-id "$POOL_ID" \ --out-file deleg.cert @@ -435,7 +435,7 @@ deregisterPool() cardano-cli transaction sign \ --tx-body-file tx.raw \ --signing-key-file "$delegatorPaymentSKey" \ - --signing-key-file "$delegatorStakingSKey" \ + --signing-key-file "$delegatorStakeSKey" \ --testnet-magic 888 \ --out-file tx.signed diff --git a/packages/e2e/test/web-extension/specs/wallet.spec.ts b/packages/e2e/test/web-extension/specs/wallet.spec.ts index fc7004382e5..4cdf7b73309 100644 --- a/packages/e2e/test/web-extension/specs/wallet.spec.ts +++ b/packages/e2e/test/web-extension/specs/wallet.spec.ts @@ -37,7 +37,7 @@ describe('wallet', () => { const dappBtnRun = '#bp3-tab-panel_TabsExample_1 > div > button'; const dappSubmittedTxConfirmation = '#root > div > p:last-child'; const dappChangeAddress = '#root > div > p:nth-child(11)'; - const dappStakingAddress = '#root > div > p:nth-child(12)'; + const dappStakeAddress = '#root > div > p:nth-child(12)'; const dappUsedAddress = '#root > div > p:nth-child(13)'; const btnDelegate = '#multiDelegation .delegate button'; @@ -120,7 +120,7 @@ describe('wallet', () => { it('dapp gets correct addresses from cip30 wallet api', async () => { await expect($(dappChangeAddress)).toHaveTextContaining(walletAddr1); - await expect($(dappStakingAddress)).toHaveTextContaining(walletStakeAddr1); + await expect($(dappStakeAddress)).toHaveTextContaining(walletStakeAddr1); await expect($(dappUsedAddress)).toHaveTextContaining(walletAddr1); }); }); diff --git a/packages/hardware-ledger/src/transformers/requiredSigners.ts b/packages/hardware-ledger/src/transformers/requiredSigners.ts index 649602a1107..4378bc87308 100644 --- a/packages/hardware-ledger/src/transformers/requiredSigners.ts +++ b/packages/hardware-ledger/src/transformers/requiredSigners.ts @@ -16,23 +16,23 @@ export const toRequiredSigner: Transform< }); const stakeCredKnownAddress = context?.knownAddresses.find((address) => { - const stakingCredential = Cardano.RewardAccount.toHash(address.rewardAccount); - return stakingCredential && stakingCredential.toString() === keyHash; + const stakeCredential = Cardano.RewardAccount.toHash(address.rewardAccount); + return stakeCredential && stakeCredential.toString() === keyHash; }); - const paymentPath = paymentCredKnownAddress ? paymentKeyPathFromGroupedAddress(paymentCredKnownAddress) : null; - const stakingPath = stakeCredKnownAddress ? stakeKeyPathFromGroupedAddress(stakeCredKnownAddress) : null; + const paymentKeyPath = paymentCredKnownAddress ? paymentKeyPathFromGroupedAddress(paymentCredKnownAddress) : null; + const stakeKeyPath = stakeCredKnownAddress ? stakeKeyPathFromGroupedAddress(stakeCredKnownAddress) : null; - if (paymentPath) { + if (paymentKeyPath) { return { - path: paymentPath, + path: paymentKeyPath, type: Ledger.TxRequiredSignerType.PATH }; } - if (stakingPath) { + if (stakeKeyPath) { return { - path: stakingPath, + path: stakeKeyPath, type: Ledger.TxRequiredSignerType.PATH }; } diff --git a/packages/hardware-ledger/src/transformers/txOut.ts b/packages/hardware-ledger/src/transformers/txOut.ts index f922eeb68c9..0a63e428b53 100644 --- a/packages/hardware-ledger/src/transformers/txOut.ts +++ b/packages/hardware-ledger/src/transformers/txOut.ts @@ -22,16 +22,16 @@ const toDestination: Transform address.address === txOut.address); if (knownAddress) { - const spendingPath = paymentKeyPathFromGroupedAddress(knownAddress); - const stakingPath = stakeKeyPathFromGroupedAddress(knownAddress); + const paymentKeyPath = paymentKeyPathFromGroupedAddress(knownAddress); + const stakeKeyPath = stakeKeyPathFromGroupedAddress(knownAddress); - if (!stakingPath) throw new InvalidArgumentError('txOut', 'Missing staking key key path.'); + if (!stakeKeyPath) throw new InvalidArgumentError('txOut', 'Missing stake key key path.'); return { params: { params: { - spendingPath, - stakingPath + spendingPath: paymentKeyPath, + stakingPath: stakeKeyPath }, type: Ledger.AddressType.BASE_PAYMENT_KEY_STAKE_KEY }, diff --git a/packages/key-management/src/util/ownSignatureKeyPaths.ts b/packages/key-management/src/util/ownSignatureKeyPaths.ts index 295cba426e4..ba36385da9d 100644 --- a/packages/key-management/src/util/ownSignatureKeyPaths.ts +++ b/packages/key-management/src/util/ownSignatureKeyPaths.ts @@ -14,7 +14,7 @@ import uniqWith from 'lodash/uniqWith'; * @param txBody The transaction body. */ // eslint-disable-next-line complexity -const getStakingKeyPaths = ( +const getStakeKeyPaths = ( groupedAddresses: GroupedAddress[], txBody: Cardano.TxBody // eslint-disable-next-line sonarjs/cognitive-complexity @@ -80,13 +80,13 @@ const getRequiredSignersKeyPaths = ( for (const keyHash of keyHashes) { for (const address of groupedAddresses) { const paymentCredential = Cardano.Address.fromBech32(address.address)?.asBase()?.getPaymentCredential().hash; - const stakingCredential = Cardano.RewardAccount.toHash(address.rewardAccount); + const stakeCredential = Cardano.RewardAccount.toHash(address.rewardAccount); if (paymentCredential && paymentCredential.toString() === keyHash) { paths.add({ index: address.index, role: Number(address.type) }); } - if (stakingCredential && address.stakeKeyDerivationPath && stakingCredential.toString() === keyHash) { + if (stakeCredential && address.stakeKeyDerivationPath && stakeCredential.toString() === keyHash) { paths.add(address.stakeKeyDerivationPath); } } @@ -96,7 +96,7 @@ const getRequiredSignersKeyPaths = ( }; /** - * Assumes that a single staking key is used for all addresses (index=0) + * Assumes that a single stake key is used for all addresses (index=0) * * @returns {AccountKeyDerivationPath[]} derivation paths for keys to sign transaction with */ @@ -121,7 +121,7 @@ export const ownSignatureKeyPaths = async ( return uniqWith( [ ...paymentKeyPaths, - ...getStakingKeyPaths(knownAddresses, txBody), + ...getStakeKeyPaths(knownAddresses, txBody), ...getRequiredSignersKeyPaths(knownAddresses, txBody.requiredExtraSignatures) ], isEqual diff --git a/packages/util-dev/src/Cip19TestVectors.ts b/packages/util-dev/src/Cip19TestVectors.ts index 1d8b8a99004..7f60794bc32 100644 --- a/packages/util-dev/src/Cip19TestVectors.ts +++ b/packages/util-dev/src/Cip19TestVectors.ts @@ -12,7 +12,7 @@ export const KEY_PAYMENT_CREDENTIAL: Cardano.Credential = { type: Cardano.CredentialType.KeyHash }; -export const KEY_STAKING_CREDENTIAL: Cardano.Credential = { +export const KEY_STAKE_CREDENTIAL: Cardano.Credential = { hash: STAKE_KEY_HASH as Hash28ByteBase16, type: Cardano.CredentialType.KeyHash }; diff --git a/packages/util-dev/src/mockProviders/mockRewardsProvider.ts b/packages/util-dev/src/mockProviders/mockRewardsProvider.ts index 47ee66f6319..e5b6d475200 100644 --- a/packages/util-dev/src/mockProviders/mockRewardsProvider.ts +++ b/packages/util-dev/src/mockProviders/mockRewardsProvider.ts @@ -30,7 +30,7 @@ export const generateStakePools = (qty: number): Cardano.StakePool[] => numerator: 27 }, metadata: { - description: 'Pool a of the banderini devtest staking pools', + description: 'Pool a of the banderini devtest stake pools', homepage: 'http://www.banderini.net', name: 'banderini-devtest-a', ticker: 'BANDA' diff --git a/packages/wallet/src/services/AddressDiscovery/HDSequentialDiscovery.ts b/packages/wallet/src/services/AddressDiscovery/HDSequentialDiscovery.ts index fb58d13210f..1f56c8908f0 100644 --- a/packages/wallet/src/services/AddressDiscovery/HDSequentialDiscovery.ts +++ b/packages/wallet/src/services/AddressDiscovery/HDSequentialDiscovery.ts @@ -24,7 +24,7 @@ const addressHasTx = async (address: GroupedAddress, chainHistoryProvider: Chain }; /** - * Search for all base addresses composed with the given payment and staking credentials. + * Search for all base addresses composed with the given payment and stake credentials. * * @param keyAgent The key agent controlling the root key to be used to derive the addresses to be discovered. * @param chainHistoryProvider The chain history provider. diff --git a/packages/wallet/src/services/ChangeAddress/DynamicChangeAddressResolver.ts b/packages/wallet/src/services/ChangeAddress/DynamicChangeAddressResolver.ts index 4aae2c7376e..8e51765bdc1 100644 --- a/packages/wallet/src/services/ChangeAddress/DynamicChangeAddressResolver.ts +++ b/packages/wallet/src/services/ChangeAddress/DynamicChangeAddressResolver.ts @@ -78,12 +78,12 @@ const getSpentFromRewardAccount = (rewardAccount: Cardano.RewardAccount, inputs: .filter((utxo) => { const address = Cardano.Address.fromString(utxo[0].address)?.asBase(); - // Address may not have staking credential. + // Address may not have stake credential. if (!address) return false; return ( (Cardano.RewardAccount.toHash(rewardAccount) as unknown as Crypto.Hash28ByteBase16) === - address.getStakingCredential().hash + address.getStakeCredential().hash ); }) .map((utxo) => utxo[1].value.coins) @@ -100,12 +100,12 @@ const getDepositToRewardAccount = (rewardAccount: Cardano.RewardAccount, outputs .filter((txOut) => { const address = Cardano.Address.fromString(txOut.address)?.asBase(); - // Address may not have staking credential. + // Address may not have stake credential. if (!address) return false; return ( (Cardano.RewardAccount.toHash(rewardAccount) as unknown as Crypto.Hash28ByteBase16) === - address.getStakingCredential().hash + address.getStakeCredential().hash ); }) .map((txOut) => txOut.value.coins) diff --git a/packages/wallet/test/services/addressDiscovery/mockData.ts b/packages/wallet/test/services/addressDiscovery/mockData.ts index a88268e2258..9c1ad2aa05f 100644 --- a/packages/wallet/test/services/addressDiscovery/mockData.ts +++ b/packages/wallet/test/services/addressDiscovery/mockData.ts @@ -46,7 +46,7 @@ export const prepareMockKeyAgentWithData = () => { const data = new Array>(); const stakeKeys = new Array(); - // Add 20 staking addresses credentials. + // Add 20 stake addresses credentials. for (let i = 0; i < 20; ++i) { stakeKeys.push({ accountIndex: 0, @@ -101,11 +101,11 @@ export const mockChainHistoryProvider: ChainHistoryProvider = { const stakeIndex = Number(segments[2]); const isPaymentEven = paymentIndex % 2 === 0; const isExternalAddress = Number(segments[3]) === 0; - const isStakingAddress = paymentIndex === 0 && stakeIndex > 0; + const isStakeAddress = paymentIndex === 0 && stakeIndex > 0; return Promise.resolve({ pageResults: new Array(), - totalResultCount: !isStakingAddress && isExternalAddress && isPaymentEven && paymentIndex < 100 ? 1 : 0 + totalResultCount: !isStakeAddress && isExternalAddress && isPaymentEven && paymentIndex < 100 ? 1 : 0 }); }