Skip to content

Commit

Permalink
Merge branch '16-update-clients' into 'dev'
Browse files Browse the repository at this point in the history
Resolve "update ergo node clients"

Closes #16 and #12

See merge request ergo/rosen-bridge/network-client!22
  • Loading branch information
vorujack committed Apr 22, 2024
2 parents 3a37b3c + b9f2231 commit 112ba73
Show file tree
Hide file tree
Showing 206 changed files with 1,414 additions and 418 deletions.
165 changes: 165 additions & 0 deletions clients/ergo-explorer/openapi-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,47 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/UnknownErr'
/api/v1/boxes/unspent/unconfirmed/byAddress/{p1}:
get:
operationId: getApiV1BoxesUnspentUnconfirmedByaddressP1
parameters:
- name: p1
in: path
required: true
schema:
type: string
- name: sortDirection
in: query
required: false
schema:
type: string
responses:
'200':
description: ''
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/MOutputInfo'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/NotFound'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequest'
default:
description: Unknown error
content:
application/json:
schema:
$ref: '#/components/schemas/UnknownErr'
/api/v1/boxes/unspent/byAddress/{p1}:
get:
operationId: getApiV1BoxesUnspentByaddressP1
Expand Down Expand Up @@ -1852,6 +1893,40 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/UnknownErr'
/api/v1/ergotree/convert:
post:
operationId: postApiV1ErgotreeConvert
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ErgoTreeConversionRequest'
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ErgoTreeHuman'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/NotFound'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequest'
default:
description: Unknown error
content:
application/json:
schema:
$ref: '#/components/schemas/UnknownErr'
components:
schemas:
AssetInfo:
Expand Down Expand Up @@ -2245,6 +2320,26 @@ components:
type: integer
outputCost:
type: integer
ErgoTreeConversionRequest:
required:
- hashed
type: object
properties:
hashed:
type: string
description: Hashed value of ergo script
ErgoTreeHuman:
required:
- constants
- script
type: object
properties:
constants:
type: string
description: Constants use in ergo script
script:
type: string
description: Human readable ergo script
FullBlockInfo:
required:
- header
Expand Down Expand Up @@ -2339,6 +2434,8 @@ components:
- outputCreatedAt
- outputSettledAt
- ergoTree
- ergoTreeConstants
- ergoTreeScript
- address
- additionalRegisters
type: object
Expand Down Expand Up @@ -2378,6 +2475,10 @@ components:
ergoTree:
type: string
description: Hex-encoded string
ergoTreeConstants:
type: string
ergoTreeScript:
type: string
address:
type: string
description: Decoded address of the corresponding box holder
Expand Down Expand Up @@ -2551,6 +2652,64 @@ components:
- type: array
items:
$ref: '#/components/schemas/TransactionInfo'
MOutputInfo:
required:
- boxId
- transactionId
- value
- index
- creationHeight
- ergoTree
- address
- additionalRegisters
- mainChain
type: object
properties:
boxId:
type: string
description: Id of the box
transactionId:
type: string
description: Id of the transaction that created the box
blockId:
type: string
description: Id of the block a box included in
value:
type: integer
description: Value of the box in nanoERG
format: int64
index:
type: integer
description: Index of the output in a transaction
globalIndex:
type: integer
description: Global index of the output in the blockchain
format: int64
creationHeight:
type: integer
description: Height at which the box was created
settlementHeight:
type: integer
description: Height at which the box got fixed in blockchain
ergoTree:
type: string
description: Serialized ergo tree
address:
type: string
description: An address derived from ergo tree
assets:
type: array
items:
$ref: '#/components/schemas/AssetInstanceInfo'
additionalRegisters:
type: object
additionalProperties:
type: string
spentTransactionId:
type: string
description: Id of the transaction this output was spent by
mainChain:
type: boolean
MinerInfo:
required:
- address
Expand Down Expand Up @@ -2616,6 +2775,8 @@ components:
- creationHeight
- settlementHeight
- ergoTree
- ergoTreeConstants
- ergoTreeScript
- address
- additionalRegisters
- mainChain
Expand Down Expand Up @@ -2650,6 +2811,10 @@ components:
ergoTree:
type: string
description: Serialized ergo tree
ergoTreeConstants:
type: string
ergoTreeScript:
type: string
address:
type: string
description: An address derived from ergo tree
Expand Down
2 changes: 1 addition & 1 deletion clients/ergo-explorer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rosen-clients/ergo-explorer",
"version": "1.0.3",
"version": "1.1.0",
"description": "A client library for Ergo Explorer",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
48 changes: 48 additions & 0 deletions clients/ergo-explorer/src/v1/api/ergoExplorerAPIV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import type {
GetApiV1BoxesUnspentByergotreeP1Params,
GetApiV1BoxesUnspentByergotreetemplatehashP1Params,
GetApiV1BoxesByaddressP1Params,
MOutputInfo,
GetApiV1BoxesUnspentUnconfirmedByaddressP1Params,
GetApiV1BoxesUnspentByaddressP1Params,
GetApiV1BoxesByglobalindexStreamParams,
BoxAssetsQuery,
Expand Down Expand Up @@ -59,6 +61,8 @@ import type {
GetApiV1MempoolTransactionsByaddressP1Params,
NetworkState,
NetworkStats,
ErgoTreeHuman,
ErgoTreeConversionRequest,
} from '../types';

import {
Expand All @@ -68,6 +72,7 @@ import {
bigIntsListOutputInfo,
bigIntsItemsOutputInfo,
bigIntsOutputInfo,
bigIntsMOutputInfo,
bigIntsItemsTokenInfo,
bigIntsTokenInfo,
bigIntsItemsAssetInfo,
Expand All @@ -83,6 +88,7 @@ import {
bigIntsItemsUTransactionInfo,
bigIntsNetworkState,
bigIntsNetworkStats,
bigIntsErgoTreeHuman,
} from '../types';

import { createAxiosInstance, JsonFieldBigintFactory } from '../../axios';
Expand Down Expand Up @@ -278,6 +284,18 @@ export const getErgoExplorerAPIV1 = (url: string) => {
});
};

const getApiV1BoxesUnspentUnconfirmedByaddressP1 = (
p1: string,
params?: GetApiV1BoxesUnspentUnconfirmedByaddressP1Params
) => {
return instance<MOutputInfo[]>({
url: `/api/v1/boxes/unspent/unconfirmed/byAddress/${p1}`,
method: 'get',
params,
transformResponse: JsonFieldBigintFactory(bigIntsMOutputInfo),
});
};

const getApiV1BoxesUnspentByaddressP1 = (
p1: string,
params?: GetApiV1BoxesUnspentByaddressP1Params
Expand Down Expand Up @@ -575,6 +593,18 @@ export const getErgoExplorerAPIV1 = (url: string) => {
});
};

