From 96ec2b44e121bbb660e8cb93afd20f5b948768c3 Mon Sep 17 00:00:00 2001 From: Cheng Wang Date: Tue, 1 Oct 2024 12:46:08 +0200 Subject: [PATCH] Update node&explorer version --- docker/docker-compose.yml | 2 +- packages/web3/package.json | 4 +- packages/web3/src/api/api-alephium.ts | 145 +++++++++++++++++++++++++- packages/web3/src/api/api-explorer.ts | 79 ++++++++++++++ 4 files changed, 226 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e67a71b41..9bcb90e04 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -29,7 +29,7 @@ services: condition: service_healthy alephium: - image: alephium/alephium:v3.6.2 + image: alephium/alephium:v3.7.0 restart: unless-stopped ports: - 19973:19973/tcp diff --git a/packages/web3/package.json b/packages/web3/package.json index cc3e6f2fe..36c02afb9 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -33,8 +33,8 @@ }, "author": "Alephium dev ", "config": { - "alephium_version": "3.6.2", - "explorer_backend_version": "2.0.0" + "alephium_version": "3.7.0", + "explorer_backend_version": "2.2.3" }, "scripts": { "build": "rm -rf dist/* && npx tsc --build . && webpack", diff --git a/packages/web3/src/api/api-alephium.ts b/packages/web3/src/api/api-alephium.ts index f1e9a4b2c..d943d1066 100644 --- a/packages/web3/src/api/api-alephium.ts +++ b/packages/web3/src/api/api-alephium.ts @@ -926,6 +926,97 @@ export interface RevealMnemonicResult { mnemonic: string } +/** RichAssetInput */ +export interface RichAssetInput { + /** @format int32 */ + hint: number + /** @format 32-byte-hash */ + key: string + /** @format hex-string */ + unlockScript: string + /** @format uint256 */ + attoAlphAmount: string + /** @format address */ + address: string + tokens: Token[] +} + +/** RichBlockAndEvents */ +export interface RichBlockAndEvents { + block: RichBlockEntry + events: ContractEventByBlockHash[] +} + +/** RichBlockEntry */ +export interface RichBlockEntry { + /** @format block-hash */ + hash: string + /** @format int64 */ + timestamp: number + /** @format int32 */ + chainFrom: number + /** @format int32 */ + chainTo: number + /** @format int32 */ + height: number + deps: string[] + transactions: RichTransaction[] + /** @format hex-string */ + nonce: string + version: number + /** @format 32-byte-hash */ + depStateHash: string + /** @format 32-byte-hash */ + txsHash: string + /** @format hex-string */ + target: string + ghostUncles: GhostUncleBlockEntry[] +} + +/** RichBlocksAndEventsPerTimeStampRange */ +export interface RichBlocksAndEventsPerTimeStampRange { + blocksAndEvents: RichBlockAndEvents[][] +} + +/** RichContractInput */ +export interface RichContractInput { + /** @format int32 */ + hint: number + /** @format 32-byte-hash */ + key: string + /** @format uint256 */ + attoAlphAmount: string + /** @format address */ + address: string + tokens: Token[] +} + +/** RichTransaction */ +export interface RichTransaction { + unsigned: RichUnsignedTx + scriptExecutionOk: boolean + contractInputs: RichContractInput[] + generatedOutputs: Output[] + inputSignatures: string[] + scriptSignatures: string[] +} + +/** RichUnsignedTx */ +export interface RichUnsignedTx { + /** @format 32-byte-hash */ + txId: string + version: number + networkId: number + /** @format script */ + scriptOpt?: string + /** @format int32 */ + gasAmount: number + /** @format uint256 */ + gasPrice: string + inputs: RichAssetInput[] + fixedOutputs: FixedAssetOutput[] +} + /** Script */ export interface Script { code: string @@ -1512,7 +1603,7 @@ export class HttpClient { /** * @title Alephium API - * @version 3.6.2 + * @version 3.7.0 * @baseUrl ../ */ export class Api extends HttpClient { @@ -2169,6 +2260,40 @@ export class Api extends HttpClient + this.request< + RichBlocksAndEventsPerTimeStampRange, + BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable + >({ + path: `/blockflow/rich-blocks`, + method: 'GET', + query: query, + format: 'json', + ...params + }).then(convertHttpResponse), + /** * No description * @@ -2217,6 +2342,24 @@ export class Api extends HttpClient + this.request( + { + path: `/blockflow/rich-blocks/${blockHash}`, + method: 'GET', + format: 'json', + ...params + } + ).then(convertHttpResponse), + /** * No description * diff --git a/packages/web3/src/api/api-explorer.ts b/packages/web3/src/api/api-explorer.ts index 9401557d3..89b36c1b8 100644 --- a/packages/web3/src/api/api-explorer.ts +++ b/packages/web3/src/api/api-explorer.ts @@ -190,6 +190,7 @@ export interface AssetOutput { /** NFT */ export interface NFT { + id: string type: string } @@ -217,6 +218,14 @@ export interface AcceptedTransaction { timestamp: number } +/** HolderInfo */ +export interface HolderInfo { + /** @format address */ + address: string + /** @format uint256 */ + balance: string +} + /** TokenSupply */ export interface TokenSupply { /** @format uint256 */ @@ -317,6 +326,8 @@ export enum TokenStdInterfaceId { export interface ExplorerInfo { releaseVersion: string commit: string + /** @format int64 */ + lastHoldersUpdate: number /** @format int32 */ migrationsVersion: number /** @format int64 */ @@ -367,6 +378,7 @@ export interface Transaction { /** FungibleToken */ export interface FungibleToken { + id: string type: string } @@ -1588,6 +1600,40 @@ export class Api extends HttpClient + this.request({ + path: `/tokens/holders/token/${tokenId}`, + method: 'GET', + query: query, + format: 'json', + ...params + }).then(convertHttpResponse), + /** * @description List token transactions * @@ -1676,6 +1722,39 @@ export class Api extends HttpClient + this.request({ + path: `/tokens/holders/alph`, + method: 'GET', + query: query, + format: 'json', + ...params + }).then(convertHttpResponse), + /** * @description Return metadata for the given nft tokens, if metadata doesn't exist or token isn't a nft, it won't be in the output list *