From 9a8f591df8b45a7ed7d0b72320379c7504599a03 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Tue, 29 Oct 2024 07:01:47 +0000 Subject: [PATCH 1/4] feat: use function to derive chain reference from genesis hash --- .../useWalletConnectConnector.ts | 5 +++- ...xtractWalletConnectNamespaceFromNetwork.ts | 9 ++++++- src/extension/config/networks.ts | 5 ---- .../types/networks/IChainNamespace.ts | 1 - .../chainReferenceFromGenesisHash.test.ts | 25 +++++++++++++++++++ .../chainReferenceFromGenesisHash.ts | 19 ++++++++++++++ .../chainReferenceFromGenesisHash/index.ts | 1 + 7 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 src/extension/utils/chainReferenceFromGenesisHash/chainReferenceFromGenesisHash.test.ts create mode 100644 src/extension/utils/chainReferenceFromGenesisHash/chainReferenceFromGenesisHash.ts create mode 100644 src/extension/utils/chainReferenceFromGenesisHash/index.ts diff --git a/dapp-example/hooks/useWalletConnectConnector/useWalletConnectConnector.ts b/dapp-example/hooks/useWalletConnectConnector/useWalletConnectConnector.ts index 8f264bc7..fcb5b331 100644 --- a/dapp-example/hooks/useWalletConnectConnector/useWalletConnectConnector.ts +++ b/dapp-example/hooks/useWalletConnectConnector/useWalletConnectConnector.ts @@ -17,6 +17,7 @@ import type { } from '../../types'; // utils +import chainReferenceFromGenesisHash from '@extension/utils/chainReferenceFromGenesisHash'; import { getAccountInformation, extractWalletConnectNamespaceFromNetwork, @@ -132,7 +133,9 @@ export default function useWalletConnectConnector({ try { return await signClient.request<(string | null)[]>({ topic: session.topic, - chainId: `${network.namespace.key}:${network.namespace.reference}`, + chainId: `${network.namespace.key}:${chainReferenceFromGenesisHash( + network.genesisHash + )}`, request: { method: network.namespace.key === 'algorand' diff --git a/dapp-example/utils/extractWalletConnectNamespaceFromNetwork.ts b/dapp-example/utils/extractWalletConnectNamespaceFromNetwork.ts index a05fc682..747a22fd 100644 --- a/dapp-example/utils/extractWalletConnectNamespaceFromNetwork.ts +++ b/dapp-example/utils/extractWalletConnectNamespaceFromNetwork.ts @@ -3,6 +3,9 @@ import type { SessionTypes } from '@walletconnect/types'; // types import type { INetwork } from '@extension/types'; +// utils +import chainReferenceFromGenesisHash from '@extension/utils/chainReferenceFromGenesisHash'; + /** * Extracts the WalletConnect namespace from the network. * @param {INetwork} network - the network to extract the namespace from. @@ -13,7 +16,11 @@ export default function extractWalletConnectNamespaceFromNetwork( ): SessionTypes.BaseNamespace { return { accounts: [], - chains: [`${network.namespace.key}:${network.namespace.reference}`], + chains: [ + `${network.namespace.key}:${chainReferenceFromGenesisHash( + network.genesisHash + )}`, + ], events: [], methods: network.namespace.methods, }; diff --git a/src/extension/config/networks.ts b/src/extension/config/networks.ts index a35088e9..c894e3d6 100644 --- a/src/extension/config/networks.ts +++ b/src/extension/config/networks.ts @@ -70,7 +70,6 @@ const networks: INetwork[] = [ namespace: { key: 'avm', methods: ['avm_signTransactions', 'avm_signMessage'], - reference: 'r20fSQI8gWe_kFZziNonSPCXLwcQmH_n', }, nativeCurrency: { decimals: 6, @@ -132,7 +131,6 @@ const networks: INetwork[] = [ namespace: { key: 'avm', methods: ['avm_signTransactions', 'avm_signMessage'], - reference: 'IXnoWtviVVJW5LGivNFc0Dq14V3kqaXu', }, nativeCurrency: { decimals: 6, @@ -190,7 +188,6 @@ const networks: INetwork[] = [ namespace: { key: 'algorand', methods: ['algo_signTxn'], - reference: 'wGHE2Pwdvd7S12BL5FaOP20EGYesN73k', }, nativeCurrency: { decimals: 6, @@ -234,7 +231,6 @@ const networks: INetwork[] = [ namespace: { key: 'algorand', methods: ['algo_signTxn'], - reference: 'mFgazF-2uRS1tMiL9dsj01hJGySEmPN2', }, nativeCurrency: { decimals: 6, @@ -282,7 +278,6 @@ const networks: INetwork[] = [ namespace: { key: 'algorand', methods: ['algo_signTxn'], - reference: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDe', }, nativeCurrency: { decimals: 6, diff --git a/src/extension/types/networks/IChainNamespace.ts b/src/extension/types/networks/IChainNamespace.ts index 8185371c..951912d3 100644 --- a/src/extension/types/networks/IChainNamespace.ts +++ b/src/extension/types/networks/IChainNamespace.ts @@ -1,6 +1,5 @@ interface IChainNamespace { key: string; - reference: string; methods: string[]; } diff --git a/src/extension/utils/chainReferenceFromGenesisHash/chainReferenceFromGenesisHash.test.ts b/src/extension/utils/chainReferenceFromGenesisHash/chainReferenceFromGenesisHash.test.ts new file mode 100644 index 00000000..98f210cc --- /dev/null +++ b/src/extension/utils/chainReferenceFromGenesisHash/chainReferenceFromGenesisHash.test.ts @@ -0,0 +1,25 @@ +// utils +import chainReferenceFromGenesisHash from './chainReferenceFromGenesisHash'; + +interface ITestParams { + expected: string; + genesisHash: string; +} + +describe(`${__dirname}#chainReferenceFromGenesisHash`, () => { + it.each([ + { + expected: 'r20fSQI8gWe_kFZziNonSPCXLwcQmH_n', + genesisHash: 'r20fSQI8gWe/kFZziNonSPCXLwcQmH/nxROvnnueWOk=', + }, + { + expected: 'wGHE2Pwdvd7S12BL5FaOP20EGYesN73k', + genesisHash: 'wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=', + }, + ])( + `should convert the standard unit of "$genesisHash" to a chain reference of "$expected"`, + ({ expected, genesisHash }) => { + expect(chainReferenceFromGenesisHash(genesisHash)).toBe(expected); + } + ); +}); diff --git a/src/extension/utils/chainReferenceFromGenesisHash/chainReferenceFromGenesisHash.ts b/src/extension/utils/chainReferenceFromGenesisHash/chainReferenceFromGenesisHash.ts new file mode 100644 index 00000000..7a33a2d6 --- /dev/null +++ b/src/extension/utils/chainReferenceFromGenesisHash/chainReferenceFromGenesisHash.ts @@ -0,0 +1,19 @@ +import { + decode as decodeBase64, + encodeURLSafe as encodeBase64URL, +} from '@stablelib/base64'; + +/** + * Convenience function to get the CAIP-0002 chain reference for an AVM genesis hash. This is the first 32 bytes, + * converted to URL safe base64. + * @param {string} genesisHash - An AVM genesis hash. + * @returns {string} The AVM genesis hash converted to the CAIP-0002 chain reference. + * @see {@link https://chainagnostic.org/CAIPs/caip-2} + */ +export default function chainReferenceFromGenesisHash( + genesisHash: string +): string { + const decodedGenesisHash = decodeBase64(genesisHash); + + return encodeBase64URL(decodedGenesisHash).slice(0, 32); +} diff --git a/src/extension/utils/chainReferenceFromGenesisHash/index.ts b/src/extension/utils/chainReferenceFromGenesisHash/index.ts new file mode 100644 index 00000000..0efe98ac --- /dev/null +++ b/src/extension/utils/chainReferenceFromGenesisHash/index.ts @@ -0,0 +1 @@ +export { default } from './chainReferenceFromGenesisHash'; From a114a892752fc25e47a29941d23430f323dbd213 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Tue, 29 Oct 2024 07:12:51 +0000 Subject: [PATCH 2/4] feat: add block to base transaction and rename algorand prefix types --- dapp-example/utils/getAccountInformation.ts | 14 ++--- .../contracts/BaseContract/BaseContract.ts | 8 +-- .../thunks/queryARC0200AssetThunk.ts | 4 +- .../thunks/queryStandardAssetThunk.ts | 8 +-- ...ransactionParamsForSelectedNetworkThunk.ts | 4 +- .../models/NetworkClient/NetworkClient.ts | 46 +++++++-------- .../types/avm/IAVMAccountInformation.ts | 12 ++++ .../types/avm/IAVMAccountTransaction.ts | 10 ++++ src/extension/types/avm/IAVMApplication.ts | 12 ++++ .../types/avm/IAVMApplicationParams.ts | 15 +++++ ...ction.ts => IAVMApplicationTransaction.ts} | 10 ++-- src/extension/types/avm/IAVMAsset.ts | 12 ++++ .../types/avm/IAVMAssetConfigTransaction.ts | 9 +++ .../types/avm/IAVMAssetFreezeTransaction.ts | 7 +++ ...andAssetHolding.ts => IAVMAssetHolding.ts} | 4 +- ...orandAssetParams.ts => IAVMAssetParams.ts} | 4 +- ...ion.ts => IAVMAssetTransferTransaction.ts} | 4 +- ...n.ts => IAVMKeyRegistrationTransaction.ts} | 4 +- ...ansaction.ts => IAVMPaymentTransaction.ts} | 4 +- ...e.ts => IAVMPendingTransactionResponse.ts} | 8 +-- .../types/avm/IAVMSearchApplicationsResult.ts | 10 ++++ .../types/avm/IAVMSearchAssetsResult.ts | 10 ++++ src/extension/types/avm/IAVMStateSchema.ts | 6 ++ src/extension/types/avm/IAVMTealKeyValue.ts | 6 ++ src/extension/types/avm/IAVMTealValue.ts | 7 +++ ...tionParams.ts => IAVMTransactionParams.ts} | 4 +- .../types/avm/IAlgorandAccountInformation.ts | 12 ---- .../types/avm/IAlgorandAccountTransaction.ts | 10 ---- .../types/avm/IAlgorandApplication.ts | 12 ---- .../types/avm/IAlgorandApplicationParams.ts | 15 ----- src/extension/types/avm/IAlgorandAsset.ts | 12 ---- .../avm/IAlgorandAssetConfigTransaction.ts | 9 --- .../avm/IAlgorandAssetFreezeTransaction.ts | 7 --- .../avm/IAlgorandSearchApplicationsResult.ts | 10 ---- .../types/avm/IAlgorandSearchAssetsResult.ts | 10 ---- .../types/avm/IAlgorandStateSchema.ts | 6 -- .../types/avm/IAlgorandTealKeyValue.ts | 6 -- src/extension/types/avm/IAlgorandTealValue.ts | 7 --- .../types/avm/IAlgorandTransaction.ts | 55 ------------------ src/extension/types/avm/TAVMTransaction.ts | 56 +++++++++++++++++++ src/extension/types/avm/index.ts | 42 +++++++------- .../types/transactions/IBaseTransaction.ts | 1 + .../filterCustomNodesFromNetwork.test.ts | 1 - .../mapAVMAccountInformationToAccount.ts | 4 +- .../mapAVMTransactionToTransaction/index.ts | 1 + .../mapAVMTransactionToTransaction.ts} | 9 +-- .../parseApplicationTransaction.ts | 12 ++-- .../parseAssetConfigTransaction.ts | 4 +- .../parseAssetFreezeTransaction.ts | 4 +- .../parseAssetTransferTransaction.ts | 4 +- .../parseKeyRegistrationTransaction.ts | 4 +- .../parseNote.ts | 0 .../parsePaymentAndReKeyTransaction.ts | 4 +- .../index.ts | 1 - .../mapStandardAssetFromAlgorandAsset.ts | 4 +- .../parseARC0200Transaction.test.ts | 1 + .../updateAccountInformation.ts | 4 +- .../updateAccountTransactions.ts | 10 ++-- .../updateStandardAssetInformationById.ts | 4 +- 59 files changed, 291 insertions(+), 292 deletions(-) create mode 100644 src/extension/types/avm/IAVMAccountInformation.ts create mode 100644 src/extension/types/avm/IAVMAccountTransaction.ts create mode 100644 src/extension/types/avm/IAVMApplication.ts create mode 100644 src/extension/types/avm/IAVMApplicationParams.ts rename src/extension/types/avm/{IAlgorandApplicationTransaction.ts => IAVMApplicationTransaction.ts} (59%) create mode 100644 src/extension/types/avm/IAVMAsset.ts create mode 100644 src/extension/types/avm/IAVMAssetConfigTransaction.ts create mode 100644 src/extension/types/avm/IAVMAssetFreezeTransaction.ts rename src/extension/types/avm/{IAlgorandAssetHolding.ts => IAVMAssetHolding.ts} (71%) rename src/extension/types/avm/{IAlgorandAssetParams.ts => IAVMAssetParams.ts} (82%) rename src/extension/types/avm/{IAlgorandAssetTransferTransaction.ts => IAVMAssetTransferTransaction.ts} (58%) rename src/extension/types/avm/{IAlgorandKeyRegistrationTransaction.ts => IAVMKeyRegistrationTransaction.ts} (71%) rename src/extension/types/avm/{IAlgorandPaymentTransaction.ts => IAVMPaymentTransaction.ts} (55%) rename src/extension/types/avm/{IAlgorandPendingTransactionResponse.ts => IAVMPendingTransactionResponse.ts} (59%) create mode 100644 src/extension/types/avm/IAVMSearchApplicationsResult.ts create mode 100644 src/extension/types/avm/IAVMSearchAssetsResult.ts create mode 100644 src/extension/types/avm/IAVMStateSchema.ts create mode 100644 src/extension/types/avm/IAVMTealKeyValue.ts create mode 100644 src/extension/types/avm/IAVMTealValue.ts rename src/extension/types/avm/{IAlgorandTransactionParams.ts => IAVMTransactionParams.ts} (65%) delete mode 100644 src/extension/types/avm/IAlgorandAccountInformation.ts delete mode 100644 src/extension/types/avm/IAlgorandAccountTransaction.ts delete mode 100644 src/extension/types/avm/IAlgorandApplication.ts delete mode 100644 src/extension/types/avm/IAlgorandApplicationParams.ts delete mode 100644 src/extension/types/avm/IAlgorandAsset.ts delete mode 100644 src/extension/types/avm/IAlgorandAssetConfigTransaction.ts delete mode 100644 src/extension/types/avm/IAlgorandAssetFreezeTransaction.ts delete mode 100644 src/extension/types/avm/IAlgorandSearchApplicationsResult.ts delete mode 100644 src/extension/types/avm/IAlgorandSearchAssetsResult.ts delete mode 100644 src/extension/types/avm/IAlgorandStateSchema.ts delete mode 100644 src/extension/types/avm/IAlgorandTealKeyValue.ts delete mode 100644 src/extension/types/avm/IAlgorandTealValue.ts delete mode 100644 src/extension/types/avm/IAlgorandTransaction.ts create mode 100644 src/extension/types/avm/TAVMTransaction.ts create mode 100644 src/extension/utils/mapAVMTransactionToTransaction/index.ts rename src/extension/utils/{mapAlgorandTransactionToTransaction/mapAlgorandTransactionToTransaction.ts => mapAVMTransactionToTransaction/mapAVMTransactionToTransaction.ts} (91%) rename src/extension/utils/{mapAlgorandTransactionToTransaction => mapAVMTransactionToTransaction}/parseApplicationTransaction.ts (86%) rename src/extension/utils/{mapAlgorandTransactionToTransaction => mapAVMTransactionToTransaction}/parseAssetConfigTransaction.ts (96%) rename src/extension/utils/{mapAlgorandTransactionToTransaction => mapAVMTransactionToTransaction}/parseAssetFreezeTransaction.ts (87%) rename src/extension/utils/{mapAlgorandTransactionToTransaction => mapAVMTransactionToTransaction}/parseAssetTransferTransaction.ts (86%) rename src/extension/utils/{mapAlgorandTransactionToTransaction => mapAVMTransactionToTransaction}/parseKeyRegistrationTransaction.ts (93%) rename src/extension/utils/{mapAlgorandTransactionToTransaction => mapAVMTransactionToTransaction}/parseNote.ts (100%) rename src/extension/utils/{mapAlgorandTransactionToTransaction => mapAVMTransactionToTransaction}/parsePaymentAndReKeyTransaction.ts (91%) delete mode 100644 src/extension/utils/mapAlgorandTransactionToTransaction/index.ts diff --git a/dapp-example/utils/getAccountInformation.ts b/dapp-example/utils/getAccountInformation.ts index 300ecd38..7e2ab25f 100644 --- a/dapp-example/utils/getAccountInformation.ts +++ b/dapp-example/utils/getAccountInformation.ts @@ -3,11 +3,7 @@ import { Algodv2, IntDecoding } from 'algosdk'; import BigNumber from 'bignumber.js'; // types -import { - IAlgorandAccountInformation, - IAlgorandAsset, - INetwork, -} from '@extension/types'; +import { IAVMAccountInformation, IAVMAsset, INetwork } from '@extension/types'; import { IAccountInformation, IAssetInformation } from '../types'; // utils @@ -18,22 +14,22 @@ export default async function getAccountInformation( network: INetwork ): Promise { const client: Algodv2 = getRandomAlgodClient(network); - const accountInformation: IAlgorandAccountInformation = (await client + const accountInformation: IAVMAccountInformation = (await client .accountInformation(account.address) .setIntDecoding(IntDecoding.BIGINT) - .do()) as IAlgorandAccountInformation; + .do()) as IAVMAccountInformation; const assets: IAssetInformation[] = await Promise.all( accountInformation.assets.map>( (value, index) => new Promise((resolve, reject) => setTimeout(async () => { - let assetInformation: IAlgorandAsset; + let assetInformation: IAVMAsset; try { assetInformation = (await client .getAssetByID(Number(value['asset-id'])) .setIntDecoding(IntDecoding.BIGINT) - .do()) as IAlgorandAsset; + .do()) as IAVMAsset; resolve({ balance: new BigNumber(String(value.amount)), diff --git a/src/extension/contracts/BaseContract/BaseContract.ts b/src/extension/contracts/BaseContract/BaseContract.ts index 71b8428d..f244dca9 100644 --- a/src/extension/contracts/BaseContract/BaseContract.ts +++ b/src/extension/contracts/BaseContract/BaseContract.ts @@ -26,7 +26,7 @@ import { ReadABIContractError } from '@extension/errors'; // types import type { ILogger } from '@common/types'; -import type { IAlgorandAccountInformation } from '@extension/types'; +import type { IAVMAccountInformation } from '@extension/types'; import type { IABIResult, IBaseApplicationOptions, @@ -345,12 +345,12 @@ export default class BaseContract { /** * Gets the account information for the account associated with the application. - * @returns {Promise} the application's account information. + * @returns {Promise} the application's account information. */ - public async applicationAccountInformation(): Promise { + public async applicationAccountInformation(): Promise { return (await this._algod .accountInformation(this.applicationAddress()) - .do()) as IAlgorandAccountInformation; + .do()) as IAVMAccountInformation; } public async boxByName( diff --git a/src/extension/features/add-assets/thunks/queryARC0200AssetThunk.ts b/src/extension/features/add-assets/thunks/queryARC0200AssetThunk.ts index e52b2265..e85d81f7 100644 --- a/src/extension/features/add-assets/thunks/queryARC0200AssetThunk.ts +++ b/src/extension/features/add-assets/thunks/queryARC0200AssetThunk.ts @@ -17,7 +17,7 @@ import NetworkClient from '@extension/models/NetworkClient'; // types import type { - IAlgorandSearchApplicationsResult, + IAVMSearchApplicationsResult, IARC0200Asset, } from '@extension/types'; import type { @@ -57,7 +57,7 @@ const queryARC0200AssetThunk: AsyncThunk< networks, settings, }); - let searchApplicationResult: IAlgorandSearchApplicationsResult; + let searchApplicationResult: IAVMSearchApplicationsResult; let arc200Assets: IARC0200Asset[]; let networkClient: NetworkClient; let nodeID: string | null; diff --git a/src/extension/features/add-assets/thunks/queryStandardAssetThunk.ts b/src/extension/features/add-assets/thunks/queryStandardAssetThunk.ts index 3da7df06..088b6887 100644 --- a/src/extension/features/add-assets/thunks/queryStandardAssetThunk.ts +++ b/src/extension/features/add-assets/thunks/queryStandardAssetThunk.ts @@ -17,8 +17,8 @@ import NetworkClient from '@extension/models/NetworkClient'; // types import type { - IAlgorandAsset, - IAlgorandSearchAssetsResult, + IAVMAsset, + IAVMSearchAssetsResult, IStandardAsset, ITinyManAssetResponse, } from '@extension/types'; @@ -59,7 +59,7 @@ const queryStandardAssetThunk: AsyncThunk< networks, settings, }); - let searchStandardAssetsResult: IAlgorandSearchAssetsResult; + let searchStandardAssetsResult: IAVMSearchAssetsResult; let networkClient: NetworkClient; let verifiedStandardAssets: ITinyManAssetResponse[]; let updatedStandardAssets: IStandardAsset[] = []; @@ -127,7 +127,7 @@ const queryStandardAssetThunk: AsyncThunk< index < searchStandardAssetsResult.assets.length; index++ ) { - const asset: IAlgorandAsset = searchStandardAssetsResult.assets[index]; + const asset: IAVMAsset = searchStandardAssetsResult.assets[index]; const verifiedStandardAsset: ITinyManAssetResponse | null = verifiedStandardAssets.find( (value) => value.id === String(asset.index) diff --git a/src/extension/features/networks/thunks/updateTransactionParamsForSelectedNetworkThunk.ts b/src/extension/features/networks/thunks/updateTransactionParamsForSelectedNetworkThunk.ts index 3b5d7cf4..fdfbdd76 100644 --- a/src/extension/features/networks/thunks/updateTransactionParamsForSelectedNetworkThunk.ts +++ b/src/extension/features/networks/thunks/updateTransactionParamsForSelectedNetworkThunk.ts @@ -14,7 +14,7 @@ import NetworksRepository from '@extension/repositories/NetworksRepository'; // types import type { - IAlgorandTransactionParams, + IAVMTransactionParams, IBaseAsyncThunkConfig, IMainRootState, INetworkWithTransactionParams, @@ -39,7 +39,7 @@ const updateTransactionParamsForSelectedNetworkThunk: AsyncThunk< const networks = getState().networks.items; const online = getState().system.networkConnectivity.online; const settings = getState().settings; - let avmTransactionParams: IAlgorandTransactionParams; + let avmTransactionParams: IAVMTransactionParams; let networkClient: NetworkClient; let network: INetworkWithTransactionParams | null; let updatedAt: Date; diff --git a/src/extension/models/NetworkClient/NetworkClient.ts b/src/extension/models/NetworkClient/NetworkClient.ts index 8c4acb8b..103a4b01 100644 --- a/src/extension/models/NetworkClient/NetworkClient.ts +++ b/src/extension/models/NetworkClient/NetworkClient.ts @@ -23,13 +23,13 @@ import BaseARC0072Indexer from '@extension/models/BaseARC0072Indexer'; // types import type { ILogger } from '@common/types'; import type { - IAlgorandAccountInformation, - IAlgorandAccountTransaction, - IAlgorandAsset, - IAlgorandPendingTransactionResponse, - IAlgorandSearchApplicationsResult, - IAlgorandSearchAssetsResult, - IAlgorandTransactionParams, + IAVMAccountInformation, + IAVMAccountTransaction, + IAVMAsset, + IAVMPendingTransactionResponse, + IAVMSearchApplicationsResult, + IAVMSearchAssetsResult, + IAVMTransactionParams, IARC0072AssetHolding, IARC0072AssetInformation, IARC0200AssetHolding, @@ -89,7 +89,7 @@ export default class NetworkClient { address, delay, nodeID, - }: IByAddressWithDelayOptions): Promise { + }: IByAddressWithDelayOptions): Promise { const algod = this.algodByID(nodeID); return await this._sendRequestWithDelay({ @@ -98,7 +98,7 @@ export default class NetworkClient { (await algod .accountInformation(address) .setIntDecoding(IntDecoding.BIGINT) - .do()) as IAlgorandAccountInformation, + .do()) as IAVMAccountInformation, }); } @@ -312,7 +312,7 @@ export default class NetworkClient { limit, next, nodeID, - }: ILookupAccountTransactionWithDelayOptions): Promise { + }: ILookupAccountTransactionWithDelayOptions): Promise { const indexer = this.indexerByID(nodeID); return await this._sendRequestWithDelay({ @@ -332,7 +332,7 @@ export default class NetworkClient { return (await requestBuilder .setIntDecoding(IntDecoding.BIGINT) - .do()) as IAlgorandAccountTransaction; + .do()) as IAVMAccountTransaction; }, }); } @@ -340,7 +340,7 @@ export default class NetworkClient { /** * Searches for applications by the application ID from the node with a delay. * @param {IOptions} options - options needed to send the request. - * @returns {Promise} a promise that resolves to the applications via the + * @returns {Promise} a promise that resolves to the applications via the * application ID. */ public async searchApplicationsWithDelay({ @@ -349,7 +349,7 @@ export default class NetworkClient { limit, next, nodeID, - }: ISearchApplicationsWithDelayOptions): Promise { + }: ISearchApplicationsWithDelayOptions): Promise { const indexer = this.indexerByID(nodeID); return await this._sendRequestWithDelay({ @@ -366,7 +366,7 @@ export default class NetworkClient { return (await requestBuilder .setIntDecoding(IntDecoding.BIGINT) - .do()) as IAlgorandSearchApplicationsResult; + .do()) as IAVMSearchApplicationsResult; }, }); } @@ -374,7 +374,7 @@ export default class NetworkClient { /** * Searches for standard assets by the asset index, name or unit from the node with a delay. * @param {IOptions} options - options needed to send the request. - * @returns {Promise} a promise that resolves to the standard assets by the supplied + * @returns {Promise} a promise that resolves to the standard assets by the supplied * parameters. */ public async searchStandardAssetsWithDelay({ @@ -385,7 +385,7 @@ export default class NetworkClient { next, nodeID, unit, - }: ISearchStandardAssetsWithDelayOptions): Promise { + }: ISearchStandardAssetsWithDelayOptions): Promise { let indexer: Indexer; if (!assetId && !unit && !name) { @@ -420,7 +420,7 @@ export default class NetworkClient { return (await requestBuilder .setIntDecoding(IntDecoding.BIGINT) - .do()) as IAlgorandSearchAssetsResult; + .do()) as IAVMSearchAssetsResult; }, }); } @@ -437,7 +437,7 @@ export default class NetworkClient { const _functionName = 'sendTransactions'; const algod = this.algodByID(nodeID); let sentRawTransaction: { txId: string }; - let transactionsResponse: IAlgorandPendingTransactionResponse; + let transactionsResponse: IAVMPendingTransactionResponse; this._logger?.debug( `${_functionName}: sending transactions to the network "${this._network.genesisId}"` @@ -456,7 +456,7 @@ export default class NetworkClient { algod, sentRawTransaction.txId, TRANSACTION_CONFIRMATION_ROUNDS - )) as IAlgorandPendingTransactionResponse; + )) as IAVMPendingTransactionResponse; this._logger?.debug( `${NetworkClient.name}#${_functionName}: transaction "${sentRawTransaction.txId}" confirmed in round "${transactionsResponse['confirmed-round']}"` @@ -473,7 +473,7 @@ export default class NetworkClient { delay, id, nodeID, - }: IByIDWithDelayOptions): Promise { + }: IByIDWithDelayOptions): Promise { const algod = this.algodByID(nodeID); return await this._sendRequestWithDelay({ @@ -482,7 +482,7 @@ export default class NetworkClient { (await algod .getAssetByID(parseInt(id)) .setIntDecoding(IntDecoding.BIGINT) - .do()) as IAlgorandAsset, + .do()) as IAVMAsset, }); } @@ -497,11 +497,11 @@ export default class NetworkClient { /** * Fetches the transaction params for the given network. * @param {string | null} nodeID - an optional node ID to choose. - * @returns {Promise} a promise that resolves to the transaction params. + * @returns {Promise} a promise that resolves to the transaction params. */ public async transactionParams( nodeID: string | null - ): Promise { + ): Promise { const algodNode = this.algodNodeByID(nodeID); let response: Response; diff --git a/src/extension/types/avm/IAVMAccountInformation.ts b/src/extension/types/avm/IAVMAccountInformation.ts new file mode 100644 index 00000000..2a18f9a4 --- /dev/null +++ b/src/extension/types/avm/IAVMAccountInformation.ts @@ -0,0 +1,12 @@ +// types +import type IAVMAssetHolding from './IAVMAssetHolding'; + +interface IAVMAccountInformation { + address: string; + amount: bigint; + assets: IAVMAssetHolding[]; + ['auth-addr']?: string; + ['min-balance']: bigint; +} + +export default IAVMAccountInformation; diff --git a/src/extension/types/avm/IAVMAccountTransaction.ts b/src/extension/types/avm/IAVMAccountTransaction.ts new file mode 100644 index 00000000..269dfbbd --- /dev/null +++ b/src/extension/types/avm/IAVMAccountTransaction.ts @@ -0,0 +1,10 @@ +// types +import type TAVMTransaction from './TAVMTransaction'; + +interface IAVMAccountTransaction { + ['current-round']: bigint; + ['next-token']?: string; + transactions: TAVMTransaction[]; +} + +export default IAVMAccountTransaction; diff --git a/src/extension/types/avm/IAVMApplication.ts b/src/extension/types/avm/IAVMApplication.ts new file mode 100644 index 00000000..f9aa8000 --- /dev/null +++ b/src/extension/types/avm/IAVMApplication.ts @@ -0,0 +1,12 @@ +// types +import type IAVMApplicationParams from './IAVMApplicationParams'; + +interface IAVMApplication { + ['created-at-round']?: bigint; + deleted?: boolean; + ['destroyed-at-round']: bigint; + id: bigint; + params: IAVMApplicationParams; +} + +export default IAVMApplication; diff --git a/src/extension/types/avm/IAVMApplicationParams.ts b/src/extension/types/avm/IAVMApplicationParams.ts new file mode 100644 index 00000000..2a49ebda --- /dev/null +++ b/src/extension/types/avm/IAVMApplicationParams.ts @@ -0,0 +1,15 @@ +// types +import type IAVMStateSchema from './IAVMStateSchema'; +import type IAVMTealKeyValue from './IAVMTealKeyValue'; + +interface IAVMApplicationParams { + ['approval-program']: string; + ['clear-state-program']: string; + creator?: string; + ['extra-program-pages']?: bigint; + ['global-state']?: IAVMTealKeyValue[]; + ['global-state-schema']?: IAVMStateSchema; + ['local-state-schema']?: IAVMStateSchema; +} + +export default IAVMApplicationParams; diff --git a/src/extension/types/avm/IAlgorandApplicationTransaction.ts b/src/extension/types/avm/IAVMApplicationTransaction.ts similarity index 59% rename from src/extension/types/avm/IAlgorandApplicationTransaction.ts rename to src/extension/types/avm/IAVMApplicationTransaction.ts index 21fdbd39..d54352c7 100644 --- a/src/extension/types/avm/IAlgorandApplicationTransaction.ts +++ b/src/extension/types/avm/IAVMApplicationTransaction.ts @@ -1,7 +1,7 @@ // types -import type IAlgorandStateSchema from './IAlgorandStateSchema'; +import type IAVMStateSchema from './IAVMStateSchema'; -interface IAlgorandApplicationTransaction { +interface IAVMApplicationTransaction { accounts?: string[]; ['application-args']?: string[]; ['application-id']: bigint; @@ -10,8 +10,8 @@ interface IAlgorandApplicationTransaction { ['extra-program-pages']?: bigint; ['foreign-apps']?: bigint[]; ['foreign-assets']?: bigint[]; - ['global-state-schema']?: IAlgorandStateSchema; - ['local-state-schema']?: IAlgorandStateSchema; + ['global-state-schema']?: IAVMStateSchema; + ['local-state-schema']?: IAVMStateSchema; ['on-completion']: | 'clear' | 'closeout' @@ -21,4 +21,4 @@ interface IAlgorandApplicationTransaction { | 'update'; } -export default IAlgorandApplicationTransaction; +export default IAVMApplicationTransaction; diff --git a/src/extension/types/avm/IAVMAsset.ts b/src/extension/types/avm/IAVMAsset.ts new file mode 100644 index 00000000..bdf8963a --- /dev/null +++ b/src/extension/types/avm/IAVMAsset.ts @@ -0,0 +1,12 @@ +// types +import type IAVMAssetParams from './IAVMAssetParams'; + +interface IAVMAsset { + ['created-at-round']?: bigint; + deleted?: boolean; + ['destroyed-at-round']: bigint; + index: bigint; + params: IAVMAssetParams; +} + +export default IAVMAsset; diff --git a/src/extension/types/avm/IAVMAssetConfigTransaction.ts b/src/extension/types/avm/IAVMAssetConfigTransaction.ts new file mode 100644 index 00000000..394f92ff --- /dev/null +++ b/src/extension/types/avm/IAVMAssetConfigTransaction.ts @@ -0,0 +1,9 @@ +// types +import type IAVMAssetParams from './IAVMAssetParams'; + +interface IAVMAssetConfigTransaction { + ['asset-id']: bigint; + params: IAVMAssetParams; +} + +export default IAVMAssetConfigTransaction; diff --git a/src/extension/types/avm/IAVMAssetFreezeTransaction.ts b/src/extension/types/avm/IAVMAssetFreezeTransaction.ts new file mode 100644 index 00000000..27ee3dad --- /dev/null +++ b/src/extension/types/avm/IAVMAssetFreezeTransaction.ts @@ -0,0 +1,7 @@ +interface IAVMAssetFreezeTransaction { + address: string; + ['asset-id']: bigint; + ['new-freeze-status']: boolean; +} + +export default IAVMAssetFreezeTransaction; diff --git a/src/extension/types/avm/IAlgorandAssetHolding.ts b/src/extension/types/avm/IAVMAssetHolding.ts similarity index 71% rename from src/extension/types/avm/IAlgorandAssetHolding.ts rename to src/extension/types/avm/IAVMAssetHolding.ts index b7fa4d8e..cdfc6b68 100644 --- a/src/extension/types/avm/IAlgorandAssetHolding.ts +++ b/src/extension/types/avm/IAVMAssetHolding.ts @@ -1,4 +1,4 @@ -interface IAlgorandAssetHolding { +interface IAVMAssetHolding { amount: bigint; ['asset-id']: bigint; creator: string; @@ -8,4 +8,4 @@ interface IAlgorandAssetHolding { ['opted-out-at-round']: bigint; } -export default IAlgorandAssetHolding; +export default IAVMAssetHolding; diff --git a/src/extension/types/avm/IAlgorandAssetParams.ts b/src/extension/types/avm/IAVMAssetParams.ts similarity index 82% rename from src/extension/types/avm/IAlgorandAssetParams.ts rename to src/extension/types/avm/IAVMAssetParams.ts index b3c11d10..3c8945b7 100644 --- a/src/extension/types/avm/IAlgorandAssetParams.ts +++ b/src/extension/types/avm/IAVMAssetParams.ts @@ -1,4 +1,4 @@ -interface IAlgorandAssetParams { +interface IAVMAssetParams { clawback?: string; creator: string; decimals: bigint; @@ -16,4 +16,4 @@ interface IAlgorandAssetParams { ['url-b64']?: string; } -export default IAlgorandAssetParams; +export default IAVMAssetParams; diff --git a/src/extension/types/avm/IAlgorandAssetTransferTransaction.ts b/src/extension/types/avm/IAVMAssetTransferTransaction.ts similarity index 58% rename from src/extension/types/avm/IAlgorandAssetTransferTransaction.ts rename to src/extension/types/avm/IAVMAssetTransferTransaction.ts index cd99dbd9..de988e66 100644 --- a/src/extension/types/avm/IAlgorandAssetTransferTransaction.ts +++ b/src/extension/types/avm/IAVMAssetTransferTransaction.ts @@ -1,4 +1,4 @@ -interface IAlgorandAssetTransferTransaction { +interface IAVMAssetTransferTransaction { amount: bigint; ['asset-id']: bigint; ['close-amount']?: bigint; @@ -7,4 +7,4 @@ interface IAlgorandAssetTransferTransaction { sender?: string; } -export default IAlgorandAssetTransferTransaction; +export default IAVMAssetTransferTransaction; diff --git a/src/extension/types/avm/IAlgorandKeyRegistrationTransaction.ts b/src/extension/types/avm/IAVMKeyRegistrationTransaction.ts similarity index 71% rename from src/extension/types/avm/IAlgorandKeyRegistrationTransaction.ts rename to src/extension/types/avm/IAVMKeyRegistrationTransaction.ts index 0bdc4077..f8b59e74 100644 --- a/src/extension/types/avm/IAlgorandKeyRegistrationTransaction.ts +++ b/src/extension/types/avm/IAVMKeyRegistrationTransaction.ts @@ -1,4 +1,4 @@ -interface IAlgorandKeyRegistrationTransaction { +interface IAVMKeyRegistrationTransaction { ['non-participation']?: boolean; ['selection-participation-key']?: string; ['state-proof-key']?: string; @@ -8,4 +8,4 @@ interface IAlgorandKeyRegistrationTransaction { ['vote-participation-key']?: string; } -export default IAlgorandKeyRegistrationTransaction; +export default IAVMKeyRegistrationTransaction; diff --git a/src/extension/types/avm/IAlgorandPaymentTransaction.ts b/src/extension/types/avm/IAVMPaymentTransaction.ts similarity index 55% rename from src/extension/types/avm/IAlgorandPaymentTransaction.ts rename to src/extension/types/avm/IAVMPaymentTransaction.ts index 06f04ebe..62be27be 100644 --- a/src/extension/types/avm/IAlgorandPaymentTransaction.ts +++ b/src/extension/types/avm/IAVMPaymentTransaction.ts @@ -1,8 +1,8 @@ -interface IAlgorandPaymentTransaction { +interface IAVMPaymentTransaction { amount: bigint; ['close-amount']?: bigint; ['close-remainder-to']?: string; receiver: string; } -export default IAlgorandPaymentTransaction; +export default IAVMPaymentTransaction; diff --git a/src/extension/types/avm/IAlgorandPendingTransactionResponse.ts b/src/extension/types/avm/IAVMPendingTransactionResponse.ts similarity index 59% rename from src/extension/types/avm/IAlgorandPendingTransactionResponse.ts rename to src/extension/types/avm/IAVMPendingTransactionResponse.ts index 5276a1c3..74f39876 100644 --- a/src/extension/types/avm/IAlgorandPendingTransactionResponse.ts +++ b/src/extension/types/avm/IAVMPendingTransactionResponse.ts @@ -1,7 +1,7 @@ // types -import type IAlgorandTransaction from './IAlgorandTransaction'; +import type TAVMTransaction from './TAVMTransaction'; -interface IAlgorandPendingTransactionResponse { +interface IAVMPendingTransactionResponse { ['application-index']?: bigint; ['asset-closing-amount']?: bigint; ['asset-index']?: bigint; @@ -11,7 +11,7 @@ interface IAlgorandPendingTransactionResponse { ['pool-error']: string; ['receiver-rewards']?: bigint; ['sender-rewards']?: bigint; - ['txn ']: IAlgorandTransaction; + ['txn ']: TAVMTransaction; } -export default IAlgorandPendingTransactionResponse; +export default IAVMPendingTransactionResponse; diff --git a/src/extension/types/avm/IAVMSearchApplicationsResult.ts b/src/extension/types/avm/IAVMSearchApplicationsResult.ts new file mode 100644 index 00000000..c833ab11 --- /dev/null +++ b/src/extension/types/avm/IAVMSearchApplicationsResult.ts @@ -0,0 +1,10 @@ +// types +import type IAVMApplication from './IAVMApplication'; + +interface IAVMSearchApplicationsResult { + applications: IAVMApplication[]; + ['current-round']: bigint; + ['next-token']?: string; +} + +export default IAVMSearchApplicationsResult; diff --git a/src/extension/types/avm/IAVMSearchAssetsResult.ts b/src/extension/types/avm/IAVMSearchAssetsResult.ts new file mode 100644 index 00000000..3ec1d3d0 --- /dev/null +++ b/src/extension/types/avm/IAVMSearchAssetsResult.ts @@ -0,0 +1,10 @@ +// types +import type IAVMAsset from './IAVMAsset'; + +interface IAVMSearchAssetsResult { + assets: IAVMAsset[]; + ['current-round']: bigint; + ['next-token']?: string; +} + +export default IAVMSearchAssetsResult; diff --git a/src/extension/types/avm/IAVMStateSchema.ts b/src/extension/types/avm/IAVMStateSchema.ts new file mode 100644 index 00000000..da384b37 --- /dev/null +++ b/src/extension/types/avm/IAVMStateSchema.ts @@ -0,0 +1,6 @@ +interface IAVMStateSchema { + ['num-byte-slice']: bigint; + ['num-uint']: bigint; +} + +export default IAVMStateSchema; diff --git a/src/extension/types/avm/IAVMTealKeyValue.ts b/src/extension/types/avm/IAVMTealKeyValue.ts new file mode 100644 index 00000000..c0b97024 --- /dev/null +++ b/src/extension/types/avm/IAVMTealKeyValue.ts @@ -0,0 +1,6 @@ +interface IAVMTealKeyValue { + key: string; + value: bigint; +} + +export default IAVMTealKeyValue; diff --git a/src/extension/types/avm/IAVMTealValue.ts b/src/extension/types/avm/IAVMTealValue.ts new file mode 100644 index 00000000..b4b4d5fe --- /dev/null +++ b/src/extension/types/avm/IAVMTealValue.ts @@ -0,0 +1,7 @@ +interface IAVMTealValue { + bytes: string; + type: bigint; + uint: bigint; +} + +export default IAVMTealValue; diff --git a/src/extension/types/avm/IAlgorandTransactionParams.ts b/src/extension/types/avm/IAVMTransactionParams.ts similarity index 65% rename from src/extension/types/avm/IAlgorandTransactionParams.ts rename to src/extension/types/avm/IAVMTransactionParams.ts index 0d74e3d9..f8a7fc97 100644 --- a/src/extension/types/avm/IAlgorandTransactionParams.ts +++ b/src/extension/types/avm/IAVMTransactionParams.ts @@ -1,4 +1,4 @@ -interface IAlgorandTransactionParams { +interface IAVMTransactionParams { ['consensus-version']: string; fee: number; ['genesis-hash']: string; @@ -7,4 +7,4 @@ interface IAlgorandTransactionParams { ['min-fee']: number; } -export default IAlgorandTransactionParams; +export default IAVMTransactionParams; diff --git a/src/extension/types/avm/IAlgorandAccountInformation.ts b/src/extension/types/avm/IAlgorandAccountInformation.ts deleted file mode 100644 index 355f8138..00000000 --- a/src/extension/types/avm/IAlgorandAccountInformation.ts +++ /dev/null @@ -1,12 +0,0 @@ -// types -import type IAlgorandAssetHolding from './IAlgorandAssetHolding'; - -interface IAlgorandAccountInformation { - address: string; - amount: bigint; - assets: IAlgorandAssetHolding[]; - ['auth-addr']?: string; - ['min-balance']: bigint; -} - -export default IAlgorandAccountInformation; diff --git a/src/extension/types/avm/IAlgorandAccountTransaction.ts b/src/extension/types/avm/IAlgorandAccountTransaction.ts deleted file mode 100644 index 4e9564bb..00000000 --- a/src/extension/types/avm/IAlgorandAccountTransaction.ts +++ /dev/null @@ -1,10 +0,0 @@ -// types -import type IAlgorandTransaction from './IAlgorandTransaction'; - -interface IAlgorandAccountTransaction { - ['current-round']: bigint; - ['next-token']?: string; - transactions: IAlgorandTransaction[]; -} - -export default IAlgorandAccountTransaction; diff --git a/src/extension/types/avm/IAlgorandApplication.ts b/src/extension/types/avm/IAlgorandApplication.ts deleted file mode 100644 index 8c7a92c2..00000000 --- a/src/extension/types/avm/IAlgorandApplication.ts +++ /dev/null @@ -1,12 +0,0 @@ -// types -import type IAlgorandApplicationParams from './IAlgorandApplicationParams'; - -interface IAlgorandApplication { - ['created-at-round']?: bigint; - deleted?: boolean; - ['destroyed-at-round']: bigint; - id: bigint; - params: IAlgorandApplicationParams; -} - -export default IAlgorandApplication; diff --git a/src/extension/types/avm/IAlgorandApplicationParams.ts b/src/extension/types/avm/IAlgorandApplicationParams.ts deleted file mode 100644 index 707248e8..00000000 --- a/src/extension/types/avm/IAlgorandApplicationParams.ts +++ /dev/null @@ -1,15 +0,0 @@ -// types -import type IAlgorandStateSchema from './IAlgorandStateSchema'; -import type IAlgorandTealKeyValue from './IAlgorandTealKeyValue'; - -interface IAlgorandApplicationParams { - ['approval-program']: string; - ['clear-state-program']: string; - creator?: string; - ['extra-program-pages']?: bigint; - ['global-state']?: IAlgorandTealKeyValue[]; - ['global-state-schema']?: IAlgorandStateSchema; - ['local-state-schema']?: IAlgorandStateSchema; -} - -export default IAlgorandApplicationParams; diff --git a/src/extension/types/avm/IAlgorandAsset.ts b/src/extension/types/avm/IAlgorandAsset.ts deleted file mode 100644 index 6b902874..00000000 --- a/src/extension/types/avm/IAlgorandAsset.ts +++ /dev/null @@ -1,12 +0,0 @@ -// types -import type IAlgorandAssetParams from './IAlgorandAssetParams'; - -interface IAlgorandAsset { - ['created-at-round']?: bigint; - deleted?: boolean; - ['destroyed-at-round']: bigint; - index: bigint; - params: IAlgorandAssetParams; -} - -export default IAlgorandAsset; diff --git a/src/extension/types/avm/IAlgorandAssetConfigTransaction.ts b/src/extension/types/avm/IAlgorandAssetConfigTransaction.ts deleted file mode 100644 index 883603a8..00000000 --- a/src/extension/types/avm/IAlgorandAssetConfigTransaction.ts +++ /dev/null @@ -1,9 +0,0 @@ -// types -import type IAlgorandAssetParams from './IAlgorandAssetParams'; - -interface IAlgorandAssetConfigTransaction { - ['asset-id']: bigint; - params: IAlgorandAssetParams; -} - -export default IAlgorandAssetConfigTransaction; diff --git a/src/extension/types/avm/IAlgorandAssetFreezeTransaction.ts b/src/extension/types/avm/IAlgorandAssetFreezeTransaction.ts deleted file mode 100644 index 4f53bee4..00000000 --- a/src/extension/types/avm/IAlgorandAssetFreezeTransaction.ts +++ /dev/null @@ -1,7 +0,0 @@ -interface IAlgorandAssetFreezeTransaction { - address: string; - ['asset-id']: bigint; - ['new-freeze-status']: boolean; -} - -export default IAlgorandAssetFreezeTransaction; diff --git a/src/extension/types/avm/IAlgorandSearchApplicationsResult.ts b/src/extension/types/avm/IAlgorandSearchApplicationsResult.ts deleted file mode 100644 index e5ae2033..00000000 --- a/src/extension/types/avm/IAlgorandSearchApplicationsResult.ts +++ /dev/null @@ -1,10 +0,0 @@ -// types -import type IAlgorandApplication from './IAlgorandApplication'; - -interface IAlgorandSearchApplicationsResult { - applications: IAlgorandApplication[]; - ['current-round']: bigint; - ['next-token']?: string; -} - -export default IAlgorandSearchApplicationsResult; diff --git a/src/extension/types/avm/IAlgorandSearchAssetsResult.ts b/src/extension/types/avm/IAlgorandSearchAssetsResult.ts deleted file mode 100644 index 1d7f5daa..00000000 --- a/src/extension/types/avm/IAlgorandSearchAssetsResult.ts +++ /dev/null @@ -1,10 +0,0 @@ -// types -import type IAlgorandAsset from './IAlgorandAsset'; - -interface IAlgorandSearchAssetsResult { - assets: IAlgorandAsset[]; - ['current-round']: bigint; - ['next-token']?: string; -} - -export default IAlgorandSearchAssetsResult; diff --git a/src/extension/types/avm/IAlgorandStateSchema.ts b/src/extension/types/avm/IAlgorandStateSchema.ts deleted file mode 100644 index 0afcd25b..00000000 --- a/src/extension/types/avm/IAlgorandStateSchema.ts +++ /dev/null @@ -1,6 +0,0 @@ -interface IAlgorandStateSchema { - ['num-byte-slice']: bigint; - ['num-uint']: bigint; -} - -export default IAlgorandStateSchema; diff --git a/src/extension/types/avm/IAlgorandTealKeyValue.ts b/src/extension/types/avm/IAlgorandTealKeyValue.ts deleted file mode 100644 index 1dcc3965..00000000 --- a/src/extension/types/avm/IAlgorandTealKeyValue.ts +++ /dev/null @@ -1,6 +0,0 @@ -interface IAlgorandTealKeyValue { - key: string; - value: bigint; -} - -export default IAlgorandTealKeyValue; diff --git a/src/extension/types/avm/IAlgorandTealValue.ts b/src/extension/types/avm/IAlgorandTealValue.ts deleted file mode 100644 index aaeee5e9..00000000 --- a/src/extension/types/avm/IAlgorandTealValue.ts +++ /dev/null @@ -1,7 +0,0 @@ -interface IAlgorandTealValue { - bytes: string; - type: bigint; - uint: bigint; -} - -export default IAlgorandTealValue; diff --git a/src/extension/types/avm/IAlgorandTransaction.ts b/src/extension/types/avm/IAlgorandTransaction.ts deleted file mode 100644 index 1c9c2f35..00000000 --- a/src/extension/types/avm/IAlgorandTransaction.ts +++ /dev/null @@ -1,55 +0,0 @@ -// types -import type IAlgorandApplicationTransaction from './IAlgorandApplicationTransaction'; -import type IAlgorandAssetConfigTransaction from './IAlgorandAssetConfigTransaction'; -import type IAlgorandAssetFreezeTransaction from './IAlgorandAssetFreezeTransaction'; -import type IAlgorandAssetTransferTransaction from './IAlgorandAssetTransferTransaction'; -import type IAlgorandKeyRegistrationTransaction from './IAlgorandKeyRegistrationTransaction'; -import type IAlgorandPaymentTransaction from './IAlgorandPaymentTransaction'; - -interface IBaseAlgorandTransaction { - ['auth-addr']?: string; - ['close-rewards']?: bigint; - fee: bigint; - ['first-valid']: bigint; - ['genesis-hash']?: string; - ['genesis-id']?: string; - group?: string; - id?: string; - ['inner-txns']?: IAlgorandTransaction[]; - ['last-valid']: bigint; - lease?: string; - note?: string; - ['rekey-to']?: string; - ['round-time']?: bigint; - sender: string; -} - -type IAlgorandTransactions = - | { - ['asset-config-transaction']: IAlgorandAssetConfigTransaction; - ['tx-type']: 'acfg'; - } - | { - ['asset-freeze-transaction']: IAlgorandAssetFreezeTransaction; - ['tx-type']: 'afrz'; - } - | { - ['application-transaction']: IAlgorandApplicationTransaction; - ['tx-type']: 'appl'; - } - | { - ['asset-transfer-transaction']: IAlgorandAssetTransferTransaction; - ['tx-type']: 'axfer'; - } - | { - ['keyreg-transaction']: IAlgorandKeyRegistrationTransaction; - ['tx-type']: 'keyreg'; - } - | { - ['payment-transaction']: IAlgorandPaymentTransaction; - ['tx-type']: 'pay'; - }; - -type IAlgorandTransaction = IBaseAlgorandTransaction & IAlgorandTransactions; - -export default IAlgorandTransaction; diff --git a/src/extension/types/avm/TAVMTransaction.ts b/src/extension/types/avm/TAVMTransaction.ts new file mode 100644 index 00000000..25a2fa63 --- /dev/null +++ b/src/extension/types/avm/TAVMTransaction.ts @@ -0,0 +1,56 @@ +// types +import type IAVMApplicationTransaction from './IAVMApplicationTransaction'; +import type IAVMAssetConfigTransaction from './IAVMAssetConfigTransaction'; +import type IAVMAssetFreezeTransaction from './IAVMAssetFreezeTransaction'; +import type IAVMAssetTransferTransaction from './IAVMAssetTransferTransaction'; +import type IAVMKeyRegistrationTransaction from './IAVMKeyRegistrationTransaction'; +import type IAVMPaymentTransaction from './IAVMPaymentTransaction'; + +interface IBaseAVMTransaction { + ['auth-addr']?: string; + ['close-rewards']?: bigint; + ['confirmed-round']?: bigint; + fee: bigint; + ['first-valid']: bigint; + ['genesis-hash']?: string; + ['genesis-id']?: string; + group?: string; + id?: string; + ['inner-txns']?: TAVMTransaction[]; + ['last-valid']: bigint; + lease?: string; + note?: string; + ['rekey-to']?: string; + ['round-time']?: bigint; + sender: string; +} + +type TAVMTransactions = + | { + ['asset-config-transaction']: IAVMAssetConfigTransaction; + ['tx-type']: 'acfg'; + } + | { + ['asset-freeze-transaction']: IAVMAssetFreezeTransaction; + ['tx-type']: 'afrz'; + } + | { + ['application-transaction']: IAVMApplicationTransaction; + ['tx-type']: 'appl'; + } + | { + ['asset-transfer-transaction']: IAVMAssetTransferTransaction; + ['tx-type']: 'axfer'; + } + | { + ['keyreg-transaction']: IAVMKeyRegistrationTransaction; + ['tx-type']: 'keyreg'; + } + | { + ['payment-transaction']: IAVMPaymentTransaction; + ['tx-type']: 'pay'; + }; + +type TAVMTransaction = IBaseAVMTransaction & TAVMTransactions; + +export default TAVMTransaction; diff --git a/src/extension/types/avm/index.ts b/src/extension/types/avm/index.ts index 81b95a16..171556c8 100644 --- a/src/extension/types/avm/index.ts +++ b/src/extension/types/avm/index.ts @@ -1,23 +1,23 @@ -export type { default as IAlgorandAccountInformation } from './IAlgorandAccountInformation'; -export type { default as IAlgorandAccountTransaction } from './IAlgorandAccountTransaction'; -export type { default as IAlgorandApplication } from './IAlgorandApplication'; -export type { default as IAlgorandApplicationParams } from './IAlgorandApplicationParams'; -export type { default as IAlgorandApplicationTransaction } from './IAlgorandApplicationTransaction'; -export type { default as IAlgorandAsset } from './IAlgorandAsset'; -export type { default as IAlgorandAssetHolding } from './IAlgorandAssetHolding'; -export type { default as IAlgorandAssetConfigTransaction } from './IAlgorandAssetConfigTransaction'; -export type { default as IAlgorandAssetFreezeTransaction } from './IAlgorandAssetFreezeTransaction'; -export type { default as IAlgorandAssetParams } from './IAlgorandAssetParams'; -export type { default as IAlgorandAssetTransferTransaction } from './IAlgorandAssetTransferTransaction'; -export type { default as IAlgorandKeyRegistrationTransaction } from './IAlgorandKeyRegistrationTransaction'; -export type { default as IAlgorandPaymentTransaction } from './IAlgorandPaymentTransaction'; -export type { default as IAlgorandPendingTransactionResponse } from './IAlgorandPendingTransactionResponse'; -export type { default as IAlgorandSearchApplicationsResult } from './IAlgorandSearchApplicationsResult'; -export type { default as IAlgorandSearchAssetsResult } from './IAlgorandSearchAssetsResult'; -export type { default as IAlgorandStateSchema } from './IAlgorandStateSchema'; -export type { default as IAlgorandTealKeyValue } from './IAlgorandTealKeyValue'; -export type { default as IAlgorandTealValue } from './IAlgorandTealValue'; -export type { default as IAlgorandTransaction } from './IAlgorandTransaction'; -export type { default as IAlgorandTransactionParams } from './IAlgorandTransactionParams'; +export type { default as IAVMAccountInformation } from './IAVMAccountInformation'; +export type { default as IAVMAccountTransaction } from './IAVMAccountTransaction'; +export type { default as IAVMApplication } from './IAVMApplication'; +export type { default as IAVMApplicationParams } from './IAVMApplicationParams'; +export type { default as IAVMApplicationTransaction } from './IAVMApplicationTransaction'; +export type { default as IAVMAsset } from './IAVMAsset'; +export type { default as IAVMAssetConfigTransaction } from './IAVMAssetConfigTransaction'; +export type { default as IAVMAssetFreezeTransaction } from './IAVMAssetFreezeTransaction'; +export type { default as IAVMAssetHolding } from './IAVMAssetHolding'; +export type { default as IAVMAssetParams } from './IAVMAssetParams'; +export type { default as IAVMAssetTransferTransaction } from './IAVMAssetTransferTransaction'; +export type { default as IAVMKeyRegistrationTransaction } from './IAVMKeyRegistrationTransaction'; +export type { default as IAVMPaymentTransaction } from './IAVMPaymentTransaction'; +export type { default as IAVMPendingTransactionResponse } from './IAVMPendingTransactionResponse'; +export type { default as IAVMSearchApplicationsResult } from './IAVMSearchApplicationsResult'; +export type { default as IAVMSearchAssetsResult } from './IAVMSearchAssetsResult'; +export type { default as IAVMStateSchema } from './IAVMStateSchema'; +export type { default as IAVMTealKeyValue } from './IAVMTealKeyValue'; +export type { default as IAVMTealValue } from './IAVMTealValue'; +export type { default as IAVMTransactionParams } from './IAVMTransactionParams'; export type { default as IAVMVersions } from './IAVMVersions'; export type { default as IAVMVersionsBuild } from './IAVMVersionsBuild'; +export type { default as TAVMTransaction } from './TAVMTransaction'; diff --git a/src/extension/types/transactions/IBaseTransaction.ts b/src/extension/types/transactions/IBaseTransaction.ts index 7dfac802..8bdfd9cf 100644 --- a/src/extension/types/transactions/IBaseTransaction.ts +++ b/src/extension/types/transactions/IBaseTransaction.ts @@ -1,5 +1,6 @@ interface IBaseTransaction { authAddr: string | null; + block: string | null; completedAt: number | null; // in milliseconds fee: string; genesisHash: string | null; diff --git a/src/extension/utils/filterCustomNodesFromNetwork/filterCustomNodesFromNetwork.test.ts b/src/extension/utils/filterCustomNodesFromNetwork/filterCustomNodesFromNetwork.test.ts index de44171b..a9bcd20a 100644 --- a/src/extension/utils/filterCustomNodesFromNetwork/filterCustomNodesFromNetwork.test.ts +++ b/src/extension/utils/filterCustomNodesFromNetwork/filterCustomNodesFromNetwork.test.ts @@ -48,7 +48,6 @@ describe('filterCustomNodesFromNetwork', () => { namespace: { key: 'voi', methods: ['signTransaction', 'signMessage'], - reference: 'IXnoWtviVVJW5LGivNFc0Dq14V3kqaXu', }, nativeCurrency: { decimals: 6, diff --git a/src/extension/utils/mapAVMAccountInformationToAccount/mapAVMAccountInformationToAccount.ts b/src/extension/utils/mapAVMAccountInformationToAccount/mapAVMAccountInformationToAccount.ts index ca673822..525f6472 100644 --- a/src/extension/utils/mapAVMAccountInformationToAccount/mapAVMAccountInformationToAccount.ts +++ b/src/extension/utils/mapAVMAccountInformationToAccount/mapAVMAccountInformationToAccount.ts @@ -6,11 +6,11 @@ import { AssetTypeEnum } from '@extension/enums'; // types import type { IAccountInformation, - IAlgorandAccountInformation, + IAVMAccountInformation, } from '@extension/types'; export default function mapAVMAccountInformationToAccountInformation( - avmAccountInformation: IAlgorandAccountInformation, + avmAccountInformation: IAVMAccountInformation, accountInformation: IAccountInformation, updatedAt?: number ): IAccountInformation { diff --git a/src/extension/utils/mapAVMTransactionToTransaction/index.ts b/src/extension/utils/mapAVMTransactionToTransaction/index.ts new file mode 100644 index 00000000..934129a8 --- /dev/null +++ b/src/extension/utils/mapAVMTransactionToTransaction/index.ts @@ -0,0 +1 @@ +export { default } from './mapAVMTransactionToTransaction'; diff --git a/src/extension/utils/mapAlgorandTransactionToTransaction/mapAlgorandTransactionToTransaction.ts b/src/extension/utils/mapAVMTransactionToTransaction/mapAVMTransactionToTransaction.ts similarity index 91% rename from src/extension/utils/mapAlgorandTransactionToTransaction/mapAlgorandTransactionToTransaction.ts rename to src/extension/utils/mapAVMTransactionToTransaction/mapAVMTransactionToTransaction.ts index d9c136bf..48b5f27d 100644 --- a/src/extension/utils/mapAlgorandTransactionToTransaction/mapAlgorandTransactionToTransaction.ts +++ b/src/extension/utils/mapAVMTransactionToTransaction/mapAVMTransactionToTransaction.ts @@ -1,13 +1,13 @@ -import { BigNumber } from 'bignumber.js'; +import BigNumber from 'bignumber.js'; // enums import { TransactionTypeEnum } from '@extension/enums'; // types import type { - IAlgorandTransaction, IBaseTransaction, ITransactions, + TAVMTransaction, } from '@extension/types'; // utils @@ -19,11 +19,12 @@ import parseKeyRegistrationTransaction from './parseKeyRegistrationTransaction'; import parseNote from './parseNote'; import parsePaymentAndReKeyTransaction from './parsePaymentAndReKeyTransaction'; -export default function mapAlgorandTransactionToTransaction( - avmTransaction: IAlgorandTransaction +export default function mapAVMTransactionToTransaction( + avmTransaction: TAVMTransaction ): ITransactions { const baseTransaction: IBaseTransaction = { authAddr: avmTransaction['auth-addr'] || null, + block: String(avmTransaction['confirmed-round'] as bigint) || null, completedAt: avmTransaction['round-time'] ? new BigNumber(String(avmTransaction['round-time'] as bigint)) .multipliedBy(1000) // we want milliseconds, as 'round-time' is in seconds diff --git a/src/extension/utils/mapAlgorandTransactionToTransaction/parseApplicationTransaction.ts b/src/extension/utils/mapAVMTransactionToTransaction/parseApplicationTransaction.ts similarity index 86% rename from src/extension/utils/mapAlgorandTransactionToTransaction/parseApplicationTransaction.ts rename to src/extension/utils/mapAVMTransactionToTransaction/parseApplicationTransaction.ts index 083f1f66..653b2e46 100644 --- a/src/extension/utils/mapAlgorandTransactionToTransaction/parseApplicationTransaction.ts +++ b/src/extension/utils/mapAVMTransactionToTransaction/parseApplicationTransaction.ts @@ -5,20 +5,20 @@ import { TransactionTypeEnum } from '@extension/enums'; // types import { - IAlgorandApplicationTransaction, - IAlgorandTransaction, IApplicationTransaction, IApplicationTransactionTypes, + IAVMApplicationTransaction, IBaseTransaction, + TAVMTransaction, } from '@extension/types'; // utils -import mapAlgorandTransactionToTransaction from './mapAlgorandTransactionToTransaction'; +import mapAVMTransactionToTransaction from '@extension/utils/mapAVMTransactionToTransaction'; export default function parseApplicationTransaction( - algorandApplicationTransaction: IAlgorandApplicationTransaction, + algorandApplicationTransaction: IAVMApplicationTransaction, baseTransaction: IBaseTransaction, - innerTransactions?: IAlgorandTransaction[] + innerTransactions?: TAVMTransaction[] ): IApplicationTransaction { const applicationId: string | null = algorandApplicationTransaction['application-id'] > 0 @@ -73,7 +73,7 @@ export default function parseApplicationTransaction( new BigNumber(String(value as bigint)).toFixed() ) || null, innerTransactions: - innerTransactions?.map(mapAlgorandTransactionToTransaction) || null, + innerTransactions?.map(mapAVMTransactionToTransaction) || null, type, }; } diff --git a/src/extension/utils/mapAlgorandTransactionToTransaction/parseAssetConfigTransaction.ts b/src/extension/utils/mapAVMTransactionToTransaction/parseAssetConfigTransaction.ts similarity index 96% rename from src/extension/utils/mapAlgorandTransactionToTransaction/parseAssetConfigTransaction.ts rename to src/extension/utils/mapAVMTransactionToTransaction/parseAssetConfigTransaction.ts index 912c1710..9feab565 100644 --- a/src/extension/utils/mapAlgorandTransactionToTransaction/parseAssetConfigTransaction.ts +++ b/src/extension/utils/mapAVMTransactionToTransaction/parseAssetConfigTransaction.ts @@ -5,7 +5,7 @@ import { TransactionTypeEnum } from '@extension/enums'; // types import { - IAlgorandAssetConfigTransaction, + IAVMAssetConfigTransaction, IAssetConfigTransaction, IAssetCreateTransaction, IAssetDestroyTransaction, @@ -13,7 +13,7 @@ import { } from '@extension/types'; export default function parseAssetConfigTransaction( - algorandAssetConfigTransaction: IAlgorandAssetConfigTransaction, + algorandAssetConfigTransaction: IAVMAssetConfigTransaction, baseTransaction: IBaseTransaction ): | IAssetConfigTransaction diff --git a/src/extension/utils/mapAlgorandTransactionToTransaction/parseAssetFreezeTransaction.ts b/src/extension/utils/mapAVMTransactionToTransaction/parseAssetFreezeTransaction.ts similarity index 87% rename from src/extension/utils/mapAlgorandTransactionToTransaction/parseAssetFreezeTransaction.ts rename to src/extension/utils/mapAVMTransactionToTransaction/parseAssetFreezeTransaction.ts index 624940a5..8188a962 100644 --- a/src/extension/utils/mapAlgorandTransactionToTransaction/parseAssetFreezeTransaction.ts +++ b/src/extension/utils/mapAVMTransactionToTransaction/parseAssetFreezeTransaction.ts @@ -5,14 +5,14 @@ import { TransactionTypeEnum } from '@extension/enums'; // types import { - IAlgorandAssetFreezeTransaction, + IAVMAssetFreezeTransaction, IAssetFreezeTransaction, IAssetUnfreezeTransaction, IBaseTransaction, } from '@extension/types'; export default function parseAssetFreezeTransaction( - algorandAssetFreezeTransaction: IAlgorandAssetFreezeTransaction, + algorandAssetFreezeTransaction: IAVMAssetFreezeTransaction, baseTransaction: IBaseTransaction ): IAssetFreezeTransaction | IAssetUnfreezeTransaction { return { diff --git a/src/extension/utils/mapAlgorandTransactionToTransaction/parseAssetTransferTransaction.ts b/src/extension/utils/mapAVMTransactionToTransaction/parseAssetTransferTransaction.ts similarity index 86% rename from src/extension/utils/mapAlgorandTransactionToTransaction/parseAssetTransferTransaction.ts rename to src/extension/utils/mapAVMTransactionToTransaction/parseAssetTransferTransaction.ts index 034e0d27..0344cb83 100644 --- a/src/extension/utils/mapAlgorandTransactionToTransaction/parseAssetTransferTransaction.ts +++ b/src/extension/utils/mapAVMTransactionToTransaction/parseAssetTransferTransaction.ts @@ -6,12 +6,12 @@ import { TransactionTypeEnum } from '@extension/enums'; // types import { IBaseTransaction, - IAlgorandAssetTransferTransaction, + IAVMAssetTransferTransaction, IAssetTransferTransaction, } from '@extension/types'; export default function parseAssetTransferTransaction( - algorandAssetTransferTransaction: IAlgorandAssetTransferTransaction, + algorandAssetTransferTransaction: IAVMAssetTransferTransaction, baseTransaction: IBaseTransaction ): IAssetTransferTransaction { return { diff --git a/src/extension/utils/mapAlgorandTransactionToTransaction/parseKeyRegistrationTransaction.ts b/src/extension/utils/mapAVMTransactionToTransaction/parseKeyRegistrationTransaction.ts similarity index 93% rename from src/extension/utils/mapAlgorandTransactionToTransaction/parseKeyRegistrationTransaction.ts rename to src/extension/utils/mapAVMTransactionToTransaction/parseKeyRegistrationTransaction.ts index 45cf09b4..384a2339 100644 --- a/src/extension/utils/mapAlgorandTransactionToTransaction/parseKeyRegistrationTransaction.ts +++ b/src/extension/utils/mapAVMTransactionToTransaction/parseKeyRegistrationTransaction.ts @@ -5,14 +5,14 @@ import { TransactionTypeEnum } from '@extension/enums'; // types import { - IAlgorandKeyRegistrationTransaction, + IAVMKeyRegistrationTransaction, IBaseTransaction, IKeyRegistrationOfflineTransaction, IKeyRegistrationOnlineTransaction, } from '@extension/types'; export default function parseAssetFreezeTransaction( - algorandKeyRegistrationTransaction: IAlgorandKeyRegistrationTransaction, + algorandKeyRegistrationTransaction: IAVMKeyRegistrationTransaction, baseTransaction: IBaseTransaction ): IKeyRegistrationOfflineTransaction | IKeyRegistrationOnlineTransaction { if ( diff --git a/src/extension/utils/mapAlgorandTransactionToTransaction/parseNote.ts b/src/extension/utils/mapAVMTransactionToTransaction/parseNote.ts similarity index 100% rename from src/extension/utils/mapAlgorandTransactionToTransaction/parseNote.ts rename to src/extension/utils/mapAVMTransactionToTransaction/parseNote.ts diff --git a/src/extension/utils/mapAlgorandTransactionToTransaction/parsePaymentAndReKeyTransaction.ts b/src/extension/utils/mapAVMTransactionToTransaction/parsePaymentAndReKeyTransaction.ts similarity index 91% rename from src/extension/utils/mapAlgorandTransactionToTransaction/parsePaymentAndReKeyTransaction.ts rename to src/extension/utils/mapAVMTransactionToTransaction/parsePaymentAndReKeyTransaction.ts index b768ca7f..bc5b9473 100644 --- a/src/extension/utils/mapAlgorandTransactionToTransaction/parsePaymentAndReKeyTransaction.ts +++ b/src/extension/utils/mapAVMTransactionToTransaction/parsePaymentAndReKeyTransaction.ts @@ -7,13 +7,13 @@ import { TransactionTypeEnum } from '@extension/enums'; import type { IAccountReKeyTransaction, IAccountUndoReKeyTransaction, - IAlgorandPaymentTransaction, + IAVMPaymentTransaction, IBaseTransaction, IPaymentTransaction, } from '@extension/types'; export default function parsePaymentAndReKeyTransaction( - algorandPaymentTransaction: IAlgorandPaymentTransaction, + algorandPaymentTransaction: IAVMPaymentTransaction, baseTransaction: IBaseTransaction ): | IAccountReKeyTransaction diff --git a/src/extension/utils/mapAlgorandTransactionToTransaction/index.ts b/src/extension/utils/mapAlgorandTransactionToTransaction/index.ts deleted file mode 100644 index 4b764ca2..00000000 --- a/src/extension/utils/mapAlgorandTransactionToTransaction/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './mapAlgorandTransactionToTransaction'; diff --git a/src/extension/utils/mapStandardAssetFromAlgorandAsset/mapStandardAssetFromAlgorandAsset.ts b/src/extension/utils/mapStandardAssetFromAlgorandAsset/mapStandardAssetFromAlgorandAsset.ts index 060f5c1a..b212ed2b 100644 --- a/src/extension/utils/mapStandardAssetFromAlgorandAsset/mapStandardAssetFromAlgorandAsset.ts +++ b/src/extension/utils/mapStandardAssetFromAlgorandAsset/mapStandardAssetFromAlgorandAsset.ts @@ -4,10 +4,10 @@ import { BigNumber } from 'bignumber.js'; import { AssetTypeEnum } from '@extension/enums'; // types -import { IAlgorandAsset, IStandardAsset } from '@extension/types'; +import { IAVMAsset, IStandardAsset } from '@extension/types'; export default function mapStandardAssetFromAlgorandAsset( - algorandAsset: IAlgorandAsset, + algorandAsset: IAVMAsset, iconUrl: string | null, verified: boolean ): IStandardAsset { diff --git a/src/extension/utils/parseARC0200Transaction/parseARC0200Transaction.test.ts b/src/extension/utils/parseARC0200Transaction/parseARC0200Transaction.test.ts index 1d393964..9cc18469 100644 --- a/src/extension/utils/parseARC0200Transaction/parseARC0200Transaction.test.ts +++ b/src/extension/utils/parseARC0200Transaction/parseARC0200Transaction.test.ts @@ -12,6 +12,7 @@ describe(`${__dirname}/parseARC0200Transaction`, () => { // arrange const transaction: IApplicationTransaction = { authAddr: null, + block: null, completedAt: 1707654106000, fee: '1000', id: 'JSWYMGXCGMDUT45HWMHAXFM4364Q3HW2IDWMDK66A3LHAGIHQZEQ', diff --git a/src/extension/utils/updateAccountInformation/updateAccountInformation.ts b/src/extension/utils/updateAccountInformation/updateAccountInformation.ts index a519dd2d..6f95e42a 100644 --- a/src/extension/utils/updateAccountInformation/updateAccountInformation.ts +++ b/src/extension/utils/updateAccountInformation/updateAccountInformation.ts @@ -7,7 +7,7 @@ import NetworkClient from '@extension/models/NetworkClient'; // types import type { IAccountInformation, - IAlgorandAccountInformation, + IAVMAccountInformation, IARC0072AssetHolding, IARC0200AssetHolding, } from '@extension/types'; @@ -31,7 +31,7 @@ export default async function updateAccountInformation({ nodeID, }: IOptions): Promise { const _functionName = 'updateAccountInformation'; - let avmAccountInformation: IAlgorandAccountInformation; + let avmAccountInformation: IAVMAccountInformation; let arc0072AssetHoldings: IARC0072AssetHolding[]; let arc200AssetHoldings: IARC0200AssetHolding[]; let networkClient: NetworkClient; diff --git a/src/extension/utils/updateAccountTransactions/updateAccountTransactions.ts b/src/extension/utils/updateAccountTransactions/updateAccountTransactions.ts index c7d8eb09..652b4208 100644 --- a/src/extension/utils/updateAccountTransactions/updateAccountTransactions.ts +++ b/src/extension/utils/updateAccountTransactions/updateAccountTransactions.ts @@ -7,13 +7,13 @@ import NetworkClient from '@extension/models/NetworkClient'; // types import type { IAccountTransactions, - IAlgorandAccountTransaction, + IAVMAccountTransaction, } from '@extension/types'; import type { IOptions } from './types'; // utils -import mapAlgorandTransactionToTransaction from '../mapAlgorandTransactionToTransaction'; -import refreshTransactions from '../refreshTransactions'; +import mapAVMTransactionToTransaction from '@extension/utils/mapAVMTransactionToTransaction'; +import refreshTransactions from '@extension/utils/refreshTransactions'; /** * Gets the account transactions. @@ -30,7 +30,7 @@ export default async function updateAccountTransactions({ refresh = false, }: IOptions): Promise { const _functionName = 'updateAccountTransactions'; - let avmAccountTransaction: IAlgorandAccountTransaction; + let avmAccountTransaction: IAVMAccountTransaction; let mostRecentTransactionTime: number; let networkClient: NetworkClient; @@ -82,7 +82,7 @@ export default async function updateAccountTransactions({ transactions: [ ...currentAccountTransactions.transactions, ...avmAccountTransaction.transactions.map( - mapAlgorandTransactionToTransaction + mapAVMTransactionToTransaction ), ], }; diff --git a/src/extension/utils/updateStandardAssetInformationById/updateStandardAssetInformationById.ts b/src/extension/utils/updateStandardAssetInformationById/updateStandardAssetInformationById.ts index 3e646f45..ca5f6522 100644 --- a/src/extension/utils/updateStandardAssetInformationById/updateStandardAssetInformationById.ts +++ b/src/extension/utils/updateStandardAssetInformationById/updateStandardAssetInformationById.ts @@ -3,7 +3,7 @@ import NetworkClient from '@extension/models/NetworkClient'; // types import type { - IAlgorandAsset, + IAVMAsset, IStandardAsset, ITinyManAssetResponse, } from '@extension/types'; @@ -27,7 +27,7 @@ export default async function updateStandardAssetInformationById({ }: IOptions): Promise { const _functionName = 'updateStandardAssetInformationById'; const networkClient = new NetworkClient({ logger, network }); - let assetInformation: IAlgorandAsset; + let assetInformation: IAVMAsset; let verifiedAsset: ITinyManAssetResponse | null; try { From ea95ae4951102a675da522e6b1b6972126fa52b6 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Tue, 29 Oct 2024 07:26:16 +0000 Subject: [PATCH 3/4] feat: add new voi testnet with new block explorers --- src/extension/config/networks.ts | 37 +++++--------- .../AVMExplorerBlockExplorer.ts | 7 ++- .../AlloBlockExplorer/AlloBlockExplorer.ts | 7 ++- .../BaseBlockExplorer/BaseBlockExplorer.ts | 4 +- .../types/IGroupURLOptions.ts | 6 +++ .../models/BaseBlockExplorer/types/index.ts | 1 + .../PeraBlockExplorer/PeraBlockExplorer.ts | 7 ++- .../VoiBlockExplorer/VoiBlockExplorer.ts | 51 +++++++++++++++++++ .../models/VoiBlockExplorer/index.ts | 1 + .../VoiObserverBlockExplorer.ts | 9 ++-- .../ARC0200AssetTransferTransactionPage.tsx | 7 ++- .../AccountReKeyTransactionPage.tsx | 7 ++- .../AccountUndoReKeyTransactionPage.tsx | 7 ++- .../ApplicationTransactionPage.tsx | 7 ++- .../AssetConfigTransactionPage.tsx | 7 ++- .../AssetCreateTransactionPage.tsx | 7 ++- .../AssetDestroyTransactionPage.tsx | 7 ++- .../AssetFreezeTransactionPage.tsx | 7 ++- .../AssetTransferTransactionPage.tsx | 7 ++- .../PaymentTransactionPage.tsx | 7 ++- .../refreshTransactions.ts | 11 ++-- 21 files changed, 159 insertions(+), 52 deletions(-) create mode 100644 src/extension/models/BaseBlockExplorer/types/IGroupURLOptions.ts create mode 100644 src/extension/models/VoiBlockExplorer/VoiBlockExplorer.ts create mode 100644 src/extension/models/VoiBlockExplorer/index.ts diff --git a/src/extension/config/networks.ts b/src/extension/config/networks.ts index c894e3d6..baf29b0e 100644 --- a/src/extension/config/networks.ts +++ b/src/extension/config/networks.ts @@ -12,11 +12,11 @@ import { AssetTypeEnum, NetworkTypeEnum } from '@extension/enums'; // models import AlloBlockExplorer from '@extension/models/AlloBlockExplorer'; -import AVMExplorerBlockExplorer from '@extension/models/AVMExplorerBlockExplorer'; import NautilusARC0072Indexer from '@extension/models/NautilusARC0072Indexer'; import NFTNavigatorARC0072Indexer from '@extension/models/NFTNavigatorARC0072Indexer'; import NFTNavigatorNFTExplorer from '@extension/models/NFTNavigatorNFTExplorer'; import PeraBlockExplorer from '@extension/models/PeraBlockExplorer'; +import VoiBlockExplorer from '@extension/models/VoiBlockExplorer'; import VoiObserverBlockExplorer from '@extension/models/VoiObserverBlockExplorer'; // types @@ -47,6 +47,9 @@ const networks: INetwork[] = [ canonicalName: 'Voi', chakraTheme: 'voi', blockExplorers: [ + new VoiBlockExplorer({ + baseURL: 'https://block.voi.network', + }), new VoiObserverBlockExplorer({ baseURL: 'https://explorer.voi.network/explorer', canonicalName: 'Voi Network', @@ -93,38 +96,28 @@ const networks: INetwork[] = [ id: null, port: null, token: null, - url: 'https://testnet-api.voi.nodly.io', + url: 'https://testnet-api.voi.nodely.dev', }, ], - arc0072Indexers: [ - new NautilusARC0072Indexer({ - baseURL: 'https://arc72-idx.nautilus.sh', - }), - new NFTNavigatorARC0072Indexer({ - baseURL: 'https://arc72-idx.nftnavigator.xyz', - }), - ], + arc0072Indexers: [], canonicalName: 'Voi', chakraTheme: 'voi', blockExplorers: [ - new VoiObserverBlockExplorer({ - baseURL: 'https://voi.observer/explorer', - }), - new AVMExplorerBlockExplorer({ - baseURL: 'https://avmexplorer.com', + new VoiBlockExplorer({ + baseURL: 'https://testnet.block.voi.network', }), ], feeSunkAddress: - 'FEES3ZW52HQ7U7LB3OGLUFQX2DCCWPJ2LIMXAH75KYROBZBQRN3Q5OR3GI', - genesisId: 'voitest-v1', - genesisHash: 'IXnoWtviVVJW5LGivNFc0Dq14V3kqaXuK2u5OQrdVZo=', + 'TBEIGCNK4UCN3YDP2NODK3MJHTUZMYS3TABRM2MVSI2MPUR2V36E5JYHSY', + genesisId: 'voitest', + genesisHash: '5pbhGq04byd0AgV/sbP+yITANqazgKBuaATr85n21wY=', indexers: [ { canonicalName: 'Nodely', id: null, port: null, token: null, - url: 'https://testnet-idx.voi.nodly.io', + url: 'https://testnet-idx.voi.nodely.dev', }, ], methods: SUPPORTED_METHODS, @@ -140,11 +133,7 @@ const networks: INetwork[] = [ type: AssetTypeEnum.Native, verified: true, }, - nftExplorers: [ - new NFTNavigatorNFTExplorer({ - baseURL: 'https://arc72-idx.nftnavigator.xyz', - }), - ], + nftExplorers: [], type: NetworkTypeEnum.Test, }, /** diff --git a/src/extension/models/AVMExplorerBlockExplorer/AVMExplorerBlockExplorer.ts b/src/extension/models/AVMExplorerBlockExplorer/AVMExplorerBlockExplorer.ts index 29a7b321..b87a967c 100644 --- a/src/extension/models/AVMExplorerBlockExplorer/AVMExplorerBlockExplorer.ts +++ b/src/extension/models/AVMExplorerBlockExplorer/AVMExplorerBlockExplorer.ts @@ -3,7 +3,10 @@ import BaseBlockExplorer from '@extension/models/BaseBlockExplorer'; // types import type { TPartialExcept } from '@common/types'; -import type { INewOptions } from '@extension/models/BaseBlockExplorer'; +import type { + IGroupURLOptions, + INewOptions, +} from '@extension/models/BaseBlockExplorer'; export default class AVMExplorerBlockExplorer extends BaseBlockExplorer { constructor({ @@ -38,7 +41,7 @@ export default class AVMExplorerBlockExplorer extends BaseBlockExplorer { return `${this._baseURL}/block/${block}`; } - public groupURL(groupID: string): string { + public groupURL({ groupID }: IGroupURLOptions): string { return `${this._baseURL}/group/${encodeURIComponent(groupID)}`; } diff --git a/src/extension/models/AlloBlockExplorer/AlloBlockExplorer.ts b/src/extension/models/AlloBlockExplorer/AlloBlockExplorer.ts index 3cfccbb8..df0f79b0 100644 --- a/src/extension/models/AlloBlockExplorer/AlloBlockExplorer.ts +++ b/src/extension/models/AlloBlockExplorer/AlloBlockExplorer.ts @@ -3,7 +3,10 @@ import BaseBlockExplorer from '@extension/models/BaseBlockExplorer'; // types import type { TPartialExcept } from '@common/types'; -import type { INewOptions } from '@extension/models/BaseBlockExplorer'; +import type { + IGroupURLOptions, + INewOptions, +} from '@extension/models/BaseBlockExplorer'; export default class AlloBlockExplorer extends BaseBlockExplorer { constructor({ @@ -38,7 +41,7 @@ export default class AlloBlockExplorer extends BaseBlockExplorer { return `${this._baseURL}/block/${block}`; } - public groupURL(groupID: string): string { + public groupURL({ groupID }: IGroupURLOptions): string { return `${this._baseURL}/tx-group/${encodeURIComponent(groupID)}`; } diff --git a/src/extension/models/BaseBlockExplorer/BaseBlockExplorer.ts b/src/extension/models/BaseBlockExplorer/BaseBlockExplorer.ts index 8c4d37d9..a286ddb3 100644 --- a/src/extension/models/BaseBlockExplorer/BaseBlockExplorer.ts +++ b/src/extension/models/BaseBlockExplorer/BaseBlockExplorer.ts @@ -1,6 +1,6 @@ // types import type { IBaseNetworkServiceProvider } from '@extension/types'; -import type { INewOptions } from './types'; +import type { IGroupURLOptions, INewOptions } from './types'; export default abstract class BaseBlockExplorer implements IBaseNetworkServiceProvider @@ -25,6 +25,6 @@ export default abstract class BaseBlockExplorer public abstract applicationURL(appID: string): string; public abstract assetURL(assetID: string): string; public abstract blockURL(block: string): string; - public abstract groupURL(groupID: string): string; + public abstract groupURL(options: IGroupURLOptions): string; public abstract transactionURL(transactionID: string): string; } diff --git a/src/extension/models/BaseBlockExplorer/types/IGroupURLOptions.ts b/src/extension/models/BaseBlockExplorer/types/IGroupURLOptions.ts new file mode 100644 index 00000000..93aba3cf --- /dev/null +++ b/src/extension/models/BaseBlockExplorer/types/IGroupURLOptions.ts @@ -0,0 +1,6 @@ +interface IGroupURLOptions { + block?: string; + groupID: string; +} + +export default IGroupURLOptions; diff --git a/src/extension/models/BaseBlockExplorer/types/index.ts b/src/extension/models/BaseBlockExplorer/types/index.ts index 52d8062b..c644dbbe 100644 --- a/src/extension/models/BaseBlockExplorer/types/index.ts +++ b/src/extension/models/BaseBlockExplorer/types/index.ts @@ -1 +1,2 @@ +export type { default as IGroupURLOptions } from './IGroupURLOptions'; export type { default as INewOptions } from './INewOptions'; diff --git a/src/extension/models/PeraBlockExplorer/PeraBlockExplorer.ts b/src/extension/models/PeraBlockExplorer/PeraBlockExplorer.ts index 65ed8b9a..50090270 100644 --- a/src/extension/models/PeraBlockExplorer/PeraBlockExplorer.ts +++ b/src/extension/models/PeraBlockExplorer/PeraBlockExplorer.ts @@ -3,7 +3,10 @@ import BaseBlockExplorer from '@extension/models/BaseBlockExplorer'; // types import type { TPartialExcept } from '@common/types'; -import type { INewOptions } from '@extension/models/BaseBlockExplorer'; +import type { + IGroupURLOptions, + INewOptions, +} from '@extension/models/BaseBlockExplorer'; export default class PeraBlockExplorer extends BaseBlockExplorer { constructor({ @@ -38,7 +41,7 @@ export default class PeraBlockExplorer extends BaseBlockExplorer { return `${this._baseURL}/block/${block}`; } - public groupURL(groupID: string): string { + public groupURL({ groupID }: IGroupURLOptions): string { return `${this._baseURL}/tx-group/${encodeURIComponent(groupID)}`; } diff --git a/src/extension/models/VoiBlockExplorer/VoiBlockExplorer.ts b/src/extension/models/VoiBlockExplorer/VoiBlockExplorer.ts new file mode 100644 index 00000000..4ff06896 --- /dev/null +++ b/src/extension/models/VoiBlockExplorer/VoiBlockExplorer.ts @@ -0,0 +1,51 @@ +// models +import BaseBlockExplorer from '@extension/models/BaseBlockExplorer'; + +// types +import type { TPartialExcept } from '@common/types'; +import type { + IGroupURLOptions, + INewOptions, +} from '@extension/models/BaseBlockExplorer'; + +export default class VoiBlockExplorer extends BaseBlockExplorer { + constructor({ + baseURL, + canonicalName, + id, + }: TPartialExcept) { + super({ + baseURL, + canonicalName: canonicalName || 'Voi Block Explorer', + id: id || 'voi-block-explorer', + }); + } + + /** + * public functions + */ + + public accountURL(address: string): string { + return `${this._baseURL}/account/${address}`; + } + + public applicationURL(appID: string): string { + return `${this._baseURL}/application/${appID}`; + } + + public assetURL(assetID: string): string { + return `${this._baseURL}/asset/${assetID}`; + } + + public blockURL(block: string): string { + return `${this._baseURL}/block/${block}`; + } + + public groupURL({ block = '', groupID }: IGroupURLOptions): string { + return `${this._baseURL}/group/${encodeURIComponent(groupID)}/${block}`; + } + + public transactionURL(transactionID: string): string { + return `${this._baseURL}/transaction/${transactionID}`; + } +} diff --git a/src/extension/models/VoiBlockExplorer/index.ts b/src/extension/models/VoiBlockExplorer/index.ts new file mode 100644 index 00000000..c10b3623 --- /dev/null +++ b/src/extension/models/VoiBlockExplorer/index.ts @@ -0,0 +1 @@ +export { default } from './VoiBlockExplorer'; diff --git a/src/extension/models/VoiObserverBlockExplorer/VoiObserverBlockExplorer.ts b/src/extension/models/VoiObserverBlockExplorer/VoiObserverBlockExplorer.ts index e7fc4a8b..016a3200 100644 --- a/src/extension/models/VoiObserverBlockExplorer/VoiObserverBlockExplorer.ts +++ b/src/extension/models/VoiObserverBlockExplorer/VoiObserverBlockExplorer.ts @@ -3,7 +3,10 @@ import BaseBlockExplorer from '@extension/models/BaseBlockExplorer'; // types import type { TPartialExcept } from '@common/types'; -import type { INewOptions } from '@extension/models/BaseBlockExplorer'; +import type { + IGroupURLOptions, + INewOptions, +} from '@extension/models/BaseBlockExplorer'; export default class VoiObserverBlockExplorer extends BaseBlockExplorer { constructor({ @@ -38,8 +41,8 @@ export default class VoiObserverBlockExplorer extends BaseBlockExplorer { return `${this._baseURL}/block/${block}`; } - public groupURL(groupID: string): string { - return `${this._baseURL}/group/${encodeURIComponent(groupID)}`; + public groupURL({ block = '', groupID }: IGroupURLOptions): string { + return `${this._baseURL}/group/${encodeURIComponent(groupID)}/${block}`; } public transactionURL(transactionID: string): string { diff --git a/src/extension/pages/TransactionPage/ARC0200AssetTransferTransactionPage.tsx b/src/extension/pages/TransactionPage/ARC0200AssetTransferTransactionPage.tsx index 0ebbae9f..cb399ae6 100644 --- a/src/extension/pages/TransactionPage/ARC0200AssetTransferTransactionPage.tsx +++ b/src/extension/pages/TransactionPage/ARC0200AssetTransferTransactionPage.tsx @@ -315,7 +315,12 @@ const ARC0200AssetTransferTransactionPage: FC< tooltipLabel={t('captions.openOn', { name: explorer.canonicalName, })} - url={explorer.groupURL(transaction.groupId)} + url={explorer.groupURL({ + groupID: transaction.groupId, + ...(transaction.block && { + block: transaction.block, + }), + })} /> )} diff --git a/src/extension/pages/TransactionPage/AccountReKeyTransactionPage.tsx b/src/extension/pages/TransactionPage/AccountReKeyTransactionPage.tsx index 8e2d2d49..1cd738bb 100644 --- a/src/extension/pages/TransactionPage/AccountReKeyTransactionPage.tsx +++ b/src/extension/pages/TransactionPage/AccountReKeyTransactionPage.tsx @@ -297,7 +297,12 @@ const AccountReKeyTransactionPage: FC> = ({ tooltipLabel={t('captions.openOn', { name: explorer.canonicalName, })} - url={explorer.groupURL(transaction.groupId)} + url={explorer.groupURL({ + groupID: transaction.groupId, + ...(transaction.block && { + block: transaction.block, + }), + })} /> )} diff --git a/src/extension/pages/TransactionPage/AccountUndoReKeyTransactionPage.tsx b/src/extension/pages/TransactionPage/AccountUndoReKeyTransactionPage.tsx index 89f472c2..b042a410 100644 --- a/src/extension/pages/TransactionPage/AccountUndoReKeyTransactionPage.tsx +++ b/src/extension/pages/TransactionPage/AccountUndoReKeyTransactionPage.tsx @@ -257,7 +257,12 @@ const AccountUndoReKeyTransactionPage: FC< tooltipLabel={t('captions.openOn', { name: explorer.canonicalName, })} - url={explorer.groupURL(transaction.groupId)} + url={explorer.groupURL({ + groupID: transaction.groupId, + ...(transaction.block && { + block: transaction.block, + }), + })} /> )} diff --git a/src/extension/pages/TransactionPage/ApplicationTransactionPage.tsx b/src/extension/pages/TransactionPage/ApplicationTransactionPage.tsx index 633876d4..860af2e1 100644 --- a/src/extension/pages/TransactionPage/ApplicationTransactionPage.tsx +++ b/src/extension/pages/TransactionPage/ApplicationTransactionPage.tsx @@ -229,7 +229,12 @@ const ApplicationTransactionPage: FC> = ({ tooltipLabel={t('captions.openOn', { name: explorer.canonicalName, })} - url={explorer.groupURL(transaction.groupId)} + url={explorer.groupURL({ + groupID: transaction.groupId, + ...(transaction.block && { + block: transaction.block, + }), + })} /> )} diff --git a/src/extension/pages/TransactionPage/AssetConfigTransactionPage.tsx b/src/extension/pages/TransactionPage/AssetConfigTransactionPage.tsx index d29eeb0c..e11c97f2 100644 --- a/src/extension/pages/TransactionPage/AssetConfigTransactionPage.tsx +++ b/src/extension/pages/TransactionPage/AssetConfigTransactionPage.tsx @@ -344,7 +344,12 @@ const AssetConfigTransactionPage: FC> = ({ tooltipLabel={t('captions.openOn', { name: explorer.canonicalName, })} - url={explorer.groupURL(transaction.groupId)} + url={explorer.groupURL({ + groupID: transaction.groupId, + ...(transaction.block && { + block: transaction.block, + }), + })} /> )} diff --git a/src/extension/pages/TransactionPage/AssetCreateTransactionPage.tsx b/src/extension/pages/TransactionPage/AssetCreateTransactionPage.tsx index eb00512c..8b3cff10 100644 --- a/src/extension/pages/TransactionPage/AssetCreateTransactionPage.tsx +++ b/src/extension/pages/TransactionPage/AssetCreateTransactionPage.tsx @@ -387,7 +387,12 @@ const AssetCreateTransactionPage: FC> = ({ tooltipLabel={t('captions.openOn', { name: explorer.canonicalName, })} - url={explorer.groupURL(transaction.groupId)} + url={explorer.groupURL({ + groupID: transaction.groupId, + ...(transaction.block && { + block: transaction.block, + }), + })} /> )} diff --git a/src/extension/pages/TransactionPage/AssetDestroyTransactionPage.tsx b/src/extension/pages/TransactionPage/AssetDestroyTransactionPage.tsx index 7f5f4c4e..3381edc1 100644 --- a/src/extension/pages/TransactionPage/AssetDestroyTransactionPage.tsx +++ b/src/extension/pages/TransactionPage/AssetDestroyTransactionPage.tsx @@ -236,7 +236,12 @@ const AssetDestroyTransactionPage: FC> = ({ tooltipLabel={t('captions.openOn', { name: explorer.canonicalName, })} - url={explorer.groupURL(transaction.groupId)} + url={explorer.groupURL({ + groupID: transaction.groupId, + ...(transaction.block && { + block: transaction.block, + }), + })} /> )} diff --git a/src/extension/pages/TransactionPage/AssetFreezeTransactionPage.tsx b/src/extension/pages/TransactionPage/AssetFreezeTransactionPage.tsx index 360dfcc4..b259d3bb 100644 --- a/src/extension/pages/TransactionPage/AssetFreezeTransactionPage.tsx +++ b/src/extension/pages/TransactionPage/AssetFreezeTransactionPage.tsx @@ -254,7 +254,12 @@ const AssetTransferTransactionContent: FC< tooltipLabel={t('captions.openOn', { name: explorer.canonicalName, })} - url={explorer.groupURL(transaction.groupId)} + url={explorer.groupURL({ + groupID: transaction.groupId, + ...(transaction.block && { + block: transaction.block, + }), + })} /> )} diff --git a/src/extension/pages/TransactionPage/AssetTransferTransactionPage.tsx b/src/extension/pages/TransactionPage/AssetTransferTransactionPage.tsx index d8a4dd92..90c6e6a8 100644 --- a/src/extension/pages/TransactionPage/AssetTransferTransactionPage.tsx +++ b/src/extension/pages/TransactionPage/AssetTransferTransactionPage.tsx @@ -299,7 +299,12 @@ const AssetTransferTransactionPage: FC> = ({ tooltipLabel={t('captions.openOn', { name: explorer.canonicalName, })} - url={explorer.groupURL(transaction.groupId)} + url={explorer.groupURL({ + groupID: transaction.groupId, + ...(transaction.block && { + block: transaction.block, + }), + })} /> )} diff --git a/src/extension/pages/TransactionPage/PaymentTransactionPage.tsx b/src/extension/pages/TransactionPage/PaymentTransactionPage.tsx index be2af5aa..2b8921d2 100644 --- a/src/extension/pages/TransactionPage/PaymentTransactionPage.tsx +++ b/src/extension/pages/TransactionPage/PaymentTransactionPage.tsx @@ -277,7 +277,12 @@ const PaymentTransactionPage: FC> = ({ tooltipLabel={t('captions.openOn', { name: explorer.canonicalName, })} - url={explorer.groupURL(transaction.groupId)} + url={explorer.groupURL({ + groupID: transaction.groupId, + ...(transaction.block && { + block: transaction.block, + }), + })} /> )} diff --git a/src/extension/utils/refreshTransactions/refreshTransactions.ts b/src/extension/utils/refreshTransactions/refreshTransactions.ts index 001b8648..aa7c3c90 100644 --- a/src/extension/utils/refreshTransactions/refreshTransactions.ts +++ b/src/extension/utils/refreshTransactions/refreshTransactions.ts @@ -8,14 +8,11 @@ import { import NetworkClient from '@extension/models/NetworkClient'; // types -import type { - IAlgorandAccountTransaction, - ITransactions, -} from '@extension/types'; +import type { IAVMAccountTransaction, ITransactions } from '@extension/types'; import type { IOptions } from './types'; // utils -import mapAlgorandTransactionToTransaction from '../mapAlgorandTransactionToTransaction'; +import mapAVMTransactionToTransaction from '@extension/utils/mapAVMTransactionToTransaction'; /** * Fetches all latest transactions from a given time. This function runs recursively until the 'next-token' is @@ -34,7 +31,7 @@ export default async function refreshTransactions({ }: IOptions): Promise { const _functionName = 'refreshTransactions'; const networkClient = new NetworkClient({ logger, network }); - let avmAccountTransactions: IAlgorandAccountTransaction; + let avmAccountTransactions: IAVMAccountTransaction; let newestTransactions: ITransactions[]; try { @@ -48,7 +45,7 @@ export default async function refreshTransactions({ nodeID, }); newestTransactions = avmAccountTransactions.transactions.map( - mapAlgorandTransactionToTransaction + mapAVMTransactionToTransaction ); logger?.debug( From 9fee2874b35154a36c07257fef1f380ee29c9944 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Wed, 30 Oct 2024 06:56:29 +0000 Subject: [PATCH 4/4] feat: update what's new modal --- .../modals/WhatsNewModal/WhatsNewModal.tsx | 67 +++++++------------ 1 file changed, 26 insertions(+), 41 deletions(-) diff --git a/src/extension/modals/WhatsNewModal/WhatsNewModal.tsx b/src/extension/modals/WhatsNewModal/WhatsNewModal.tsx index 57698ad5..75b3897e 100644 --- a/src/extension/modals/WhatsNewModal/WhatsNewModal.tsx +++ b/src/extension/modals/WhatsNewModal/WhatsNewModal.tsx @@ -67,6 +67,7 @@ const WhatsNewModal: FC = ({ onClose }) => { const features = [ '💅 Change account icon.', '💅 Change account background color.', + '🔁 Switch to new Voi testnet.', ]; const fixes: string[] = []; // handlers @@ -124,7 +125,7 @@ const WhatsNewModal: FC = ({ onClose }) => { textAlign="left" w="full" > - Voi Launches MainNet! + Airdrops Have Dropped! = ({ onClose }) => { textAlign="left" w="full" > - Voi's Genesis Day took place on{' '} - - 12th September 2024 - {' '} - which means Voi has officially launched its MainNet! + On the 28th October 2024, all those that participated in the + Testnet Phase 1 & 2 and Staking programs will have received their + airdrops. For the Testnet program, 3.67% of the total token supply + (367 million VOI) was allocated and 1.4% of the total token supply + (140 million VOI) was allocated to the Staking program. Each + program had an optional lock-up period, with the Testnet program + having a higher lock-up period of upto 5 years, and, notably, 55% + of the participants chose to lock-up for the full 5 years. = ({ onClose }) => { textAlign="left" w="full" > - This truly has been a community effort; from the builders, the - node runners to the questers. Voi's TestNet has been a monumental - success and Voi has a solid foundation that makes it an ecosystem - that is run by you: the Voiagers. + These effort-based airdrops are testament to Voi's commitment to + being a truly community-driven blockchain. - - Voi MainNet Rollout: Staking Program - - - With Voi's MainNet rollout, there is a new incentive for early - participation: the Staking Program. - - - - The Staking Program is designed to incentivize long-term - commitment by offering two ways to earn rewards:{' '} - token lock-up and{' '} - staking those locked up tokens. + You can check the state of your airdrop contracts using the + beautifully crafted airdrop tool{' '} + + https://staking.voi.network/ + + . = ({ onClose }) => { textAlign="left" w="full" > - See{' '} + For more information relating to the airdrops, check{' '} - here + this {' '} - for more details. + blog post. {/*new release*/}