const postApiV1ErgotreeConvert = (
ergoTreeConversionRequest: ErgoTreeConversionRequest
) => {
return instance<ErgoTreeHuman>({
url: `/api/v1/ergotree/convert`,
method: 'post',
headers: { 'Content-Type': 'application/json' },
data: ergoTreeConversionRequest,
transformResponse: JsonFieldBigintFactory(bigIntsErgoTreeHuman),
});
};

return {
getApiV1TransactionsP1,
getApiV1TransactionsByinputsscripttemplatehashP1,
Expand All @@ -592,6 +622,7 @@ export const getErgoExplorerAPIV1 = (url: string) => {
getApiV1BoxesUnspentByergotreeP1,
getApiV1BoxesUnspentByergotreetemplatehashP1,
getApiV1BoxesByaddressP1,
getApiV1BoxesUnspentUnconfirmedByaddressP1,
getApiV1BoxesUnspentByaddressP1,
getApiV1BoxesByglobalindexStream,
postApiV1BoxesUnspentSearchUnion,
Expand All @@ -618,6 +649,7 @@ export const getErgoExplorerAPIV1 = (url: string) => {
getApiV1Info,
getApiV1Networkstate,
getApiV1Networkstats,
postApiV1ErgotreeConvert,
};
};

Expand Down Expand Up @@ -755,6 +787,15 @@ export type GetApiV1BoxesByaddressP1Result = NonNullable<
>
>
>;
export type GetApiV1BoxesUnspentUnconfirmedByaddressP1Result = NonNullable<
Awaited<
ReturnType<
ReturnType<
typeof getErgoExplorerAPIV1
>['getApiV1BoxesUnspentUnconfirmedByaddressP1']
>
>
>;
export type GetApiV1BoxesUnspentByaddressP1Result = NonNullable<
Awaited<
ReturnType<
Expand Down Expand Up @@ -917,3 +958,10 @@ export type GetApiV1NetworkstatsResult = NonNullable<
ReturnType<ReturnType<typeof getErgoExplorerAPIV1>['getApiV1Networkstats']>
>
>;
export type PostApiV1ErgotreeConvertResult = NonNullable<
Awaited<
ReturnType<
ReturnType<typeof getErgoExplorerAPIV1>['postApiV1ErgotreeConvert']
>
>
>;
12 changes: 12 additions & 0 deletions clients/ergo-explorer/src/v1/types/ergoTreeConversionRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Generated by orval v6.15.0 🍺
* Do not edit manually.
* Ergo Explorer API v1
* OpenAPI spec version: 1.0
*/

export interface ErgoTreeConversionRequest {
/** Hashed value of ergo script */
hashed: string;
}
export const bigIntsErgoTreeConversionRequest = [];
14 changes: 14 additions & 0 deletions clients/ergo-explorer/src/v1/types/ergoTreeHuman.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Generated by orval v6.15.0 🍺
* Do not edit manually.
* Ergo Explorer API v1
* OpenAPI spec version: 1.0
*/

export interface ErgoTreeHuman {
/** Constants use in ergo script */
constants: string;
/** Human readable ergo script */
script: string;
}
export const bigIntsErgoTreeHuman = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Generated by orval v6.15.0 🍺
* Do not edit manually.
* Ergo Explorer API v1
* OpenAPI spec version: 1.0
*/

export type GetApiV1BoxesUnspentUnconfirmedByaddressP1Params = {
sortDirection?: string;
};
export const bigIntsGetApiV1BoxesUnspentUnconfirmedByaddressP1Params = [];
Loading

0 comments on commit 112ba73

Please sign in to comment.