From e26ecce77d0f7a4d9f84a3b12547137f33c89d82 Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Wed, 24 Apr 2024 13:59:23 +0100 Subject: [PATCH 1/8] yarn.lock missing change --- yarn.lock | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index f563b8e18..b541d6717 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3207,7 +3207,7 @@ __metadata: languageName: node linkType: hard -"@scure/base@npm:^1.1.1": +"@scure/base@npm:^1.1.1, @scure/base@npm:~1.1.4": version: 1.1.6 resolution: "@scure/base@npm:1.1.6" checksum: d6deaae91deba99e87939af9e55d80edba302674983f32bba57f942e22b1726a83c62dc50d8f4370a5d5d35a212dda167fb169f4b0d0c297488d8604608fc3d3 @@ -3228,13 +3228,6 @@ __metadata: languageName: node linkType: hard -"@scure/base@npm:~1.1.4": - version: 1.1.6 - resolution: "@scure/base@npm:1.1.6" - checksum: d6deaae91deba99e87939af9e55d80edba302674983f32bba57f942e22b1726a83c62dc50d8f4370a5d5d35a212dda167fb169f4b0d0c297488d8604608fc3d3 - languageName: node - linkType: hard - "@scure/bip32@npm:1.3.1": version: 1.3.1 resolution: "@scure/bip32@npm:1.3.1" From 5dd01206d6dcfe84d6e09edfb5ab3a85fcd78c15 Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Wed, 24 Apr 2024 14:02:15 +0100 Subject: [PATCH 2/8] new sdk --- package.json | 6 ++--- yarn.lock | 70 ++++++++++++++++++++++++++-------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 3c1d21411..62ba0e6e9 100644 --- a/package.json +++ b/package.json @@ -47,12 +47,12 @@ "@web3auth/openlogin-adapter": "^8.0.1", "@yornaath/batshit": "^0.8.0", "@yornaath/batshit-devtools-react": "^0.5.4", - "@zeitgeistpm/augment-api": "3.6.2", + "@zeitgeistpm/augment-api": "3.6.3", "@zeitgeistpm/avatara-nft-sdk": "^1.3.1", "@zeitgeistpm/avatara-react": "^1.3.2", "@zeitgeistpm/avatara-util": "^1.2.0", - "@zeitgeistpm/sdk": "3.6.2", - "@zeitgeistpm/utility": "3.6.2", + "@zeitgeistpm/sdk": "3.6.3", + "@zeitgeistpm/utility": "3.6.3", "axios": "^0.21.4", "boring-avatars": "^1.6.1", "decimal.js": "^10.4.3", diff --git a/yarn.lock b/yarn.lock index b541d6717..af447d7da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4866,14 +4866,14 @@ __metadata: languageName: node linkType: hard -"@zeitgeistpm/augment-api@npm:3.6.2, @zeitgeistpm/augment-api@npm:^3.6.2": - version: 3.6.2 - resolution: "@zeitgeistpm/augment-api@npm:3.6.2" +"@zeitgeistpm/augment-api@npm:3.6.3, @zeitgeistpm/augment-api@npm:^3.6.3": + version: 3.6.3 + resolution: "@zeitgeistpm/augment-api@npm:3.6.3" peerDependencies: "@polkadot/api-base": "*" "@polkadot/rpc-core": "*" "@polkadot/types": "*" - checksum: c5f7c6a1dd2d27afdee9ad178e83863b3d114786919b63a3f2c4fcd0f0e2e47a9bf4f4839d616efdec141ff0c31c8602756207e20b333b6ebd3365cec78b9d3b + checksum: 9edcaa535a7938ecd0b20c0db2d333e7da1e324cc01fed84fcce32b9b0f812dbf69ee07b0234817d21442342a6f6d4937dd87bffab23f5391ffbaed51acb6bfd languageName: node linkType: hard @@ -4943,40 +4943,40 @@ __metadata: languageName: node linkType: hard -"@zeitgeistpm/indexer@npm:^4.6.2": - version: 4.6.2 - resolution: "@zeitgeistpm/indexer@npm:4.6.2" +"@zeitgeistpm/indexer@npm:^4.6.3": + version: 4.6.3 + resolution: "@zeitgeistpm/indexer@npm:4.6.3" dependencies: graphql: ^16.6.0 graphql-request: ^5.0.0 graphql-tag: ^2.12.6 - checksum: 0bf8348922fe75b366ebb41557165ac69e0a6ee89d943e7cf11a0f2153b36656552effc01d002eec8e1525052af381c36db7bb2514802b6fcac2bf0cc993928a + checksum: 2ad1220bca1a974e64b9447d94353bc2450c6601120e15db730c0e274c3c61e4b1c956fc464ad7db38d20f72042261643ce1e4d2a4bbbdc696ef80411b6e399e languageName: node linkType: hard -"@zeitgeistpm/rpc@npm:^3.6.2": - version: 3.6.2 - resolution: "@zeitgeistpm/rpc@npm:3.6.2" +"@zeitgeistpm/rpc@npm:^3.6.3": + version: 3.6.3 + resolution: "@zeitgeistpm/rpc@npm:3.6.3" dependencies: - "@zeitgeistpm/augment-api": ^3.6.2 - "@zeitgeistpm/utility": ^3.6.2 + "@zeitgeistpm/augment-api": ^3.6.3 + "@zeitgeistpm/utility": ^3.6.3 peerDependencies: "@polkadot/api": "*" "@polkadot/keyring": "*" "@polkadot/types": "*" - checksum: bfb9513a44329426d6b607fb62dcb8186a1d2f35cf52316bf85bd2a3c542b03c1b386957253bac6e770d4b58cca0e60d8c88d2bb697084ffd060b73f1af67649 + checksum: faf55a79b4d12a5cf3346dd957b6e03fbed2e3749804a2b259ce4bab4d7d1c690f6d06f8cf8572eb045ca9ee3fcfc4585965f73cfdd2af91958adaf25cc033a6 languageName: node linkType: hard -"@zeitgeistpm/sdk@npm:3.6.2": - version: 3.6.2 - resolution: "@zeitgeistpm/sdk@npm:3.6.2" +"@zeitgeistpm/sdk@npm:3.6.3": + version: 3.6.3 + resolution: "@zeitgeistpm/sdk@npm:3.6.3" dependencies: - "@zeitgeistpm/augment-api": ^3.6.2 - "@zeitgeistpm/indexer": ^4.6.2 - "@zeitgeistpm/rpc": ^3.6.2 - "@zeitgeistpm/utility": ^3.6.2 - "@zeitgeistpm/web3.storage": ^3.6.2 + "@zeitgeistpm/augment-api": ^3.6.3 + "@zeitgeistpm/indexer": ^4.6.3 + "@zeitgeistpm/rpc": ^3.6.3 + "@zeitgeistpm/utility": ^3.6.3 + "@zeitgeistpm/web3.storage": ^3.6.3 cids: ^1.1.9 decimal.js: ^10.4.3 human-object-diff: ^3.0.0 @@ -4990,7 +4990,7 @@ __metadata: "@polkadot/api": "*" "@polkadot/types": "*" "@polkadot/util": "*" - checksum: 8ccb96b2008fd25923741b046419ec346d6a5fb731d2b38f820171006c6d1bb56482af33d1d322bca2d59bdd527d15b0dd08b237c976bd06d0a457258ca62dfc + checksum: ff5b4dd9ded32e036269e300152297b0b0a418f731d57dbd70ab1b00839e7635d5e61f7228b0e4c7a7d46f419b8475087416d3354fe53b932254f810adc66c31 languageName: node linkType: hard @@ -5054,12 +5054,12 @@ __metadata: "@web3auth/openlogin-adapter": ^8.0.1 "@yornaath/batshit": ^0.8.0 "@yornaath/batshit-devtools-react": ^0.5.4 - "@zeitgeistpm/augment-api": 3.6.2 + "@zeitgeistpm/augment-api": 3.6.3 "@zeitgeistpm/avatara-nft-sdk": ^1.3.1 "@zeitgeistpm/avatara-react": ^1.3.2 "@zeitgeistpm/avatara-util": ^1.2.0 - "@zeitgeistpm/sdk": 3.6.2 - "@zeitgeistpm/utility": 3.6.2 + "@zeitgeistpm/sdk": 3.6.3 + "@zeitgeistpm/utility": 3.6.3 autoprefixer: 10.2.5 axios: ^0.21.4 boring-avatars: ^1.6.1 @@ -5134,9 +5134,9 @@ __metadata: languageName: unknown linkType: soft -"@zeitgeistpm/utility@npm:3.6.2, @zeitgeistpm/utility@npm:^3.6.2": - version: 3.6.2 - resolution: "@zeitgeistpm/utility@npm:3.6.2" +"@zeitgeistpm/utility@npm:3.6.3, @zeitgeistpm/utility@npm:^3.6.3": + version: 3.6.3 + resolution: "@zeitgeistpm/utility@npm:3.6.3" dependencies: decimal.js: ^10.4.3 lodash.omit: ^4.5.0 @@ -5146,16 +5146,16 @@ __metadata: "@polkadot/api": "*" "@polkadot/types": "*" "@polkadot/util": "*" - checksum: 589bf9bf38672a2bc38676990160bc660a7ef4f8a238927257f826a1c7016f44be176b2be746405ac3e9140a46054df2043ed4edaf4cc4aadd4dd7792b7c1fdd + checksum: 7d47e764db863c4dc5dcabdbf769faa09a7da7af96254797c9685bfb2b031845e7b13cd444b892afad0ebf080a993aa7ba58a5b395b7da670bc42d3a14b2fd43 languageName: node linkType: hard -"@zeitgeistpm/web3.storage@npm:^3.6.2": - version: 3.6.2 - resolution: "@zeitgeistpm/web3.storage@npm:3.6.2" +"@zeitgeistpm/web3.storage@npm:^3.6.3": + version: 3.6.3 + resolution: "@zeitgeistpm/web3.storage@npm:3.6.3" dependencies: "@multiformats/sha3": ^3.0.2 - "@zeitgeistpm/utility": ^3.6.2 + "@zeitgeistpm/utility": ^3.6.3 cids: ^1.1.9 ipfs-http-client: ^60.0.0 ipfs-only-hash: ^4.0.0 @@ -5164,7 +5164,7 @@ __metadata: up: ^1.0.2 peerDependencies: "@polkadot/util": "*" - checksum: 2a9ff3d1276d5a650b1e20ab904ab24b4b806c685b3c2e6e2ebc5e6d1b16c31d80ee15af1fb89e2932391462369ce4ebe125f9dd497e3d95e9d33b21dba041c8 + checksum: a99d38c71ef813c8b12ab7aa6099985bf1967b6f27e3bb50b8d10b1dd52d2232aff3af4669c37e8fae649d573b6a5428d254a5c0b3d871756198ff212a2a12dc languageName: node linkType: hard From fa3286d05e3739d9fdeabfc37eb28e07c5c7c69a Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Tue, 30 Apr 2024 13:40:37 +0100 Subject: [PATCH 3/8] new sdk --- package.json | 4 ++-- yarn.lock | 44 ++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 62ba0e6e9..ac9ae2f96 100644 --- a/package.json +++ b/package.json @@ -47,11 +47,11 @@ "@web3auth/openlogin-adapter": "^8.0.1", "@yornaath/batshit": "^0.8.0", "@yornaath/batshit-devtools-react": "^0.5.4", - "@zeitgeistpm/augment-api": "3.6.3", + "@zeitgeistpm/augment-api": "3.6.4", "@zeitgeistpm/avatara-nft-sdk": "^1.3.1", "@zeitgeistpm/avatara-react": "^1.3.2", "@zeitgeistpm/avatara-util": "^1.2.0", - "@zeitgeistpm/sdk": "3.6.3", + "@zeitgeistpm/sdk": "3.6.4", "@zeitgeistpm/utility": "3.6.3", "axios": "^0.21.4", "boring-avatars": "^1.6.1", diff --git a/yarn.lock b/yarn.lock index af447d7da..1950db365 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4866,14 +4866,14 @@ __metadata: languageName: node linkType: hard -"@zeitgeistpm/augment-api@npm:3.6.3, @zeitgeistpm/augment-api@npm:^3.6.3": - version: 3.6.3 - resolution: "@zeitgeistpm/augment-api@npm:3.6.3" +"@zeitgeistpm/augment-api@npm:3.6.4, @zeitgeistpm/augment-api@npm:^3.6.4": + version: 3.6.4 + resolution: "@zeitgeistpm/augment-api@npm:3.6.4" peerDependencies: "@polkadot/api-base": "*" "@polkadot/rpc-core": "*" "@polkadot/types": "*" - checksum: 9edcaa535a7938ecd0b20c0db2d333e7da1e324cc01fed84fcce32b9b0f812dbf69ee07b0234817d21442342a6f6d4937dd87bffab23f5391ffbaed51acb6bfd + checksum: 18e7dbd7329539db2d0de958dbc4d2be1442010b3ed822ae66b8051cfc68f481da8de776d289de6ba731126f9a8b6858d7a2445a292c9d66000fe90998d61c69 languageName: node linkType: hard @@ -4943,38 +4943,38 @@ __metadata: languageName: node linkType: hard -"@zeitgeistpm/indexer@npm:^4.6.3": - version: 4.6.3 - resolution: "@zeitgeistpm/indexer@npm:4.6.3" +"@zeitgeistpm/indexer@npm:^4.6.4": + version: 4.6.4 + resolution: "@zeitgeistpm/indexer@npm:4.6.4" dependencies: graphql: ^16.6.0 graphql-request: ^5.0.0 graphql-tag: ^2.12.6 - checksum: 2ad1220bca1a974e64b9447d94353bc2450c6601120e15db730c0e274c3c61e4b1c956fc464ad7db38d20f72042261643ce1e4d2a4bbbdc696ef80411b6e399e + checksum: 0a1cab43417a0ee81bcee567a3f3dcf16f6c2df23fc8b741f8a5e6c64815ddcb23e3b7f7cd71d84559372549504d27df541d6dafcc435c9b2a19aaa4835df24b languageName: node linkType: hard -"@zeitgeistpm/rpc@npm:^3.6.3": - version: 3.6.3 - resolution: "@zeitgeistpm/rpc@npm:3.6.3" +"@zeitgeistpm/rpc@npm:^3.6.4": + version: 3.6.4 + resolution: "@zeitgeistpm/rpc@npm:3.6.4" dependencies: - "@zeitgeistpm/augment-api": ^3.6.3 + "@zeitgeistpm/augment-api": ^3.6.4 "@zeitgeistpm/utility": ^3.6.3 peerDependencies: "@polkadot/api": "*" "@polkadot/keyring": "*" "@polkadot/types": "*" - checksum: faf55a79b4d12a5cf3346dd957b6e03fbed2e3749804a2b259ce4bab4d7d1c690f6d06f8cf8572eb045ca9ee3fcfc4585965f73cfdd2af91958adaf25cc033a6 + checksum: 0b48aba764ae7f5cd9203b71ffd801e5fa1d57d1fc0f10e316d037b6fab3004c945fc4a50f101b4b36b697cc72378e6a765dec809e10dc5d79a6698177e5fca1 languageName: node linkType: hard -"@zeitgeistpm/sdk@npm:3.6.3": - version: 3.6.3 - resolution: "@zeitgeistpm/sdk@npm:3.6.3" +"@zeitgeistpm/sdk@npm:3.6.4": + version: 3.6.4 + resolution: "@zeitgeistpm/sdk@npm:3.6.4" dependencies: - "@zeitgeistpm/augment-api": ^3.6.3 - "@zeitgeistpm/indexer": ^4.6.3 - "@zeitgeistpm/rpc": ^3.6.3 + "@zeitgeistpm/augment-api": ^3.6.4 + "@zeitgeistpm/indexer": ^4.6.4 + "@zeitgeistpm/rpc": ^3.6.4 "@zeitgeistpm/utility": ^3.6.3 "@zeitgeistpm/web3.storage": ^3.6.3 cids: ^1.1.9 @@ -4990,7 +4990,7 @@ __metadata: "@polkadot/api": "*" "@polkadot/types": "*" "@polkadot/util": "*" - checksum: ff5b4dd9ded32e036269e300152297b0b0a418f731d57dbd70ab1b00839e7635d5e61f7228b0e4c7a7d46f419b8475087416d3354fe53b932254f810adc66c31 + checksum: a5bb4b6b40da28afcde543e73dcbab208d6ba0bf30c3af771b90b4c52bf2b983fa7b9e75451b593749ab87cc034dc44166baa6935a3a5dbfbe1beb0bd9efeb2d languageName: node linkType: hard @@ -5054,11 +5054,11 @@ __metadata: "@web3auth/openlogin-adapter": ^8.0.1 "@yornaath/batshit": ^0.8.0 "@yornaath/batshit-devtools-react": ^0.5.4 - "@zeitgeistpm/augment-api": 3.6.3 + "@zeitgeistpm/augment-api": 3.6.4 "@zeitgeistpm/avatara-nft-sdk": ^1.3.1 "@zeitgeistpm/avatara-react": ^1.3.2 "@zeitgeistpm/avatara-util": ^1.2.0 - "@zeitgeistpm/sdk": 3.6.3 + "@zeitgeistpm/sdk": 3.6.4 "@zeitgeistpm/utility": 3.6.3 autoprefixer: 10.2.5 axios: ^0.21.4 From ba30571d9fa8e5f6312ef0d1dba4c10b93482390 Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Wed, 1 May 2024 14:58:38 +0100 Subject: [PATCH 4/8] switch to new scoring rule --- .../AssetTradingButtons.tsx | 2 +- .../liquidity/MarketLiquiditySection.tsx | 3 +- lib/gql/trending-markets.ts | 2 +- lib/hooks/queries/useInfiniteMarkets.ts | 2 +- lib/hooks/queries/useMarketSpotPrices.ts | 2 +- lib/hooks/queries/usePortfolioPositions.ts | 4 +- lib/util/calc-resolved-market-prices.ts | 2 +- package.json | 6 +- pages/markets/[marketid].tsx | 3 +- yarn.lock | 70 +++++++++---------- 10 files changed, 49 insertions(+), 47 deletions(-) diff --git a/components/assets/AssetActionButtons/AssetTradingButtons.tsx b/components/assets/AssetActionButtons/AssetTradingButtons.tsx index 1416a818b..bf2ddcece 100644 --- a/components/assets/AssetActionButtons/AssetTradingButtons.tsx +++ b/components/assets/AssetActionButtons/AssetTradingButtons.tsx @@ -53,7 +53,7 @@ const AssetTradingButtons = ({ {tradeItem && ( setIsOpen(false)}> - {market?.scoringRule === ScoringRule.Lmsr ? ( + {market?.scoringRule === ScoringRule.AmmCdaHybrid ? ( { const marketHasPool = (market?.scoringRule === ScoringRule.Cpmm && market.pool != null) || - (market?.scoringRule === ScoringRule.Lmsr && market.neoPool != null); + (market?.scoringRule === ScoringRule.AmmCdaHybrid && + market.neoPool != null); return ( <> diff --git a/lib/gql/trending-markets.ts b/lib/gql/trending-markets.ts index 266f8fbcd..54cde94a0 100644 --- a/lib/gql/trending-markets.ts +++ b/lib/gql/trending-markets.ts @@ -67,7 +67,7 @@ const getTrendingMarkets = async ( order: MarketOrderByInput.IdDesc, where: { status_eq: MarketStatus.Active, - scoringRule_eq: ScoringRule.Lmsr, + scoringRule_eq: ScoringRule.AmmCdaHybrid, ...marketMetaFilter, }, }); diff --git a/lib/hooks/queries/useInfiniteMarkets.ts b/lib/hooks/queries/useInfiniteMarkets.ts index 99654c9ee..ae93bd716 100644 --- a/lib/hooks/queries/useInfiniteMarkets.ts +++ b/lib/hooks/queries/useInfiniteMarkets.ts @@ -106,7 +106,7 @@ export const useInfiniteMarkets = ( : {}), }, { - scoringRule_eq: ScoringRule.Lmsr, + scoringRule_eq: ScoringRule.AmmCdaHybrid, neoPool_isNull: withLiquidityOnly ? false : undefined, }, ], diff --git a/lib/hooks/queries/useMarketSpotPrices.ts b/lib/hooks/queries/useMarketSpotPrices.ts index 02ae0706e..c9220c323 100644 --- a/lib/hooks/queries/useMarketSpotPrices.ts +++ b/lib/hooks/queries/useMarketSpotPrices.ts @@ -58,7 +58,7 @@ export const useMarketSpotPrices = ( if (!enabled) return; const spotPrices: MarketPrices = market?.status !== "Resolved" - ? market.scoringRule === ScoringRule.Lmsr + ? market.scoringRule === ScoringRule.AmmCdaHybrid ? calcMarketPricesAmm2(amm2Pool!) : calcMarketPrices(market, basePoolBalance!, balances!) : calcResolvedMarketPrices(market); diff --git a/lib/hooks/queries/usePortfolioPositions.ts b/lib/hooks/queries/usePortfolioPositions.ts index b6bceb0a6..c3b17f7b6 100644 --- a/lib/hooks/queries/usePortfolioPositions.ts +++ b/lib/hooks/queries/usePortfolioPositions.ts @@ -193,7 +193,7 @@ export const usePortfolioPositions = ( const pools = usePoolsByIds(filter); const markets = useMarketsByIds(filter); const amm2MarketIds = markets.data - ?.filter((market) => market.scoringRule === ScoringRule.Lmsr) + ?.filter((market) => market.scoringRule === ScoringRule.AmmCdaHybrid) .map((m) => m.marketId); const { data: amm2SpotPrices } = useAmm2MarketSpotPrices(amm2MarketIds); @@ -318,7 +318,7 @@ export const usePortfolioPositions = ( price = calcResolvedMarketPrices(market).get(getIndexOf(assetId)); price24HoursAgo = price; } else { - if (market.scoringRule === ScoringRule.Lmsr) { + if (market.scoringRule === ScoringRule.AmmCdaHybrid) { price = lookupAssetPrice(assetId, amm2SpotPrices); price24HoursAgo = lookupAssetPrice( diff --git a/lib/util/calc-resolved-market-prices.ts b/lib/util/calc-resolved-market-prices.ts index c1abcf463..9c8805c03 100644 --- a/lib/util/calc-resolved-market-prices.ts +++ b/lib/util/calc-resolved-market-prices.ts @@ -9,7 +9,7 @@ export const calcResolvedMarketPrices = ( market: FullMarketFragment, ): MarketPrices => { const assetIds = ( - market.scoringRule === ScoringRule.Lmsr + market.scoringRule === ScoringRule.AmmCdaHybrid ? market.neoPool?.account.balances.map((b) => parseAssetIdString(b.assetId), ) diff --git a/package.json b/package.json index ac9ae2f96..0c54c4b32 100644 --- a/package.json +++ b/package.json @@ -47,12 +47,12 @@ "@web3auth/openlogin-adapter": "^8.0.1", "@yornaath/batshit": "^0.8.0", "@yornaath/batshit-devtools-react": "^0.5.4", - "@zeitgeistpm/augment-api": "3.6.4", + "@zeitgeistpm/augment-api": "3.7.0", "@zeitgeistpm/avatara-nft-sdk": "^1.3.1", "@zeitgeistpm/avatara-react": "^1.3.2", "@zeitgeistpm/avatara-util": "^1.2.0", - "@zeitgeistpm/sdk": "3.6.4", - "@zeitgeistpm/utility": "3.6.3", + "@zeitgeistpm/sdk": "3.7.0", + "@zeitgeistpm/utility": "3.7.0", "axios": "^0.21.4", "boring-avatars": "^1.6.1", "decimal.js": "^10.4.3", diff --git a/pages/markets/[marketid].tsx b/pages/markets/[marketid].tsx index a4e90f10d..6697ee11d 100644 --- a/pages/markets/[marketid].tsx +++ b/pages/markets/[marketid].tsx @@ -294,7 +294,8 @@ const Market: NextPage = ({ (market?.scoringRule === ScoringRule.Cpmm && poolId != null && poolIdLoading === false) || - (market?.scoringRule === ScoringRule.Lmsr && market.neoPool != null); + (market?.scoringRule === ScoringRule.AmmCdaHybrid && + market.neoPool != null); const poolCreationDate = new Date( indexedMarket.pool?.createdAt ?? indexedMarket.neoPool?.createdAt ?? "", diff --git a/yarn.lock b/yarn.lock index 1950db365..08a088ec4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4866,14 +4866,14 @@ __metadata: languageName: node linkType: hard -"@zeitgeistpm/augment-api@npm:3.6.4, @zeitgeistpm/augment-api@npm:^3.6.4": - version: 3.6.4 - resolution: "@zeitgeistpm/augment-api@npm:3.6.4" +"@zeitgeistpm/augment-api@npm:3.7.0, @zeitgeistpm/augment-api@npm:^3.7.0": + version: 3.7.0 + resolution: "@zeitgeistpm/augment-api@npm:3.7.0" peerDependencies: "@polkadot/api-base": "*" "@polkadot/rpc-core": "*" "@polkadot/types": "*" - checksum: 18e7dbd7329539db2d0de958dbc4d2be1442010b3ed822ae66b8051cfc68f481da8de776d289de6ba731126f9a8b6858d7a2445a292c9d66000fe90998d61c69 + checksum: ca2658b680406a10c548c159edad4a41fec8f77cad356df243718a3ef779a718c92596243e7161da77931c7563de9f28deaacd13f680143884087279b2ab1f19 languageName: node linkType: hard @@ -4943,40 +4943,40 @@ __metadata: languageName: node linkType: hard -"@zeitgeistpm/indexer@npm:^4.6.4": - version: 4.6.4 - resolution: "@zeitgeistpm/indexer@npm:4.6.4" +"@zeitgeistpm/indexer@npm:^4.7.0": + version: 4.7.0 + resolution: "@zeitgeistpm/indexer@npm:4.7.0" dependencies: graphql: ^16.6.0 graphql-request: ^5.0.0 graphql-tag: ^2.12.6 - checksum: 0a1cab43417a0ee81bcee567a3f3dcf16f6c2df23fc8b741f8a5e6c64815ddcb23e3b7f7cd71d84559372549504d27df541d6dafcc435c9b2a19aaa4835df24b + checksum: 03c44382e856bc07f2e145dc784a16fbd0a4792c58de83ba289485283b1048904468b8ddfc347675f75af6b5e63bee08828fa4b70421fcc804826f6b28d44851 languageName: node linkType: hard -"@zeitgeistpm/rpc@npm:^3.6.4": - version: 3.6.4 - resolution: "@zeitgeistpm/rpc@npm:3.6.4" +"@zeitgeistpm/rpc@npm:^3.7.0": + version: 3.7.0 + resolution: "@zeitgeistpm/rpc@npm:3.7.0" dependencies: - "@zeitgeistpm/augment-api": ^3.6.4 - "@zeitgeistpm/utility": ^3.6.3 + "@zeitgeistpm/augment-api": ^3.7.0 + "@zeitgeistpm/utility": ^3.7.0 peerDependencies: "@polkadot/api": "*" "@polkadot/keyring": "*" "@polkadot/types": "*" - checksum: 0b48aba764ae7f5cd9203b71ffd801e5fa1d57d1fc0f10e316d037b6fab3004c945fc4a50f101b4b36b697cc72378e6a765dec809e10dc5d79a6698177e5fca1 + checksum: 7caf29450310ca8224f1afbd17184836564aa4e62a8dee85d05235d252720f43d0ed99481d5011bda226f870ac0f7db9aa0a2629644876aae63812170d9f1d12 languageName: node linkType: hard -"@zeitgeistpm/sdk@npm:3.6.4": - version: 3.6.4 - resolution: "@zeitgeistpm/sdk@npm:3.6.4" +"@zeitgeistpm/sdk@npm:3.7.0": + version: 3.7.0 + resolution: "@zeitgeistpm/sdk@npm:3.7.0" dependencies: - "@zeitgeistpm/augment-api": ^3.6.4 - "@zeitgeistpm/indexer": ^4.6.4 - "@zeitgeistpm/rpc": ^3.6.4 - "@zeitgeistpm/utility": ^3.6.3 - "@zeitgeistpm/web3.storage": ^3.6.3 + "@zeitgeistpm/augment-api": ^3.7.0 + "@zeitgeistpm/indexer": ^4.7.0 + "@zeitgeistpm/rpc": ^3.7.0 + "@zeitgeistpm/utility": ^3.7.0 + "@zeitgeistpm/web3.storage": ^3.7.0 cids: ^1.1.9 decimal.js: ^10.4.3 human-object-diff: ^3.0.0 @@ -4990,7 +4990,7 @@ __metadata: "@polkadot/api": "*" "@polkadot/types": "*" "@polkadot/util": "*" - checksum: a5bb4b6b40da28afcde543e73dcbab208d6ba0bf30c3af771b90b4c52bf2b983fa7b9e75451b593749ab87cc034dc44166baa6935a3a5dbfbe1beb0bd9efeb2d + checksum: 82f332edf3b4f7c711c88573d9d7013c265945520f0749a469e4101fd28480566da2acfd11ddf4359cde44f5fb061f310cacf298314db83e0fb9003008ffbbd5 languageName: node linkType: hard @@ -5054,12 +5054,12 @@ __metadata: "@web3auth/openlogin-adapter": ^8.0.1 "@yornaath/batshit": ^0.8.0 "@yornaath/batshit-devtools-react": ^0.5.4 - "@zeitgeistpm/augment-api": 3.6.4 + "@zeitgeistpm/augment-api": 3.7.0 "@zeitgeistpm/avatara-nft-sdk": ^1.3.1 "@zeitgeistpm/avatara-react": ^1.3.2 "@zeitgeistpm/avatara-util": ^1.2.0 - "@zeitgeistpm/sdk": 3.6.4 - "@zeitgeistpm/utility": 3.6.3 + "@zeitgeistpm/sdk": 3.7.0 + "@zeitgeistpm/utility": 3.7.0 autoprefixer: 10.2.5 axios: ^0.21.4 boring-avatars: ^1.6.1 @@ -5134,9 +5134,9 @@ __metadata: languageName: unknown linkType: soft -"@zeitgeistpm/utility@npm:3.6.3, @zeitgeistpm/utility@npm:^3.6.3": - version: 3.6.3 - resolution: "@zeitgeistpm/utility@npm:3.6.3" +"@zeitgeistpm/utility@npm:3.7.0, @zeitgeistpm/utility@npm:^3.7.0": + version: 3.7.0 + resolution: "@zeitgeistpm/utility@npm:3.7.0" dependencies: decimal.js: ^10.4.3 lodash.omit: ^4.5.0 @@ -5146,16 +5146,16 @@ __metadata: "@polkadot/api": "*" "@polkadot/types": "*" "@polkadot/util": "*" - checksum: 7d47e764db863c4dc5dcabdbf769faa09a7da7af96254797c9685bfb2b031845e7b13cd444b892afad0ebf080a993aa7ba58a5b395b7da670bc42d3a14b2fd43 + checksum: b2a8cf5a4caa6e8b8bba8f45494278cd2424c6676691e750ee0294a01cd90683ea4c6c0a78d99a3450aa26e0889413771811410fc441a3113b2e226769b3be5d languageName: node linkType: hard -"@zeitgeistpm/web3.storage@npm:^3.6.3": - version: 3.6.3 - resolution: "@zeitgeistpm/web3.storage@npm:3.6.3" +"@zeitgeistpm/web3.storage@npm:^3.7.0": + version: 3.7.0 + resolution: "@zeitgeistpm/web3.storage@npm:3.7.0" dependencies: "@multiformats/sha3": ^3.0.2 - "@zeitgeistpm/utility": ^3.6.3 + "@zeitgeistpm/utility": ^3.7.0 cids: ^1.1.9 ipfs-http-client: ^60.0.0 ipfs-only-hash: ^4.0.0 @@ -5164,7 +5164,7 @@ __metadata: up: ^1.0.2 peerDependencies: "@polkadot/util": "*" - checksum: a99d38c71ef813c8b12ab7aa6099985bf1967b6f27e3bb50b8d10b1dd52d2232aff3af4669c37e8fae649d573b6a5428d254a5c0b3d871756198ff212a2a12dc + checksum: 220f412a6940298d985a0944fbe695e951ca48d36c5955eccc05af4cc2cae2240d60abcae7aaf36822e0cd2c30320085f5fa4a7af41de29d48d8bc6c160ace53 languageName: node linkType: hard From e89f3160291c60cef477b500392036189ba6b928 Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Wed, 1 May 2024 14:59:59 +0100 Subject: [PATCH 5/8] typo --- lib/util/amm2.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util/amm2.ts b/lib/util/amm2.ts index bc0589eda..d948b4664 100644 --- a/lib/util/amm2.ts +++ b/lib/util/amm2.ts @@ -142,7 +142,7 @@ export const isValidBuyAmount = ( assetReserve, amountInMinusFees, liquidityParameter, - ).lessThanOrEqualTo(lsmrConstant) + ).lessThanOrEqualTo(lmsrConstant) ) { return { isValid: false, message: "Amount in too low" }; } else { @@ -187,7 +187,7 @@ export const calculateReserveAfterSell = ( return term1.plus(term2).minus(1).ln().mul(liquidity).plus(assetReserve); }; -const lsmrConstant = 0.1; +const lmsrConstant = 0.1; const calculatePoolNumericalThreshold = (liquidityParameter: Decimal) => liquidityParameter.mul(10); From 23cf17a637526d1372e7f0f62afaeba4fc572302 Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Thu, 2 May 2024 11:48:56 +0100 Subject: [PATCH 6/8] switch to env variable --- .env.example | 3 +++ lib/constants/index.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 9f170dc39..7d08188ad 100644 --- a/.env.example +++ b/.env.example @@ -78,3 +78,6 @@ IPFS_NODE_BASIC_AUTH_PASSWORD=xxxxx NEXT_PUBLIC_SHOW_AIRDROP=true +NEXT_PUBLIC_LAST_MARKET_ID_BEFORE_ASSET_MIGRATION=874 + + diff --git a/lib/constants/index.ts b/lib/constants/index.ts index 1a521cd07..4eae153f5 100644 --- a/lib/constants/index.ts +++ b/lib/constants/index.ts @@ -116,4 +116,4 @@ export const endpointOptions = environment === "production" ? endpointsProduction : endpointsStaging; export const LAST_MARKET_ID_BEFORE_ASSET_MIGRATION = - environment === "production" ? 9999 : 9999; + process.env.NEXT_PUBLIC_LAST_MARKET_ID_BEFORE_ASSET_MIGRATION; From 0ee1e33557ad1cdd29cc9919ef2838eef0767bce Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Thu, 2 May 2024 13:00:02 +0100 Subject: [PATCH 7/8] switch back to indexer balance fetching --- lib/constants/index.ts | 5 ++- lib/hooks/queries/useAccountTokenPositions.ts | 41 ++++++++----------- lib/hooks/queries/useBalance.ts | 2 +- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/lib/constants/index.ts b/lib/constants/index.ts index 4eae153f5..161b3773d 100644 --- a/lib/constants/index.ts +++ b/lib/constants/index.ts @@ -115,5 +115,6 @@ export const endpointsStaging = getEndpointOptions("staging"); export const endpointOptions = environment === "production" ? endpointsProduction : endpointsStaging; -export const LAST_MARKET_ID_BEFORE_ASSET_MIGRATION = - process.env.NEXT_PUBLIC_LAST_MARKET_ID_BEFORE_ASSET_MIGRATION; +export const LAST_MARKET_ID_BEFORE_ASSET_MIGRATION = Number( + process.env.NEXT_PUBLIC_LAST_MARKET_ID_BEFORE_ASSET_MIGRATION, +); diff --git a/lib/hooks/queries/useAccountTokenPositions.ts b/lib/hooks/queries/useAccountTokenPositions.ts index 8f2f62147..c981a360e 100644 --- a/lib/hooks/queries/useAccountTokenPositions.ts +++ b/lib/hooks/queries/useAccountTokenPositions.ts @@ -1,5 +1,6 @@ import { useQuery } from "@tanstack/react-query"; -import { isRpcSdk } from "@zeitgeistpm/sdk"; +import { isIndexedSdk } from "@zeitgeistpm/sdk"; +import { parseAssetIdString } from "lib/util/parse-asset-id"; import { useSdkv2 } from "../useSdkv2"; export const positionsRootKey = "account-token-positions"; @@ -10,36 +11,26 @@ export const useAccountTokenPositions = (address?: string) => { return useQuery( [id, positionsRootKey, address], async () => { - if (sdk && isRpcSdk(sdk) && address) { - // todo: we may wish to add this back and stitch the two data sources together - // to get back the fast initial load along with faster updates issue #1945 - // const { accountBalances } = await sdk.indexer.accountBalances({ - // where: { - // account: { - // accountId_eq: address, - // }, - // balance_gt: 0, - // }, - // }); + if (sdk && isIndexedSdk(sdk) && address) { + const { accountBalances } = await sdk.indexer.accountBalances({ + where: { + account: { + accountId_eq: address, + }, + balance_gt: 0, + }, + }); - const accounts = await sdk.api.query.tokens.accounts.entries(address); - - const accountBalances = accounts - .map((account) => { - const assetId = account[0].args[1]; - const balance = account[1].free.toString(); - - return { assetId, balance }; - }) - .filter((account) => Number(account.balance) > 0); - - return accountBalances; + return accountBalances.map(({ assetId, balance }) => ({ + assetId: parseAssetIdString(assetId)!, + balance, + })); } return null; }, { keepPreviousData: true, - enabled: Boolean(sdk && isRpcSdk(sdk) && address), + enabled: Boolean(sdk && isIndexedSdk(sdk) && address), staleTime: 10_000, }, ); diff --git a/lib/hooks/queries/useBalance.ts b/lib/hooks/queries/useBalance.ts index c7bdc1bc9..a3dd4009c 100644 --- a/lib/hooks/queries/useBalance.ts +++ b/lib/hooks/queries/useBalance.ts @@ -56,7 +56,7 @@ export const fetchAssetBalance = async ( } else if (IOCurrencyAsset.is(assetId)) { if ( IOMarketOutcomeAssetId.is(assetId) && - // new market assets need queried with marketAssets.account + // new market assets need to be queried with marketAssets.account getMarketIdOf(assetId) > LAST_MARKET_ID_BEFORE_ASSET_MIGRATION ) { const balance = await api.query.marketAssets.account(assetId, address); From ebc3d4de788aafe58ccde5d5732544edcf6e4b64 Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Fri, 3 May 2024 11:49:45 +0100 Subject: [PATCH 8/8] bug fix --- lib/hooks/queries/useBalance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hooks/queries/useBalance.ts b/lib/hooks/queries/useBalance.ts index a3dd4009c..7ef4eb370 100644 --- a/lib/hooks/queries/useBalance.ts +++ b/lib/hooks/queries/useBalance.ts @@ -72,7 +72,7 @@ export const fetchAssetBalance = async ( ); return new Decimal(balance.unwrap().balance.toString()); } else { - const balance = await api.query.campaignAssets.account( + const balance = await api.query.customAssets.account( assetId.CustomAsset, address, );