@cityofzion/dora-ts
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -0,0 +0,0 @@ { |
export * from './neo'; | ||
export * from './neo_legacy'; |
@@ -0,0 +0,0 @@ "use strict"; |
export * from './rest'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import type { AddressStatsResponse, AssetResponse, AssetsResponse, BalanceResponse, BlockResponse, BlocksResponse, ContractResponse, ContractsResponse, ContractTransfersResponse, GetAddressAbstractsResponse, GetAllNodesResponse, GetClaimableResponse, GetUnclaimedResponse, HeightResponse, InvocationStatsResponse, LogResponse, StorageResponse, TransactionAbstractsResponse, TransactionResponse, TransactionsResponse, TransferHistoryResponse } from '../../interfaces/api/neo_legacy'; |
@@ -0,0 +0,0 @@ "use strict"; |
export * from './rest'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -1,4 +0,5 @@ | ||
import type { AssetResponse, BalanceResponse, BlockResponse, BlocksResponse, ContractResponse, ContractsResponse, GetAddressAbstractsResponse, GetAllNodesResponse, HeightResponse, InvocationStatsResponse, LogResponse, TransactionResponse, TransactionsResponse, TransferHistoryResponse } from '../../interfaces/api/neo'; | ||
import type { AddressTransactionsResponse, AssetResponse, BalanceResponse, BlockResponse, BlocksResponse, ContractResponse, ContractsResponse, GetAddressAbstractsResponse, GetAllNodesResponse, HeightResponse, InvocationStatsResponse, LogResponse, TransactionResponse, TransactionsResponse, TransferHistoryResponse } from '../../interfaces/api/neo'; | ||
export declare class NeoRest { | ||
static axios: import("axios").AxiosInstance; | ||
static addressTransactions(address: string, page?: number, network?: string): Promise<AddressTransactionsResponse>; | ||
static asset(assetHash: string, network?: string): Promise<AssetResponse>; | ||
@@ -5,0 +6,0 @@ static assets(page?: number, network?: string): Promise<any>; |
@@ -44,2 +44,17 @@ "use strict"; | ||
} | ||
NeoRest.addressTransactions = function (address, page, network) { | ||
if (page === void 0) { page = 1; } | ||
if (network === void 0) { network = 'mainnet'; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var method; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
method = 'address_transactions'; | ||
return [4, this.get(network, method, address, page)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
NeoRest.asset = function (assetHash, network) { | ||
@@ -46,0 +61,0 @@ if (network === void 0) { network = 'mainnet'; } |
import type { AxiosInstance } from 'axios'; | ||
export declare const DORA_URL = "https://dora.coz.io"; | ||
export declare const AXIOS_DORA: (version: string) => AxiosInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
export * as api from './api'; | ||
export * from './interfaces'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export interface AddressAbstractEntry { |
"use strict"; | ||
exports.__esModule = true; | ||
//# sourceMappingURL=index.js.map |
export * as NeoLegacy from './neo_legacy'; | ||
export * as Neo from './neo'; |
@@ -0,0 +0,0 @@ "use strict"; |
export * from './interface'; | ||
export * from './responses'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { TypedResponse, Witness } from '../common'; |
"use strict"; | ||
exports.__esModule = true; | ||
//# sourceMappingURL=interface.js.map |
@@ -0,0 +0,0 @@ import { ApplicationLog, Asset, ClaimableEvent, ContractMetaData, ContractState, ContractStorage, ContractTransfer, InputOutput, TimedBalance, Transaction } from './interface'; |
"use strict"; | ||
exports.__esModule = true; | ||
//# sourceMappingURL=responses.js.map |
export * from './responses'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -34,2 +34,39 @@ import { TypedResponse, Witness } from '../common'; | ||
} | ||
export interface InvocationDetails { | ||
type: string; | ||
metadata: InvocationDetailNEP17Transfer | InvocationDetailNEP11Transfer | InvocationDetailContractInvocation | InvocationDetailVote; | ||
} | ||
export interface InvocationDetailContractInvocation { | ||
summary: string; | ||
contract_name: string; | ||
scripthash: string; | ||
method: string; | ||
} | ||
export interface InvocationDetailNEP11Transfer { | ||
summary: string; | ||
symbol: string; | ||
contract_name: string; | ||
scripthash: string; | ||
to: string; | ||
token_id: string; | ||
data: string; | ||
} | ||
export interface InvocationDetailNEP17Transfer { | ||
summary: string; | ||
symbol: string; | ||
contract_name: string; | ||
scripthash: string; | ||
from: string; | ||
to: string; | ||
amount: number; | ||
data: string; | ||
} | ||
export interface InvocationDetailVote { | ||
summary: string; | ||
contract_name: string; | ||
scripthash: string; | ||
voter: string; | ||
candidate: string; | ||
candidate_name: string; | ||
} | ||
export interface Manifest { | ||
@@ -88,2 +125,3 @@ abi?: ABI; | ||
export interface Transaction { | ||
_id: string; | ||
attributes?: any[]; | ||
@@ -103,3 +141,13 @@ block: number; | ||
version?: number; | ||
witness?: Witness; | ||
witnesses?: Witness[]; | ||
} | ||
export interface TransactionEnhanced { | ||
hash: string; | ||
sender: string; | ||
sysfee: string; | ||
netfee: string; | ||
block: number; | ||
time: string; | ||
vmstate: string; | ||
invocations: InvocationDetails[]; | ||
} |
"use strict"; | ||
exports.__esModule = true; | ||
//# sourceMappingURL=interface.js.map |
import { AddressAbstractEntry, Asset, ContractInvocationStats, Balance, Block, NodeMetaData, TransferAbstract, TypedResponse, Witness } from '../common'; | ||
import { Contract, Manifest, NEF, Token, Transaction } from './interface'; | ||
import { Contract, Manifest, NEF, Token, Transaction, TransactionEnhanced } from './interface'; | ||
export interface AddressTransactionsResponse { | ||
items: TransactionEnhanced[]; | ||
totalCount: number; | ||
} | ||
export declare type AssetResponse = Token; | ||
@@ -16,2 +20,3 @@ export interface AssetsResponse { | ||
time: string; | ||
nonce: string; | ||
index: number; | ||
@@ -21,3 +26,3 @@ primary: number; | ||
witness: Witness[]; | ||
tx: string[]; | ||
tx: Transaction[]; | ||
blocktime: number; | ||
@@ -24,0 +29,0 @@ jsonsize: number; |
"use strict"; | ||
exports.__esModule = true; | ||
//# sourceMappingURL=responses.js.map |
export * from './api'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -50,7 +50,7 @@ "use strict"; | ||
chai_1.assert.isNotNull(res); | ||
chai_1.assert.strictEqual(res.length, 10); | ||
chai_1.assert.strictEqual(res.length, 14); | ||
return [2]; | ||
} | ||
}); | ||
}); }); | ||
}); }).timeout(60000); | ||
it("should get an address' abstract fields", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -60,3 +60,3 @@ var res; | ||
switch (_a.label) { | ||
case 0: return [4, neo_legacy_1.NeoLegacyREST.getAddressAbstracts('AZ3JaZ9myjiW98hwLvc3F4RQVvVX4Pm83M')]; | ||
case 0: return [4, neo_legacy_1.NeoLegacyREST.getAddressAbstracts('ANeo2toNeo3MigrationAddressxwPB2Hz')]; | ||
case 1: | ||
@@ -63,0 +63,0 @@ res = _a.sent(); |
export {}; |
@@ -97,2 +97,17 @@ "use strict"; | ||
}); }); | ||
it('should get a block with transactions', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4, neo_1.NeoRest.block(290939, 'testnet_rc4')]; | ||
case 1: | ||
res = _a.sent(); | ||
chai_1.assert.isNotNull(res); | ||
chai_1.assert.isObject(res); | ||
chai_1.assert.strictEqual(res.hash, '0xe91c52d01cf2106ba82fd40c585013c6f4b6a7384cf58ff535262717e3e350fa'); | ||
chai_1.assert.strictEqual(res.tx.length, 2); | ||
return [2]; | ||
} | ||
}); | ||
}); }); | ||
it('should get blocks', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -145,3 +160,3 @@ var res; | ||
switch (_a.label) { | ||
case 0: return [4, neo_1.NeoRest.contractStats('0xbf2d0fb512ace4cee9ee775b0aa6b9a498055e60', 'testnet')]; | ||
case 0: return [4, neo_1.NeoRest.contractStats('0x5a82be96f042df27d8f37f237805796af6fbbf74', 'testnet_rc4')]; | ||
case 1: | ||
@@ -151,3 +166,2 @@ res = (_a.sent()); | ||
chai_1.assert.isObject(res); | ||
chai_1.assert.strictEqual(res['20210715'], 3); | ||
return [2]; | ||
@@ -229,2 +243,17 @@ } | ||
}); }); | ||
it('should get the enhanced transactions for an address', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4, neo_1.NeoRest.addressTransactions('NNtgxn9X4oRG1y7UfxDyjef8aFy6eRpApa', 1)]; | ||
case 1: | ||
res = _a.sent(); | ||
chai_1.assert.isNotNull(res); | ||
chai_1.assert.isObject(res); | ||
chai_1.assert.isArray(res.items); | ||
chai_1.assert.isAtLeast(res.items.length, 14); | ||
return [2]; | ||
} | ||
}); | ||
}); }); | ||
it('should get transfer history', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -231,0 +260,0 @@ var res; |
"use strict"; | ||
//# sourceMappingURL=http.js.map |
"use strict"; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@cityofzion/dora-ts", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index", |
@@ -0,0 +0,0 @@ <p align="center"> |
import type { | ||
AddressTransactionsResponse, | ||
AssetResponse, | ||
@@ -22,2 +23,11 @@ BalanceResponse, | ||
static async addressTransactions( | ||
address: string, | ||
page = 1, | ||
network = 'mainnet' | ||
): Promise<AddressTransactionsResponse> { | ||
const method = 'address_transactions' | ||
return await this.get(network, method, address, page) | ||
} | ||
static async asset( | ||
@@ -24,0 +34,0 @@ assetHash: string, |
@@ -39,2 +39,47 @@ import { TypedResponse, Witness } from '../common' | ||
export interface InvocationDetails { | ||
type: string | ||
metadata: InvocationDetailNEP17Transfer | | ||
InvocationDetailNEP11Transfer | | ||
InvocationDetailContractInvocation | | ||
InvocationDetailVote | ||
} | ||
export interface InvocationDetailContractInvocation { | ||
summary: string | ||
contract_name: string | ||
scripthash: string | ||
method: string | ||
} | ||
export interface InvocationDetailNEP11Transfer { | ||
summary: string | ||
symbol: string | ||
contract_name: string | ||
scripthash: string | ||
to: string | ||
token_id: string | ||
data: string | ||
} | ||
export interface InvocationDetailNEP17Transfer { | ||
summary: string | ||
symbol: string | ||
contract_name: string | ||
scripthash: string | ||
from: string | ||
to: string | ||
amount: number | ||
data: string | ||
} | ||
export interface InvocationDetailVote { | ||
summary: string | ||
contract_name: string | ||
scripthash: string | ||
voter: string | ||
candidate: string | ||
candidate_name: string | ||
} | ||
export interface Manifest { | ||
@@ -101,2 +146,3 @@ abi?: ABI | ||
export interface Transaction { | ||
_id: string | ||
attributes?: any[] | ||
@@ -116,3 +162,14 @@ block: number | ||
version?: number | ||
witness?: Witness | ||
witnesses?: Witness[] | ||
} | ||
export interface TransactionEnhanced { | ||
hash: string | ||
sender: string | ||
sysfee: string | ||
netfee: string | ||
block: number | ||
time: string | ||
vmstate: string | ||
invocations: InvocationDetails[] | ||
} |
@@ -12,4 +12,9 @@ import { | ||
} from '../common' | ||
import { Contract, Manifest, NEF, Token, Transaction } from './interface' | ||
import {Contract, Manifest, NEF, Token, Transaction, TransactionEnhanced} from './interface' | ||
export interface AddressTransactionsResponse { | ||
items: TransactionEnhanced[] | ||
totalCount: number | ||
} | ||
export type AssetResponse = Token | ||
@@ -31,2 +36,3 @@ | ||
time: string | ||
nonce: string | ||
index: number | ||
@@ -36,3 +42,3 @@ primary: number | ||
witness: Witness[] | ||
tx: string[] | ||
tx: Transaction[] | ||
blocktime: number | ||
@@ -39,0 +45,0 @@ jsonsize: number |
@@ -10,8 +10,8 @@ import { assert } from 'chai' | ||
assert.isNotNull(res) | ||
assert.strictEqual(res.length, 10) | ||
}) | ||
assert.strictEqual(res.length, 14) | ||
}).timeout(60000) | ||
it("should get an address' abstract fields", async () => { | ||
const res = await NeoLegacyREST.getAddressAbstracts( | ||
'AZ3JaZ9myjiW98hwLvc3F4RQVvVX4Pm83M' | ||
'ANeo2toNeo3MigrationAddressxwPB2Hz' | ||
) | ||
@@ -18,0 +18,0 @@ assert.isNotNull(res) |
@@ -44,2 +44,13 @@ import { assert } from 'chai' | ||
it('should get a block with transactions', async () => { | ||
const res = await NeoRest.block(290939, 'testnet_rc4') | ||
assert.isNotNull(res) | ||
assert.isObject(res) | ||
assert.strictEqual( | ||
res.hash, | ||
'0xe91c52d01cf2106ba82fd40c585013c6f4b6a7384cf58ff535262717e3e350fa' | ||
) | ||
assert.strictEqual(res.tx.length, 2) | ||
}) | ||
it('should get blocks', async () => { | ||
@@ -72,4 +83,4 @@ const res = await NeoRest.blocks(1, 'testnet') | ||
const res = (await NeoRest.contractStats( | ||
'0xbf2d0fb512ace4cee9ee775b0aa6b9a498055e60', | ||
'testnet' | ||
'0x5a82be96f042df27d8f37f237805796af6fbbf74', | ||
'testnet_rc4' | ||
)) as any | ||
@@ -79,3 +90,2 @@ assert.isNotNull(res) | ||
assert.isObject(res) | ||
assert.strictEqual(res['20210715'], 3) | ||
}) | ||
@@ -131,2 +141,10 @@ | ||
it('should get the enhanced transactions for an address', async () => { | ||
const res = await NeoRest.addressTransactions('NNtgxn9X4oRG1y7UfxDyjef8aFy6eRpApa', 1) | ||
assert.isNotNull(res) | ||
assert.isObject(res) | ||
assert.isArray(res.items) | ||
assert.isAtLeast(res.items.length, 14) | ||
}) | ||
it('should get transfer history', async () => { | ||
@@ -133,0 +151,0 @@ const res = await NeoRest.transferHistory( |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
132015
2874