From f2db7f1ffb2107b792f3d94c30b1c2d96d26b66b Mon Sep 17 00:00:00 2001 From: alnoki <43892045+alnoki@users.noreply.github.com> Date: Tue, 4 Feb 2025 18:09:50 -0800 Subject: [PATCH] [ECO-2776] Revive all stacks to v5 binaries (#560) --- .../deploy-indexer-fallback.yaml | 30 +++++++++---------- src/cloud-formation/deploy-indexer-main.yaml | 30 +++++++++---------- .../deploy-indexer-production.yaml | 30 +++++++++---------- .../sdk/src/indexer-v2/types/index.ts | 28 +++++++++-------- .../sdk/src/indexer-v2/types/json-types.ts | 4 +++ .../types/postgres-numeric-types.ts | 6 ++-- src/typescript/sdk/src/types/types.ts | 27 ++++++++++------- 7 files changed, 85 insertions(+), 70 deletions(-) diff --git a/src/cloud-formation/deploy-indexer-fallback.yaml b/src/cloud-formation/deploy-indexer-fallback.yaml index 59b97a41c..572a4745b 100644 --- a/src/cloud-formation/deploy-indexer-fallback.yaml +++ b/src/cloud-formation/deploy-indexer-fallback.yaml @@ -1,29 +1,29 @@ --- parameters: BrokerCpu: 1024 - BrokerImageVersion: '4.0.2' + BrokerImageVersion: '5.0.0' BrokerMemory: 2048 DbMaxCapacity: 8 - DeployAlb: 'false' - DeployAlbDnsRecord: 'false' - DeployBastionHost: 'false' - DeployBroker: 'false' - DeployContainers: 'false' - DeployDb: 'false' - DeployNlb: 'false' - DeployNlbVpcLink: 'false' - DeployPostgrest: 'false' - DeployProcessor: 'false' - DeployRestApi: 'false' - DeployRestApiDnsRecord: 'false' - DeployStack: 'false' + DeployAlb: 'true' + DeployAlbDnsRecord: 'true' + DeployBastionHost: 'true' + DeployBroker: 'true' + DeployContainers: 'true' + DeployDb: 'true' + DeployNlb: 'true' + DeployNlbVpcLink: 'true' + DeployPostgrest: 'true' + DeployProcessor: 'true' + DeployRestApi: 'true' + DeployRestApiDnsRecord: 'true' + DeployStack: 'true' DeployWaf: 'false' EnableWafRulesGeneral: 'false' EnableWafRulesRestApi: 'false' EnableWafRulesWebSocket: 'false' Environment: 'fallback' Network: 'mainnet' - ProcessorImageVersion: '4.0.2' + ProcessorImageVersion: '5.0.0' VpcStackName: 'emoji-vpc' tags: null template-file-path: 'src/cloud-formation/indexer.cfn.yaml' diff --git a/src/cloud-formation/deploy-indexer-main.yaml b/src/cloud-formation/deploy-indexer-main.yaml index 8c8e7f4b5..1c39f41be 100644 --- a/src/cloud-formation/deploy-indexer-main.yaml +++ b/src/cloud-formation/deploy-indexer-main.yaml @@ -1,19 +1,19 @@ --- parameters: - BrokerImageVersion: '4.0.2' - DeployAlb: 'false' - DeployAlbDnsRecord: 'false' - DeployBastionHost: 'false' - DeployBroker: 'false' - DeployContainers: 'false' - DeployDb: 'false' - DeployNlb: 'false' - DeployNlbVpcLink: 'false' - DeployPostgrest: 'false' - DeployProcessor: 'false' - DeployRestApi: 'false' - DeployRestApiDnsRecord: 'false' - DeployStack: 'false' + BrokerImageVersion: '5.0.0' + DeployAlb: 'true' + DeployAlbDnsRecord: 'true' + DeployBastionHost: 'true' + DeployBroker: 'true' + DeployContainers: 'true' + DeployDb: 'true' + DeployNlb: 'true' + DeployNlbVpcLink: 'true' + DeployPostgrest: 'true' + DeployProcessor: 'true' + DeployRestApi: 'true' + DeployRestApiDnsRecord: 'true' + DeployStack: 'true' DeployWaf: 'false' EnableWafRulesGeneral: 'false' EnableWafRulesRestApi: 'false' @@ -21,7 +21,7 @@ parameters: Environment: 'main' Network: 'testnet' ProcessorHealthCheckStartPeriod: 300 - ProcessorImageVersion: '4.0.2' + ProcessorImageVersion: '5.0.0' VpcStackName: 'emoji-vpc' tags: null template-file-path: 'src/cloud-formation/indexer.cfn.yaml' diff --git a/src/cloud-formation/deploy-indexer-production.yaml b/src/cloud-formation/deploy-indexer-production.yaml index 1437eccc1..5fc844b75 100644 --- a/src/cloud-formation/deploy-indexer-production.yaml +++ b/src/cloud-formation/deploy-indexer-production.yaml @@ -1,29 +1,29 @@ --- parameters: BrokerCpu: 1024 - BrokerImageVersion: '4.0.2' + BrokerImageVersion: '5.0.0' BrokerMemory: 2048 DbMaxCapacity: 8 - DeployAlb: 'false' - DeployAlbDnsRecord: 'false' - DeployBastionHost: 'false' - DeployBroker: 'false' - DeployContainers: 'false' - DeployDb: 'false' - DeployNlb: 'false' - DeployNlbVpcLink: 'false' - DeployPostgrest: 'false' - DeployProcessor: 'false' - DeployRestApi: 'false' - DeployRestApiDnsRecord: 'false' - DeployStack: 'false' + DeployAlb: 'true' + DeployAlbDnsRecord: 'true' + DeployBastionHost: 'true' + DeployBroker: 'true' + DeployContainers: 'true' + DeployDb: 'true' + DeployNlb: 'true' + DeployNlbVpcLink: 'true' + DeployPostgrest: 'true' + DeployProcessor: 'true' + DeployRestApi: 'true' + DeployRestApiDnsRecord: 'true' + DeployStack: 'true' DeployWaf: 'false' EnableWafRulesGeneral: 'false' EnableWafRulesRestApi: 'false' EnableWafRulesWebSocket: 'false' Environment: 'production' Network: 'mainnet' - ProcessorImageVersion: '4.0.2' + ProcessorImageVersion: '5.0.0' VpcStackName: 'emoji-vpc' tags: null template-file-path: 'src/cloud-formation/indexer.cfn.yaml' diff --git a/src/typescript/sdk/src/indexer-v2/types/index.ts b/src/typescript/sdk/src/indexer-v2/types/index.ts index 1bfb36147..b3297e4d6 100644 --- a/src/typescript/sdk/src/indexer-v2/types/index.ts +++ b/src/typescript/sdk/src/indexer-v2/types/index.ts @@ -109,8 +109,8 @@ const toLastSwapFromDatabase = (data: DatabaseStructType["LastSwapData"]): Types const toArenaMeleeFromDatabase = (data: DatabaseStructType["ArenaMelee"]): Types["ArenaMelee"] => ({ meleeId: BigInt(data.melee_id), - emojicoin0MarketAddress: data.emojicoin_0_market_address, - emojicoin1MarketAddress: data.emojicoin_1_market_address, + emojicoin0MarketAddress: toAccountAddressString(data.emojicoin_0_market_address), + emojicoin1MarketAddress: toAccountAddressString(data.emojicoin_1_market_address), startTime: postgresTimestampToMicroseconds(data.start_time), duration: BigInt(data.duration), maxMatchPercentage: BigInt(data.max_match_percentage), @@ -120,7 +120,7 @@ const toArenaMeleeFromDatabase = (data: DatabaseStructType["ArenaMelee"]): Types const toArenaEnterFromDatabase = (data: DatabaseStructType["ArenaEnter"]): Types["ArenaEnter"] => ({ meleeId: BigInt(data.melee_id), - user: data.user, + user: toAccountAddressString(data.user), inputAmount: BigInt(data.input_amount), quoteVolume: BigInt(data.quote_volume), integratorFee: BigInt(data.integrator_fee), @@ -135,7 +135,7 @@ const toArenaEnterFromDatabase = (data: DatabaseStructType["ArenaEnter"]): Types const toArenaExitFromDatabase = (data: DatabaseStructType["ArenaExit"]): Types["ArenaExit"] => ({ meleeId: BigInt(data.melee_id), - user: data.user, + user: toAccountAddressString(data.user), tapOutFee: BigInt(data.tap_out_fee), emojicoin0Proceeds: BigInt(data.emojicoin_0_proceeds), emojicoin1Proceeds: BigInt(data.emojicoin_1_proceeds), @@ -147,7 +147,7 @@ const toArenaExitFromDatabase = (data: DatabaseStructType["ArenaExit"]): Types[" const toArenaSwapFromDatabase = (data: DatabaseStructType["ArenaSwap"]): Types["ArenaSwap"] => ({ meleeId: BigInt(data.melee_id), - user: data.user, + user: toAccountAddressString(data.user), quoteVolume: BigInt(data.quote_volume), integratorFee: BigInt(data.integrator_fee), emojicoin0Proceeds: BigInt(data.emojicoin_0_proceeds), @@ -167,7 +167,7 @@ const toArenaVaultBalanceUpdateFromDatabase = ( const toArenaPositionsFromDatabase = ( data: DatabaseStructType["ArenaPositions"] ): Types["ArenaPositions"] => ({ - user: data.user, + user: toAccountAddressString(data.user), meleeId: BigInt(data.melee_id), open: data.open, emojicoin0Balance: BigInt(data.emojicoin_0_balance), @@ -179,14 +179,14 @@ const toArenaPositionsFromDatabase = ( const toArenaLeaderboardFromDatabase = ( data: DatabaseStructType["ArenaLeaderboard"] ): Types["ArenaLeaderboard"] => ({ - user: data.user, + user: toAccountAddressString(data.user), open: data.open, emojicoin0Balance: BigInt(data.emojicoin_0_balance), emojicoin1Balance: BigInt(data.emojicoin_1_balance), profits: BigInt(data.profits), losses: BigInt(data.losses), - pnl_percent: data.pnl_percent, - pnl_octas: data.pnl_octas, + pnlPercent: data.pnl_percent, + pnlOctas: data.pnl_octas, }); const toArenaInfoFromDatabase = (data: DatabaseStructType["ArenaInfo"]): Types["ArenaInfo"] => ({ @@ -194,8 +194,12 @@ const toArenaInfoFromDatabase = (data: DatabaseStructType["ArenaInfo"]): Types[" volume: BigInt(data.volume), rewardsRemaining: BigInt(data.rewards_remaining), aptLocked: BigInt(data.apt_locked), - emojicoin0MarketAddress: data.emojicoin_0_market_address, - emojicoin1MarketAddress: data.emojicoin_1_market_address, + emojicoin0MarketAddress: toAccountAddressString(data.emojicoin_0_market_address), + emojicoin0Symbols: data.emojicoin_0_symbols, + emojicoin0MarketID: BigInt(data.emojicoin_0_market_id), + emojicoin1MarketAddress: toAccountAddressString(data.emojicoin_1_market_address), + emojicoin1Symbols: data.emojicoin_1_symbols, + emojicoin1MarketID: BigInt(data.emojicoin_1_market_id), startTime: postgresTimestampToMicroseconds(data.start_time), duration: BigInt(data.duration), maxMatchPercentage: BigInt(data.max_match_percentage), @@ -374,7 +378,7 @@ type ChatEventData = { }; const toChatEventData = (data: DatabaseStructType["ChatEventData"]): ChatEventData => ({ - user: data.user, + user: toAccountAddressString(data.user), message: data.message, userEmojicoinBalance: BigInt(data.user_emojicoin_balance), circulatingSupply: BigInt(data.circulating_supply), diff --git a/src/typescript/sdk/src/indexer-v2/types/json-types.ts b/src/typescript/sdk/src/indexer-v2/types/json-types.ts index e5e1ad913..974f99ccb 100644 --- a/src/typescript/sdk/src/indexer-v2/types/json-types.ts +++ b/src/typescript/sdk/src/indexer-v2/types/json-types.ts @@ -326,7 +326,11 @@ type ArenaInfoData = { rewards_remaining: Uint64String; apt_locked: Uint64String; emojicoin_0_market_address: string; + emojicoin_0_symbols: SymbolEmoji[]; + emojicoin_0_market_id: Uint64String; emojicoin_1_market_address: string; + emojicoin_1_symbols: SymbolEmoji[]; + emojicoin_1_market_id: Uint64String; start_time: PostgresTimestamp; duration: Uint64String; max_match_percentage: Uint64String; diff --git a/src/typescript/sdk/src/indexer-v2/types/postgres-numeric-types.ts b/src/typescript/sdk/src/indexer-v2/types/postgres-numeric-types.ts index ba669c109..1197551b1 100644 --- a/src/typescript/sdk/src/indexer-v2/types/postgres-numeric-types.ts +++ b/src/typescript/sdk/src/indexer-v2/types/postgres-numeric-types.ts @@ -102,11 +102,13 @@ export const floatColumns: Set = new Set([ "available_rewards", "match_amount", "emojicoin_0_proceeds", - "emojicoin_1_proceeds", "emojicoin_0_exchange_rate_base", - "emojicoin_1_exchange_rate_base", "emojicoin_0_exchange_rate_quote", + "emojicoin_0_market_id", + "emojicoin_1_proceeds", + "emojicoin_1_exchange_rate_base", "emojicoin_1_exchange_rate_quote", + "emojicoin_1_market_id", "tap_out_fee", "new_balance", "emojicoin_0_balance", diff --git a/src/typescript/sdk/src/types/types.ts b/src/typescript/sdk/src/types/types.ts index 9b9729f91..b3b8364bc 100644 --- a/src/typescript/sdk/src/types/types.ts +++ b/src/typescript/sdk/src/types/types.ts @@ -17,6 +17,7 @@ import { } from "./json-types"; import { type STRUCT_STRINGS } from "../utils"; import { type Flatten } from "."; +import { type SymbolEmoji } from "../emoji_data"; export type AnyNumberString = number | string | bigint; const strToBigInt = (data: string): bigint => BigInt(data); @@ -367,8 +368,8 @@ export type Types = { ArenaMelee: { meleeId: bigint; - emojicoin0MarketAddress: string; - emojicoin1MarketAddress: string; + emojicoin0MarketAddress: AccountAddressString; + emojicoin1MarketAddress: AccountAddressString; startTime: bigint; duration: bigint; maxMatchPercentage: bigint; @@ -377,7 +378,7 @@ export type Types = { }; ArenaEnter: { - user: string; + user: AccountAddressString; meleeId: bigint; inputAmount: bigint; quoteVolume: bigint; @@ -392,7 +393,7 @@ export type Types = { }; ArenaExit: { - user: string; + user: AccountAddressString; meleeId: bigint; tapOutFee: bigint; emojicoin0Proceeds: bigint; @@ -404,7 +405,7 @@ export type Types = { }; ArenaSwap: { - user: string; + user: AccountAddressString; meleeId: bigint; quoteVolume: bigint; integratorFee: bigint; @@ -421,7 +422,7 @@ export type Types = { }; ArenaPositions: { - user: string; + user: AccountAddressString; meleeId: bigint; open: boolean; emojicoin0Balance: bigint; @@ -438,14 +439,14 @@ export type Types = { }; ArenaLeaderboard: { - user: string; + user: AccountAddressString; open: boolean; emojicoin0Balance: bigint; emojicoin1Balance: bigint; profits: bigint; losses: bigint; - pnl_percent: number; - pnl_octas: number; + pnlPercent: number; + pnlOctas: number; }; ArenaInfo: { @@ -453,8 +454,12 @@ export type Types = { volume: bigint; rewardsRemaining: bigint; aptLocked: bigint; - emojicoin0MarketAddress: string; - emojicoin1MarketAddress: string; + emojicoin0MarketAddress: AccountAddressString; + emojicoin0Symbols: SymbolEmoji[]; + emojicoin0MarketID: bigint; + emojicoin1MarketAddress: AccountAddressString; + emojicoin1Symbols: SymbolEmoji[]; + emojicoin1MarketID: bigint; startTime: bigint; duration: bigint; maxMatchPercentage: bigint;