From 9101f02f85916ccb0b43fe68103cc79c8b144bbd Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Mon, 6 May 2024 14:03:34 -0600 Subject: [PATCH 1/4] #8: Update API paths and move read contract to contract/[contract_id]/[method] --- app/v1/account/[account]/nonce/route.ts | 2 +- app/v1/block/[block_id]/route.ts | 2 +- app/v1/chain/fork_heads/route.ts | 2 +- app/v1/chain/head_info/route.ts | 2 +- app/v1/chain/id/route.ts | 2 +- app/v1/chain/resource_limits/route.ts | 2 +- app/v1/contract/[contract_id]/{read => }/[method]/route.ts | 5 ++--- app/v1/contract/[contract_id]/abi/route.ts | 2 +- app/v1/decode/events/route.ts | 2 +- app/v1/decode/operations/route.ts | 2 +- app/v1/nft/[contract_id]/balance/[account]/route.ts | 2 +- app/v1/nft/[contract_id]/info/route.ts | 2 +- app/v1/nft/[contract_id]/name/route.ts | 2 +- app/v1/nft/[contract_id]/symbol/route.ts | 2 +- app/v1/nft/[contract_id]/total_supply/route.ts | 2 +- app/v1/nft/[contract_id]/uri/route.ts | 2 +- app/v1/token/[contract_id]/balance/[account]/route.ts | 2 +- app/v1/token/[contract_id]/decimals/route.ts | 2 +- app/v1/token/[contract_id]/info/route.ts | 2 +- app/v1/token/[contract_id]/name/route.ts | 2 +- app/v1/token/[contract_id]/symbol/route.ts | 2 +- app/v1/token/[contract_id]/total_supply/route.ts | 2 +- app/v1/transaction/[transaction_id]/route.ts | 2 +- app/v1/transaction/prepare/route.ts | 2 +- app/v1/transaction/submit/route.ts | 2 +- 25 files changed, 26 insertions(+), 27 deletions(-) rename app/v1/contract/[contract_id]/{read => }/[method]/route.ts (96%) diff --git a/app/v1/account/[account]/nonce/route.ts b/app/v1/account/[account]/nonce/route.ts index 35ac42f..aba1d91 100644 --- a/app/v1/account/[account]/nonce/route.ts +++ b/app/v1/account/[account]/nonce/route.ts @@ -5,7 +5,7 @@ import { decode } from 'punycode' /** * @swagger - * /api/account/{account}/nonce: + * /v1/account/{account}/nonce: * get: * tags: [Accounts] * description: Returns the account's nonce diff --git a/app/v1/block/[block_id]/route.ts b/app/v1/block/[block_id]/route.ts index 9065d75..79f202d 100644 --- a/app/v1/block/[block_id]/route.ts +++ b/app/v1/block/[block_id]/route.ts @@ -6,7 +6,7 @@ import { decodeOperations } from '@/utils/operations' /** * @swagger - * /api/block/{block_id}: + * /v1/block/{block_id}: * get: * tags: [Blocks] * description: Input a block id or number. Return data about that block and its receipt. diff --git a/app/v1/chain/fork_heads/route.ts b/app/v1/chain/fork_heads/route.ts index e4b6991..8df8eda 100644 --- a/app/v1/chain/fork_heads/route.ts +++ b/app/v1/chain/fork_heads/route.ts @@ -3,7 +3,7 @@ import { getProvider } from '@/utils/providers' /** * @swagger - * /api/chain/fork_heads: + * /v1/chain/fork_heads: * get: * tags: [Chain] * description: Returns the chain's fork heads diff --git a/app/v1/chain/head_info/route.ts b/app/v1/chain/head_info/route.ts index f75adca..34d3bb1 100644 --- a/app/v1/chain/head_info/route.ts +++ b/app/v1/chain/head_info/route.ts @@ -3,7 +3,7 @@ import { getProvider } from '@/utils/providers' /** * @swagger - * /api/chain/head_info: + * /v1/chain/head_info: * get: * tags: [Chain] * description: Returns the chain's head info diff --git a/app/v1/chain/id/route.ts b/app/v1/chain/id/route.ts index a90207c..ff33f51 100644 --- a/app/v1/chain/id/route.ts +++ b/app/v1/chain/id/route.ts @@ -3,7 +3,7 @@ import { getProvider } from '@/utils/providers' /** * @swagger - * /api/chain/id: + * /v1/chain/id: * get: * tags: [Chain] * description: Returns the chain id diff --git a/app/v1/chain/resource_limits/route.ts b/app/v1/chain/resource_limits/route.ts index ef6489d..d840d07 100644 --- a/app/v1/chain/resource_limits/route.ts +++ b/app/v1/chain/resource_limits/route.ts @@ -3,7 +3,7 @@ import { getProvider } from '@/utils/providers' /** * @swagger - * /api/chain/resource_limits: + * /v1/chain/resource_limits: * get: * tags: [Chain] * description: Returns the chain's resource limits diff --git a/app/v1/contract/[contract_id]/read/[method]/route.ts b/app/v1/contract/[contract_id]/[method]/route.ts similarity index 96% rename from app/v1/contract/[contract_id]/read/[method]/route.ts rename to app/v1/contract/[contract_id]/[method]/route.ts index 20e030d..87a0980 100644 --- a/app/v1/contract/[contract_id]/read/[method]/route.ts +++ b/app/v1/contract/[contract_id]/[method]/route.ts @@ -4,7 +4,7 @@ import { AppError, handleError, getErrorMessage } from '@/utils/errors' /** * @swagger - * /api/contract/{contract_id}/read/{method}: + * /v1/contract/{contract_id}/{method}: * get: * tags: [Contracts] * description: Read the contract contract using the method and arguments provided @@ -89,7 +89,7 @@ export async function GET( /** * @swagger - * /api/contract/{contract_id}/read/{method}: + * /v1/contract/{contract_id}/{method}: * post: * tags: [Contracts] * description: Read the contract using the method and arguments provided @@ -108,7 +108,6 @@ export async function GET( * description: Method of the contract to call * required: true * example: balance_of - * - $ref: '#/components/parameters/X-JSON-RPC-URL' * requestBody: * description: Arguments for the method call * required: true diff --git a/app/v1/contract/[contract_id]/abi/route.ts b/app/v1/contract/[contract_id]/abi/route.ts index d773469..e30d9d1 100644 --- a/app/v1/contract/[contract_id]/abi/route.ts +++ b/app/v1/contract/[contract_id]/abi/route.ts @@ -7,7 +7,7 @@ import protobufjs from 'protobufjs' /** * @swagger - * /api/contract/{contract_id}/abi: + * /v1/contract/{contract_id}/abi: * get: * tags: [Contracts] * description: Returns the contract's ABI diff --git a/app/v1/decode/events/route.ts b/app/v1/decode/events/route.ts index 379453f..63240d4 100644 --- a/app/v1/decode/events/route.ts +++ b/app/v1/decode/events/route.ts @@ -5,7 +5,7 @@ import { decodeEvents } from '@/utils/events' /** * @swagger - * /api/decode/events: + * /v1/decode/events: * post: * tags: [Decode] * description: This endpoint takes an array of "encoded" events and returns an array of "decoded" events. Feel free to test the example request body and response below before testing out your own data. diff --git a/app/v1/decode/operations/route.ts b/app/v1/decode/operations/route.ts index cb9ce31..5bfb42b 100644 --- a/app/v1/decode/operations/route.ts +++ b/app/v1/decode/operations/route.ts @@ -5,7 +5,7 @@ import { decodeOperations } from '@/utils/operations' /** * @swagger - * /api/decode/operations: + * /v1/decode/operations: * post: * tags: [Decode] * description: This endpoint takes an array of 'encoded' operations and returns an array of 'decoded' operations. Feel free to test the example request body and response below before testing out your own data. diff --git a/app/v1/nft/[contract_id]/balance/[account]/route.ts b/app/v1/nft/[contract_id]/balance/[account]/route.ts index 0dac5cf..f3ff458 100644 --- a/app/v1/nft/[contract_id]/balance/[account]/route.ts +++ b/app/v1/nft/[contract_id]/balance/[account]/route.ts @@ -4,7 +4,7 @@ import { getNFTContract } from '@/utils/tokens' /** * @swagger - * /api/nft/{contract_id}/balance/{account}: + * /v1/nft/{contract_id}/balance/{account}: * get: * tags: [Non Fungible Tokens] * description: Returns the non fungible token's account balance. diff --git a/app/v1/nft/[contract_id]/info/route.ts b/app/v1/nft/[contract_id]/info/route.ts index 0534ab3..31d600f 100644 --- a/app/v1/nft/[contract_id]/info/route.ts +++ b/app/v1/nft/[contract_id]/info/route.ts @@ -5,7 +5,7 @@ import { utils } from 'koilib' /** * @swagger - * /api/nft/{contract_id}/info: + * /v1/nft/{contract_id}/info: * get: * tags: [Non Fungible Tokens] * description: Returns information about the non fungible token, such as its name, symbol, total supply, and URI. diff --git a/app/v1/nft/[contract_id]/name/route.ts b/app/v1/nft/[contract_id]/name/route.ts index d84d6f5..5c807d7 100644 --- a/app/v1/nft/[contract_id]/name/route.ts +++ b/app/v1/nft/[contract_id]/name/route.ts @@ -4,7 +4,7 @@ import { getNFTContract } from '@/utils/tokens' /** * @swagger - * /api/nft/{contract_id}/name: + * /v1/nft/{contract_id}/name: * get: * tags: [Non Fungible Tokens] * description: Returns the name of the non fungible token. diff --git a/app/v1/nft/[contract_id]/symbol/route.ts b/app/v1/nft/[contract_id]/symbol/route.ts index 852869d..c75c0e8 100644 --- a/app/v1/nft/[contract_id]/symbol/route.ts +++ b/app/v1/nft/[contract_id]/symbol/route.ts @@ -4,7 +4,7 @@ import { getNFTContract } from '@/utils/tokens' /** * @swagger - * /api/nft/{contract_id}/symbol: + * /v1/nft/{contract_id}/symbol: * get: * tags: [Non Fungible Tokens] * description: Returns the symbol of the non fungible token. diff --git a/app/v1/nft/[contract_id]/total_supply/route.ts b/app/v1/nft/[contract_id]/total_supply/route.ts index 51afcbf..038fa42 100644 --- a/app/v1/nft/[contract_id]/total_supply/route.ts +++ b/app/v1/nft/[contract_id]/total_supply/route.ts @@ -4,7 +4,7 @@ import { getNFTContract } from '@/utils/tokens' /** * @swagger - * /api/nft/{contract_id}/total_supply: + * /v1/nft/{contract_id}/total_supply: * get: * tags: [Non Fungible Tokens] * description: Returns the total supply of the non fungible token. diff --git a/app/v1/nft/[contract_id]/uri/route.ts b/app/v1/nft/[contract_id]/uri/route.ts index 93983ba..33d379a 100644 --- a/app/v1/nft/[contract_id]/uri/route.ts +++ b/app/v1/nft/[contract_id]/uri/route.ts @@ -4,7 +4,7 @@ import { getNFTContract } from '@/utils/tokens' /** * @swagger - * /api/nft/{contract_id}/uri: + * /v1/nft/{contract_id}/uri: * get: * tags: [Non Fungible Tokens] * description: Returns the URI associated with the non fungible token contract. diff --git a/app/v1/token/[contract_id]/balance/[account]/route.ts b/app/v1/token/[contract_id]/balance/[account]/route.ts index 6e69d45..42f3ec9 100644 --- a/app/v1/token/[contract_id]/balance/[account]/route.ts +++ b/app/v1/token/[contract_id]/balance/[account]/route.ts @@ -6,7 +6,7 @@ import { utils } from 'koilib' /** * @swagger - * /api/token/{contract_id}/balance/{account}: + * /v1/token/{contract_id}/balance/{account}: * get: * tags: [Fungible Tokens] * description: Returns the fungible token balance for a specific account diff --git a/app/v1/token/[contract_id]/decimals/route.ts b/app/v1/token/[contract_id]/decimals/route.ts index c6b99c3..6bcd93a 100644 --- a/app/v1/token/[contract_id]/decimals/route.ts +++ b/app/v1/token/[contract_id]/decimals/route.ts @@ -4,7 +4,7 @@ import { getFTContract } from '@/utils/tokens' /** * @swagger - * /api/token/{contract_id}/decimals: + * /v1/token/{contract_id}/decimals: * get: * tags: [Fungible Tokens] * description: Returns the number of decimals for a fungible token diff --git a/app/v1/token/[contract_id]/info/route.ts b/app/v1/token/[contract_id]/info/route.ts index 2e15280..ac87eca 100644 --- a/app/v1/token/[contract_id]/info/route.ts +++ b/app/v1/token/[contract_id]/info/route.ts @@ -5,7 +5,7 @@ import { utils } from 'koilib' /** * @swagger - * /api/token/{contract_id}/info: + * /v1/token/{contract_id}/info: * get: * tags: [Fungible Tokens] * description: Returns the fungible token's information such as name, symbol, decimals, and total supply diff --git a/app/v1/token/[contract_id]/name/route.ts b/app/v1/token/[contract_id]/name/route.ts index a512085..494d045 100644 --- a/app/v1/token/[contract_id]/name/route.ts +++ b/app/v1/token/[contract_id]/name/route.ts @@ -4,7 +4,7 @@ import { getFTContract } from '@/utils/tokens' /** * @swagger - * /api/token/{contract_id}/name: + * /v1/token/{contract_id}/name: * get: * tags: [Fungible Tokens] * description: Returns the name of the fungible token diff --git a/app/v1/token/[contract_id]/symbol/route.ts b/app/v1/token/[contract_id]/symbol/route.ts index ae2ff55..7732423 100644 --- a/app/v1/token/[contract_id]/symbol/route.ts +++ b/app/v1/token/[contract_id]/symbol/route.ts @@ -4,7 +4,7 @@ import { getFTContract } from '@/utils/tokens' /** * @swagger - * /api/token/{contract_id}/symbol: + * /v1/token/{contract_id}/symbol: * get: * tags: [Fungible Tokens] * description: Returns the symbol of the fungible token diff --git a/app/v1/token/[contract_id]/total_supply/route.ts b/app/v1/token/[contract_id]/total_supply/route.ts index 9f64da7..a38ed93 100644 --- a/app/v1/token/[contract_id]/total_supply/route.ts +++ b/app/v1/token/[contract_id]/total_supply/route.ts @@ -5,7 +5,7 @@ import { utils } from 'koilib' /** * @swagger - * /api/token/{contract_id}/total_supply: + * /v1/token/{contract_id}/total_supply: * get: * tags: [Fungible Tokens] * description: Returns the total supply of the fungible token diff --git a/app/v1/transaction/[transaction_id]/route.ts b/app/v1/transaction/[transaction_id]/route.ts index 22bd7e8..ca99f56 100644 --- a/app/v1/transaction/[transaction_id]/route.ts +++ b/app/v1/transaction/[transaction_id]/route.ts @@ -6,7 +6,7 @@ import { interfaces } from 'koilib' /** * @swagger - * /api/transaction/{transaction_id}: + * /v1/transaction/{transaction_id}: * get: * tags: [Transactions] * description: Returns detailed information about a specific transaction. diff --git a/app/v1/transaction/prepare/route.ts b/app/v1/transaction/prepare/route.ts index 1f96c8b..655d9d4 100644 --- a/app/v1/transaction/prepare/route.ts +++ b/app/v1/transaction/prepare/route.ts @@ -5,7 +5,7 @@ import { NextRequest, NextResponse } from 'next/server' /** * @swagger - * /api/transaction/prepare: + * /v1/transaction/prepare: * post: * tags: [Transactions] * description: This endpoint takes a transaction and an optional provider and/or payer, then returns a prepared transaction object. diff --git a/app/v1/transaction/submit/route.ts b/app/v1/transaction/submit/route.ts index 38bb752..1646faa 100644 --- a/app/v1/transaction/submit/route.ts +++ b/app/v1/transaction/submit/route.ts @@ -6,7 +6,7 @@ import { revalidatePath } from 'next/cache' /** * @swagger - * /api/transaction/submit: + * /v1/transaction/submit: * post: * tags: [Transactions] * description: This endpoint takes a transaction and submits it to the JSON RPC node. From 13cf23ee4070e7e3a979964b20dc28a529df2bae Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Mon, 6 May 2024 14:31:49 -0600 Subject: [PATCH 2/4] #7 Allow configuring contract addresses via environment --- app.config.ts | 37 +++++++++++++++++++++++++++---------- utils/providers.ts | 12 +----------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/app.config.ts b/app.config.ts index c82bc43..a27ffc2 100644 --- a/app.config.ts +++ b/app.config.ts @@ -1,3 +1,20 @@ +declare global { + namespace NodeJS { + interface ProcessEnv { + JSONRPC_URL: string, + KOIN_ADDRESS: string, + VHP_ADDRESS: string, + POB_ADDRESS: string, + CLAIM_ADDRESS: string, + GOVERNANCE_ADDRESS: string, + NAMESERVICE_ADDRESS: string, + RESOURCES_ADDRESS: string, + KAP_ADDRESS: string, + NICKNAMES_ADDRESS: string + } + } +} + export type Config = { jsonRPC: string systemContracts: Record @@ -5,18 +22,18 @@ export type Config = { } export const config: Config = { - jsonRPC: 'http://localhost:8080/', + jsonRPC: process.env.JSONRPC_URL || 'http://localhost:8080/', systemContracts: { - koin: '15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL', - vhp: '18tWNU7E4yuQzz7hMVpceb9ixmaWLVyQsr', - pob: '159myq5YUhhoVWu3wsHKHiJYKPKGUrGiyv', - claim: '18zw3ZokdfHtudzaWAUnU4tUvKzKiJeN76', - governance: '19qj51eTbSFJYU7ZagudkpxPgNSzPMfdPX', - nameservice: '19WxDJ9Kcvx4VqQFkpwVmwVEy1hMuwXtQE', - resources: '1HGN9h47CzoFwU2bQZwe6BYoX4TM6pXc4b' + koin: process.env.KOIN_ADDRESS || '15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL', + vhp: process.env.VHP_ADDRESS || '18tWNU7E4yuQzz7hMVpceb9ixmaWLVyQsr', + pob: process.env.POB_ADDRESS || '159myq5YUhhoVWu3wsHKHiJYKPKGUrGiyv', + claim: process.env.CLAIM_ADDRESS || '18zw3ZokdfHtudzaWAUnU4tUvKzKiJeN76', + governance: process.env.GOVERNANCE_ADDRESS || '19qj51eTbSFJYU7ZagudkpxPgNSzPMfdPX', + nameservice: process.env.NAMESERVICE_ADDRESS || '19WxDJ9Kcvx4VqQFkpwVmwVEy1hMuwXtQE', + resources: process.env.RESOURCES_ADDRESS || '1HGN9h47CzoFwU2bQZwe6BYoX4TM6pXc4b' }, contracts: { - kap: '13tmzDmfqCsbYT26C4CmKxq86d33senqH3', - nicknames:'1KD9Es7LBBjA1FY3ViCgQJ7e6WH1ipKbhz' + kap: process.env.KAP_ADDRESS || '13tmzDmfqCsbYT26C4CmKxq86d33senqH3', + nicknames: process.env.NICKNAMES_ADDRESS || '1KD9Es7LBBjA1FY3ViCgQJ7e6WH1ipKbhz' } } diff --git a/utils/providers.ts b/utils/providers.ts index 9d44128..8c7485d 100644 --- a/utils/providers.ts +++ b/utils/providers.ts @@ -1,16 +1,6 @@ import { config } from '@/app.config' import { Provider } from 'koilib' -declare global { - namespace NodeJS { - interface ProcessEnv { - JSONRPC_URL: string; - } - } -} - export function getProvider() { - const xJsonRpc = process.env.JSONRPC_URL || config.jsonRPC - - return new Provider(xJsonRpc) + return new Provider(config.jsonRPC) } From b53697b70c7c54d4b2ff5dfee80c658a6dcc87e3 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Tue, 7 May 2024 15:46:24 -0600 Subject: [PATCH 3/4] Read the system contract addresses from the name service system call --- app.config.ts | 17 ----------- utils/addresses.ts | 75 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 70 insertions(+), 22 deletions(-) diff --git a/app.config.ts b/app.config.ts index a27ffc2..7bf6afe 100644 --- a/app.config.ts +++ b/app.config.ts @@ -2,13 +2,6 @@ declare global { namespace NodeJS { interface ProcessEnv { JSONRPC_URL: string, - KOIN_ADDRESS: string, - VHP_ADDRESS: string, - POB_ADDRESS: string, - CLAIM_ADDRESS: string, - GOVERNANCE_ADDRESS: string, - NAMESERVICE_ADDRESS: string, - RESOURCES_ADDRESS: string, KAP_ADDRESS: string, NICKNAMES_ADDRESS: string } @@ -17,21 +10,11 @@ declare global { export type Config = { jsonRPC: string - systemContracts: Record contracts: Record } export const config: Config = { jsonRPC: process.env.JSONRPC_URL || 'http://localhost:8080/', - systemContracts: { - koin: process.env.KOIN_ADDRESS || '15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL', - vhp: process.env.VHP_ADDRESS || '18tWNU7E4yuQzz7hMVpceb9ixmaWLVyQsr', - pob: process.env.POB_ADDRESS || '159myq5YUhhoVWu3wsHKHiJYKPKGUrGiyv', - claim: process.env.CLAIM_ADDRESS || '18zw3ZokdfHtudzaWAUnU4tUvKzKiJeN76', - governance: process.env.GOVERNANCE_ADDRESS || '19qj51eTbSFJYU7ZagudkpxPgNSzPMfdPX', - nameservice: process.env.NAMESERVICE_ADDRESS || '19WxDJ9Kcvx4VqQFkpwVmwVEy1hMuwXtQE', - resources: process.env.RESOURCES_ADDRESS || '1HGN9h47CzoFwU2bQZwe6BYoX4TM6pXc4b' - }, contracts: { kap: process.env.KAP_ADDRESS || '13tmzDmfqCsbYT26C4CmKxq86d33senqH3', nicknames: process.env.NICKNAMES_ADDRESS || '1KD9Es7LBBjA1FY3ViCgQJ7e6WH1ipKbhz' diff --git a/utils/addresses.ts b/utils/addresses.ts index 9767cb8..3cfc3e9 100644 --- a/utils/addresses.ts +++ b/utils/addresses.ts @@ -1,19 +1,31 @@ -import { config } from '@/app.config' import { getKAPName } from '@/services/kap' -import { utils } from 'koilib' +import { Serializer, utils } from 'koilib' import { AppError } from './errors' +import { getProvider } from './providers' import { getNicknameOwner } from '@/services/nicknames' +let contractAddresses: Record = {}; + export async function getAddress(str: string) { + console.log(contractAddresses) + if (contractAddresses[str]) { + return contractAddresses[str]; + } + // system contracts - if (config.systemContracts[str]) { - return config.systemContracts[str] + const contract = await getSystemAddress(str); + + if (contract) { + contractAddresses[str] = contract; + return contract; } + // kap names - else if (str.endsWith('.koin')) { + if (str.endsWith('.koin')) { const kapName = await getKAPName(str) if (kapName) { + contractAddresses[str] = kapName.owner; return kapName.owner } } @@ -22,6 +34,7 @@ export async function getAddress(str: string) { else if (str.startsWith('@')) { const owner = await getNicknameOwner(str) if (owner) { + contractAddresses[str] = owner; return owner } } @@ -48,3 +61,55 @@ export async function getAccountAddress(str: string) { return address } + +export async function getSystemAddress(str: string): Promise { + const provider = getProvider() + + const serializer = new Serializer( + { + nested: { + get_address_arguments: { + fields: { + name: { + type: "string", + id: 1, + }, + }, + }, + get_address_result: { + fields: { + value: { + type: "address_record", + id: 1, + }, + }, + }, + address_record: { + fields: { + name: { + type: "bytes", + id: 1, + options: { + "(koinos.btype)": "ADDRESS", + }, + }, + }, + }, + }, + }, + { + argumentsTypeName: "get_address_arguments", + returnTypeName: "get_address_result", + } + ); + + try { + let res = await provider.invokeSystemCall(serializer, 10001, {"name": str}); + + if ((res["value"] as any)["name"]) { + return String((res["value"] as any)["name"]); + } + } catch (error) {} + + return +} \ No newline at end of file From c2bc4475d5e0a528bd4535651445df49cbd92d01 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Tue, 7 May 2024 17:20:46 -0600 Subject: [PATCH 4/4] Fix use of systemContracts config --- utils/addresses.ts | 1 - utils/contracts.ts | 2 -- 2 files changed, 3 deletions(-) diff --git a/utils/addresses.ts b/utils/addresses.ts index 3cfc3e9..f1e0db5 100644 --- a/utils/addresses.ts +++ b/utils/addresses.ts @@ -7,7 +7,6 @@ import { getNicknameOwner } from '@/services/nicknames' let contractAddresses: Record = {}; export async function getAddress(str: string) { - console.log(contractAddresses) if (contractAddresses[str]) { return contractAddresses[str]; } diff --git a/utils/contracts.ts b/utils/contracts.ts index 9a51b30..c4e3d71 100644 --- a/utils/contracts.ts +++ b/utils/contracts.ts @@ -169,8 +169,6 @@ let CONTRACTS_CACHE: Record | undefined function getContractsCache(contractId: string): Contract | undefined { if (!CONTRACTS_CACHE) { CONTRACTS_CACHE = { - [config.systemContracts.koin]: getFTContract(config.systemContracts.koin), - [config.systemContracts.vhp]: getFTContract(config.systemContracts.vhp), [config.contracts.kap]: new Contract({ id: config.contracts.kap, // @ts-ignore abi is compatible