Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wharfkit/antelope

Package Overview
Dependencies
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wharfkit/antelope - npm Package Compare versions

Comparing version 0.10.0-beta1 to 0.10.0-rc1

src/api/types.ts

2

package.json
{
"name": "@wharfkit/antelope",
"description": "Library for working with Antelope powered blockchains.",
"version": "0.10.0-beta1",
"version": "0.10.0-rc1",
"homepage": "https://github.com/wharfkit/antelope",

@@ -6,0 +6,0 @@ "license": "BSD-3-Clause-No-Military-License",

@@ -89,3 +89,1 @@ **NOTICE:** This was formerly the `@greymass/eosio` library distributed on [npmjs](https://www.npmjs.com/package/@greymass/eosio). Future distributions will be made using the new organization and namespace, and distributed as `@wharfkit/antelope` again on [npmjs](https://www.npmjs.com/package/@wharfkit/antelope).

[Notes on setting up IDE Debuggers](docs/IDE_Debug.md)
Made with ☕️ & ❤️ by [Greymass](https://greymass.com), if you find this useful please consider [supporting us](https://greymass.com/support-us).
import {APIProvider, APIResponse, FetchProvider, FetchProviderOptions} from './provider'
import {ABISerializableConstructor, ABISerializableType} from '../serializer/serializable'
import {abiDecode} from '../serializer/decoder'
import {ChainAPI} from './v1/chain'
import {HistoryAPI} from './v1/history'
import {BuiltinTypes} from '../serializer/builtins'
export {ChainAPI, HistoryAPI}
export interface APIClientOptions extends FetchProviderOptions {
/** URL to the API node to use, only used if the provider option is not set. */
url?: string
/** API provider to use, if omitted and the url option is set the default provider will be used. */
provider?: APIProvider
/** URL to the API node to use, only used if the provider option is not set. */
url?: string
}

@@ -27,2 +31,4 @@

export type APIMethods = 'POST' | 'GET'
export class APIError extends Error {

@@ -92,3 +98,3 @@ static __className = 'APIError'

export class BaseAPIClient {
export class APIClient {
static __className = 'APIClient'

@@ -108,3 +114,9 @@

v1 = {
chain: new ChainAPI(this),
history: new HistoryAPI(this),
}
async call<T extends ABISerializableConstructor>(args: {
method?: APIMethods
path: string

@@ -115,2 +127,3 @@ params?: unknown

async call<T extends keyof BuiltinTypes>(args: {
method?: APIMethods
path: string

@@ -120,5 +133,10 @@ params?: unknown

}): Promise<BuiltinTypes[T]>
async call<T = unknown>(args: {path: string; params?: unknown}): Promise<T>
async call(args: {path: string; params?: unknown; responseType?: ABISerializableType}) {
const response = await this.provider.call(args.path, args.params)
async call<T = unknown>(args: {method?: APIMethods; path: string; params?: unknown}): Promise<T>
async call(args: {
method?: APIMethods
path: string
params?: unknown
responseType?: ABISerializableType
}) {
const response = await this.provider.call(args)
const {json} = response

@@ -125,0 +143,0 @@ if (Math.floor(response.status / 100) !== 2 || (json && typeof json.error === 'object')) {

@@ -0,1 +1,3 @@

import {APIMethods} from './client'
type Fetch = (input: any, init?: any) => Promise<any>

@@ -18,3 +20,3 @@

*/
call(path: string, params?: unknown): Promise<APIResponse>
call(args: {path: string; params?: unknown; method?: APIMethods}): Promise<APIResponse>
}

@@ -52,7 +54,7 @@

async call(path: string, params?: unknown) {
const url = this.url + path
async call(args: {path: string; params?: unknown; method?: APIMethods}) {
const url = this.url + args.path
const response = await this.fetch(url, {
method: 'POST',
body: params !== undefined ? JSON.stringify(params) : undefined,
method: args.method || 'POST',
body: args.params !== undefined ? JSON.stringify(args.params) : undefined,
})

@@ -59,0 +61,0 @@ const text = await response.text()

@@ -12,2 +12,3 @@ // chain types

export * from './api/provider'
export * as API from './api/types'

@@ -14,0 +15,0 @@ // p2p

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc