diff --git a/dev/src/config.ts b/dev/src/config.ts index 3c7da2d..fb5bd7e 100644 --- a/dev/src/config.ts +++ b/dev/src/config.ts @@ -1,7 +1,7 @@ -import { NetworkId, EntityTag } from '@peerme/core-ts' +import { AppEnv, EntityTag } from '@peerme/core-ts' export const DevServerConfig = { - Network: 'devnet' as NetworkId, + Network: 'devnet' as AppEnv, WalletConnectProjectId: '9b1a9564f91cb659ffe21b73d5c4e2d8', diff --git a/dev/src/helpers.ts b/dev/src/helpers.ts index 992b18a..3fee65a 100644 --- a/dev/src/helpers.ts +++ b/dev/src/helpers.ts @@ -1,7 +1,7 @@ -import { DevServerConfig } from './config' +import { Address, ContractFunction, Interaction, SmartContract, TokenTransfer } from '@multiversx/sdk-core' import { AccountType } from '@multiversx/sdk-dapp/types' -import { ProposalAction, toActionArgsBigInt } from '@peerme/core-ts' -import { Address, Interaction, SmartContract, TokenTransfer, ContractFunction } from '@multiversx/sdk-core' +import { ProposalAction, toSerializableAction, transformActionArgToTypedValue } from '@peerme/core-ts' +import { DevServerConfig } from './config' const GasLimit = 50_000_000 @@ -13,7 +13,7 @@ export const toDemoTransaction = (action: ProposalAction, account: AccountType) console.log('Actions [serialized]', toSerializableAction(action, GasLimit)) - let interaction = new Interaction(sc, new ContractFunction(action.endpoint), typedArgs) + let interaction = new Interaction(sc, new ContractFunction(action.endpoint!), typedArgs) .withChainID(DevServerConfig.ChainId) .withSender(new Address(account.address)) .withGasLimit(GasLimit) @@ -25,7 +25,7 @@ export const toDemoTransaction = (action: ProposalAction, account: AccountType) const tokenTransfer = TokenTransfer.metaEsdtFromBigInteger( payment.tokenId, payment.tokenNonce, - toActionArgsBigInt(payment.amount), + payment.amount, payment.tokenDecimals! ) const isFungible = payment.tokenNonce === 0 @@ -35,7 +35,7 @@ export const toDemoTransaction = (action: ProposalAction, account: AccountType) : interaction.withSingleESDTNFTTransfer(tokenTransfer) } else if (action.payments.length > 1) { const tokenTransfer = action.payments.map((p) => - TokenTransfer.metaEsdtFromBigInteger(p.tokenId, p.tokenNonce, toActionArgsBigInt(p.amount), p.tokenDecimals!) + TokenTransfer.metaEsdtFromBigInteger(p.tokenId, p.tokenNonce, p.amount, p.tokenDecimals!) ) interaction = interaction.withMultiESDTNFTTransfer(tokenTransfer) } diff --git a/dev/src/setup.ts b/dev/src/setup.ts index c5ae287..41fe81c 100644 --- a/dev/src/setup.ts +++ b/dev/src/setup.ts @@ -1,30 +1,34 @@ -import { UserPrivate } from '@peerme/core-ts' +import { AppNetwork, UserPrivate } from '@peerme/core-ts' import { ExtensionConfig } from '@peerme/extensions' const DemoDaoScAddress = 'erd1qqqqqqqqqqqqqpgqg8t3yh3hr5vxpgsrwwqf3qh0v7e6ydd327rschchqc' +const DefaultNetwork: AppNetwork = { + name: 'multiversx', + displayName: 'MultiversX', + env: 'devnet', + urls: { + api: 'https://devnet-api.multiversx.com', + explorer: 'https://devnet-explorer.multiversx.com', + }, + chainId: 'D', + blockTimeMs: 6000, +} + const defaultConfig = (dark: boolean, currentUserAddress: string | null): ExtensionConfig => ({ - network: 'devnet', + network: DefaultNetwork, dark, hasEarlyAccess: true, - walletConfig: { - Debug: true, - ApiAddress: 'https://devnet-api.multiversx.com', - Explorer: 'https://explorer.multiversx.com', - WalletConnectProjectId: 'b5682bd383460cd7c5c99f21c07d40ed', - ChainId: 'D', - }, - searchConfig: { HostUrl: '', ApiKey: '', Indexes: { - Users: 'users', - Entities: 'entities', - Proposals: 'proposals', + Users: () => 'users', + Entities: () => 'entities', + Proposals: () => 'proposals', }, }, @@ -65,8 +69,9 @@ const defaultConfig = (dark: boolean, currentUserAddress: string | null): Extens parent: null, children: [], pipeline: null, - extra: [], favorited: false, + network: DefaultNetwork, + kyc: null, }, user: { @@ -88,6 +93,8 @@ const defaultConfig = (dark: boolean, currentUserAddress: string | null): Extens levelUpperLimit: '100', levelProgressPercent: 0, }, + trust: 1, + affiliate: null, } as UserPrivate, })