Skip to content

Commit

Permalink
update dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
michavie committed Jul 23, 2024
1 parent 272f903 commit 659d75c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
4 changes: 2 additions & 2 deletions dev/src/config.ts
Original file line number Diff line number Diff line change
@@ -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',

Expand Down
12 changes: 6 additions & 6 deletions dev/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
}
Expand Down
35 changes: 21 additions & 14 deletions dev/src/setup.ts
Original file line number Diff line number Diff line change
@@ -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',
},
},

Expand Down Expand Up @@ -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: {
Expand All @@ -88,6 +93,8 @@ const defaultConfig = (dark: boolean, currentUserAddress: string | null): Extens
levelUpperLimit: '100',
levelProgressPercent: 0,
},
trust: 1,
affiliate: null,
} as UserPrivate,
})

Expand Down

0 comments on commit 659d75c

Please sign in to comment.