@shapeshiftoss/unchained-client 10.0.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cosmossdk/cosmos/index.d.ts +2 -0
- package/dist/{cosmos → cosmossdk/cosmos}/index.js +1 -2
- package/dist/cosmossdk/cosmos/parser/index.d.ts +6 -0
- package/dist/cosmossdk/cosmos/parser/index.js +12 -0
- package/dist/cosmossdk/index.d.ts +5 -0
- package/dist/cosmossdk/index.js +34 -0
- package/dist/cosmossdk/osmosis/index.d.ts +2 -0
- package/dist/{osmosis → cosmossdk/osmosis}/index.js +2 -1
- package/dist/cosmossdk/osmosis/parser/index.d.ts +6 -0
- package/dist/cosmossdk/osmosis/parser/index.js +12 -0
- package/dist/cosmossdk/parser/index.d.ts +12 -0
- package/dist/cosmossdk/parser/index.js +85 -0
- package/dist/{cosmos → cosmossdk/parser}/types.d.ts +3 -1
- package/dist/{cosmos → cosmossdk/parser}/types.js +0 -0
- package/dist/cosmossdk/parser/utils.d.ts +3 -0
- package/dist/cosmossdk/parser/utils.js +63 -0
- package/dist/cosmossdk/thorchain/index.d.ts +2 -0
- package/dist/cosmossdk/thorchain/index.js +18 -0
- package/dist/cosmossdk/thorchain/parser/index.d.ts +6 -0
- package/dist/cosmossdk/thorchain/parser/index.js +12 -0
- package/dist/cosmossdk/types.d.ts +1 -0
- package/dist/cosmossdk/types.js +2 -0
- package/dist/evm/ethereum/parser/abi/foxyStaking.d.ts +1 -1
- package/dist/evm/ethereum/parser/abi/shapeShiftRouter.d.ts +1 -1
- package/dist/evm/ethereum/parser/abi/thor.d.ts +1 -1
- package/dist/evm/ethereum/parser/abi/uniV2.d.ts +1 -1
- package/dist/evm/ethereum/parser/abi/uniV2StakingRewards.d.ts +1 -1
- package/dist/evm/ethereum/parser/abi/weth.d.ts +1 -1
- package/dist/evm/ethereum/parser/abi/yearnVault.d.ts +1 -1
- package/dist/evm/parser/abi/erc20.d.ts +1 -1
- package/dist/evm/parser/index.d.ts +1 -1
- package/dist/generated/cosmos/api.d.ts +18 -10
- package/dist/generated/osmosis/api.d.ts +18 -10
- package/dist/generated/thorchain/api.d.ts +1300 -0
- package/dist/generated/thorchain/api.js +520 -0
- package/dist/generated/thorchain/base.d.ts +55 -0
- package/dist/generated/thorchain/base.js +64 -0
- package/dist/generated/thorchain/common.d.ts +65 -0
- package/dist/generated/thorchain/common.js +137 -0
- package/dist/generated/thorchain/configuration.d.ts +83 -0
- package/dist/generated/thorchain/configuration.js +42 -0
- package/dist/generated/thorchain/index.d.ts +13 -0
- package/dist/generated/thorchain/index.js +31 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -3
- package/dist/types.d.ts +3 -3
- package/dist/utils.d.ts +1 -1
- package/package.json +3 -3
- package/dist/cosmos/index.d.ts +0 -3
- package/dist/cosmos/parser/index.d.ts +0 -13
- package/dist/cosmos/parser/index.js +0 -71
- package/dist/cosmos/parser/utils.d.ts +0 -13
- package/dist/cosmos/parser/utils.js +0 -145
- package/dist/osmosis/index.d.ts +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thorchain Unchained API
|
|
3
|
+
* Provides access to thorchain chain data.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import { Configuration } from "./configuration";
|
|
13
|
+
import { RequestArgs } from "./base";
|
|
14
|
+
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
19
|
+
export declare const DUMMY_BASE_URL = "https://example.com";
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @throws {RequiredError}
|
|
23
|
+
* @export
|
|
24
|
+
*/
|
|
25
|
+
export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
*/
|
|
30
|
+
export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration | undefined) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @export
|
|
34
|
+
*/
|
|
35
|
+
export declare const setBasicAuthToObject: (object: any, configuration?: Configuration | undefined) => void;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @export
|
|
39
|
+
*/
|
|
40
|
+
export declare const setBearerAuthToObject: (object: any, configuration?: Configuration | undefined) => Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @export
|
|
44
|
+
*/
|
|
45
|
+
export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration | undefined) => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @export
|
|
49
|
+
*/
|
|
50
|
+
export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @export
|
|
54
|
+
*/
|
|
55
|
+
export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration | undefined) => any;
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @export
|
|
59
|
+
*/
|
|
60
|
+
export declare const toPathString: (url: URL) => string;
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
*/
|
|
65
|
+
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration | undefined) => <T = unknown, R = AxiosResponse<T, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Thorchain Unchained API
|
|
6
|
+
* Provides access to thorchain chain data.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
|
|
17
|
+
const base_1 = require("./base");
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
*/
|
|
22
|
+
exports.DUMMY_BASE_URL = 'https://example.com';
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @throws {RequiredError}
|
|
26
|
+
* @export
|
|
27
|
+
*/
|
|
28
|
+
const assertParamExists = function (functionName, paramName, paramValue) {
|
|
29
|
+
if (paramValue === null || paramValue === undefined) {
|
|
30
|
+
throw new base_1.RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.assertParamExists = assertParamExists;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @export
|
|
37
|
+
*/
|
|
38
|
+
const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
39
|
+
if (configuration && configuration.apiKey) {
|
|
40
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
41
|
+
? await configuration.apiKey(keyParamName)
|
|
42
|
+
: await configuration.apiKey;
|
|
43
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.setApiKeyToObject = setApiKeyToObject;
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @export
|
|
50
|
+
*/
|
|
51
|
+
const setBasicAuthToObject = function (object, configuration) {
|
|
52
|
+
if (configuration && (configuration.username || configuration.password)) {
|
|
53
|
+
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.setBasicAuthToObject = setBasicAuthToObject;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @export
|
|
60
|
+
*/
|
|
61
|
+
const setBearerAuthToObject = async function (object, configuration) {
|
|
62
|
+
if (configuration && configuration.accessToken) {
|
|
63
|
+
const accessToken = typeof configuration.accessToken === 'function'
|
|
64
|
+
? await configuration.accessToken()
|
|
65
|
+
: await configuration.accessToken;
|
|
66
|
+
object["Authorization"] = "Bearer " + accessToken;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.setBearerAuthToObject = setBearerAuthToObject;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @export
|
|
73
|
+
*/
|
|
74
|
+
const setOAuthToObject = async function (object, name, scopes, configuration) {
|
|
75
|
+
if (configuration && configuration.accessToken) {
|
|
76
|
+
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
77
|
+
? await configuration.accessToken(name, scopes)
|
|
78
|
+
: await configuration.accessToken;
|
|
79
|
+
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.setOAuthToObject = setOAuthToObject;
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @export
|
|
86
|
+
*/
|
|
87
|
+
const setSearchParams = function (url, ...objects) {
|
|
88
|
+
const searchParams = new URLSearchParams(url.search);
|
|
89
|
+
for (const object of objects) {
|
|
90
|
+
for (const key in object) {
|
|
91
|
+
if (Array.isArray(object[key])) {
|
|
92
|
+
searchParams.delete(key);
|
|
93
|
+
for (const item of object[key]) {
|
|
94
|
+
searchParams.append(key, item);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
searchParams.set(key, object[key]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
url.search = searchParams.toString();
|
|
103
|
+
};
|
|
104
|
+
exports.setSearchParams = setSearchParams;
|
|
105
|
+
/**
|
|
106
|
+
*
|
|
107
|
+
* @export
|
|
108
|
+
*/
|
|
109
|
+
const serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
110
|
+
const nonString = typeof value !== 'string';
|
|
111
|
+
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
112
|
+
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
113
|
+
: nonString;
|
|
114
|
+
return needsSerialization
|
|
115
|
+
? JSON.stringify(value !== undefined ? value : {})
|
|
116
|
+
: (value || "");
|
|
117
|
+
};
|
|
118
|
+
exports.serializeDataIfNeeded = serializeDataIfNeeded;
|
|
119
|
+
/**
|
|
120
|
+
*
|
|
121
|
+
* @export
|
|
122
|
+
*/
|
|
123
|
+
const toPathString = function (url) {
|
|
124
|
+
return url.pathname + url.search + url.hash;
|
|
125
|
+
};
|
|
126
|
+
exports.toPathString = toPathString;
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @export
|
|
130
|
+
*/
|
|
131
|
+
const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
132
|
+
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
133
|
+
const axiosRequestArgs = { ...axiosArgs.options, url: ((configuration === null || configuration === void 0 ? void 0 : configuration.basePath) || basePath) + axiosArgs.url };
|
|
134
|
+
return axios.request(axiosRequestArgs);
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
exports.createRequestFunction = createRequestFunction;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thorchain Unchained API
|
|
3
|
+
* Provides access to thorchain chain data.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export interface ConfigurationParameters {
|
|
13
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
14
|
+
username?: string;
|
|
15
|
+
password?: string;
|
|
16
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
17
|
+
basePath?: string;
|
|
18
|
+
baseOptions?: any;
|
|
19
|
+
formDataCtor?: new () => any;
|
|
20
|
+
}
|
|
21
|
+
export declare class Configuration {
|
|
22
|
+
/**
|
|
23
|
+
* parameter for apiKey security
|
|
24
|
+
* @param name security name
|
|
25
|
+
* @memberof Configuration
|
|
26
|
+
*/
|
|
27
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
28
|
+
/**
|
|
29
|
+
* parameter for basic security
|
|
30
|
+
*
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @memberof Configuration
|
|
33
|
+
*/
|
|
34
|
+
username?: string;
|
|
35
|
+
/**
|
|
36
|
+
* parameter for basic security
|
|
37
|
+
*
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof Configuration
|
|
40
|
+
*/
|
|
41
|
+
password?: string;
|
|
42
|
+
/**
|
|
43
|
+
* parameter for oauth2 security
|
|
44
|
+
* @param name security name
|
|
45
|
+
* @param scopes oauth2 scope
|
|
46
|
+
* @memberof Configuration
|
|
47
|
+
*/
|
|
48
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
49
|
+
/**
|
|
50
|
+
* override base path
|
|
51
|
+
*
|
|
52
|
+
* @type {string}
|
|
53
|
+
* @memberof Configuration
|
|
54
|
+
*/
|
|
55
|
+
basePath?: string;
|
|
56
|
+
/**
|
|
57
|
+
* base options for axios calls
|
|
58
|
+
*
|
|
59
|
+
* @type {any}
|
|
60
|
+
* @memberof Configuration
|
|
61
|
+
*/
|
|
62
|
+
baseOptions?: any;
|
|
63
|
+
/**
|
|
64
|
+
* The FormData constructor that will be used to create multipart form data
|
|
65
|
+
* requests. You can inject this here so that execution environments that
|
|
66
|
+
* do not support the FormData class can still run the generated client.
|
|
67
|
+
*
|
|
68
|
+
* @type {new () => FormData}
|
|
69
|
+
*/
|
|
70
|
+
formDataCtor?: new () => any;
|
|
71
|
+
constructor(param?: ConfigurationParameters);
|
|
72
|
+
/**
|
|
73
|
+
* Check if the given MIME is a JSON MIME.
|
|
74
|
+
* JSON MIME examples:
|
|
75
|
+
* application/json
|
|
76
|
+
* application/json; charset=UTF8
|
|
77
|
+
* APPLICATION/JSON
|
|
78
|
+
* application/vnd.company+json
|
|
79
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
80
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
81
|
+
*/
|
|
82
|
+
isJsonMime(mime: string): boolean;
|
|
83
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Thorchain Unchained API
|
|
6
|
+
* Provides access to thorchain chain data.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.Configuration = void 0;
|
|
17
|
+
class Configuration {
|
|
18
|
+
constructor(param = {}) {
|
|
19
|
+
this.apiKey = param.apiKey;
|
|
20
|
+
this.username = param.username;
|
|
21
|
+
this.password = param.password;
|
|
22
|
+
this.accessToken = param.accessToken;
|
|
23
|
+
this.basePath = param.basePath;
|
|
24
|
+
this.baseOptions = param.baseOptions;
|
|
25
|
+
this.formDataCtor = param.formDataCtor;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check if the given MIME is a JSON MIME.
|
|
29
|
+
* JSON MIME examples:
|
|
30
|
+
* application/json
|
|
31
|
+
* application/json; charset=UTF8
|
|
32
|
+
* APPLICATION/JSON
|
|
33
|
+
* application/vnd.company+json
|
|
34
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
35
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
36
|
+
*/
|
|
37
|
+
isJsonMime(mime) {
|
|
38
|
+
const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
39
|
+
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.Configuration = Configuration;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thorchain Unchained API
|
|
3
|
+
* Provides access to thorchain chain data.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export * from "./api";
|
|
13
|
+
export * from "./configuration";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Thorchain Unchained API
|
|
6
|
+
* Provides access to thorchain chain data.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
__exportStar(require("./api"), exports);
|
|
31
|
+
__exportStar(require("./configuration"), exports);
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ export * from './types';
|
|
|
2
2
|
export * as ws from './websocket';
|
|
3
3
|
export * as evm from './evm';
|
|
4
4
|
export * as utxo from './utxo';
|
|
5
|
+
export * as cosmossdk from './cosmossdk';
|
|
5
6
|
export * as ethereum from './evm/ethereum';
|
|
6
7
|
export * as avalanche from './evm/avalanche';
|
|
7
8
|
export * as bitcoin from './utxo/bitcoin';
|
|
8
9
|
export * as bitcoincash from './utxo/bitcoincash';
|
|
9
10
|
export * as dogecoin from './utxo/dogecoin';
|
|
10
11
|
export * as litecoin from './utxo/litecoin';
|
|
11
|
-
export * as cosmos from './cosmos';
|
|
12
|
-
export * as osmosis from './osmosis';
|
|
12
|
+
export * as cosmos from './cosmossdk/cosmos';
|
|
13
|
+
export * as osmosis from './cosmossdk/osmosis';
|
|
14
|
+
export * as thorchain from './cosmossdk/thorchain';
|
package/dist/index.js
CHANGED
|
@@ -26,16 +26,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.osmosis = exports.cosmos = exports.litecoin = exports.dogecoin = exports.bitcoincash = exports.bitcoin = exports.avalanche = exports.ethereum = exports.utxo = exports.evm = exports.ws = void 0;
|
|
29
|
+
exports.thorchain = exports.osmosis = exports.cosmos = exports.litecoin = exports.dogecoin = exports.bitcoincash = exports.bitcoin = exports.avalanche = exports.ethereum = exports.cosmossdk = exports.utxo = exports.evm = exports.ws = void 0;
|
|
30
30
|
__exportStar(require("./types"), exports);
|
|
31
31
|
exports.ws = __importStar(require("./websocket"));
|
|
32
32
|
exports.evm = __importStar(require("./evm"));
|
|
33
33
|
exports.utxo = __importStar(require("./utxo"));
|
|
34
|
+
exports.cosmossdk = __importStar(require("./cosmossdk"));
|
|
34
35
|
exports.ethereum = __importStar(require("./evm/ethereum"));
|
|
35
36
|
exports.avalanche = __importStar(require("./evm/avalanche"));
|
|
36
37
|
exports.bitcoin = __importStar(require("./utxo/bitcoin"));
|
|
37
38
|
exports.bitcoincash = __importStar(require("./utxo/bitcoincash"));
|
|
38
39
|
exports.dogecoin = __importStar(require("./utxo/dogecoin"));
|
|
39
40
|
exports.litecoin = __importStar(require("./utxo/litecoin"));
|
|
40
|
-
exports.cosmos = __importStar(require("./cosmos"));
|
|
41
|
-
exports.osmosis = __importStar(require("./osmosis"));
|
|
41
|
+
exports.cosmos = __importStar(require("./cosmossdk/cosmos"));
|
|
42
|
+
exports.osmosis = __importStar(require("./cosmossdk/osmosis"));
|
|
43
|
+
exports.thorchain = __importStar(require("./cosmossdk/thorchain"));
|
package/dist/types.d.ts
CHANGED
|
@@ -34,9 +34,9 @@ export interface Transfer {
|
|
|
34
34
|
assetId: string;
|
|
35
35
|
type: TransferType;
|
|
36
36
|
totalValue: string;
|
|
37
|
-
components:
|
|
37
|
+
components: {
|
|
38
38
|
value: string;
|
|
39
|
-
}
|
|
39
|
+
}[];
|
|
40
40
|
token?: Token;
|
|
41
41
|
}
|
|
42
42
|
export declare enum TransferType {
|
|
@@ -58,7 +58,7 @@ export interface StandardTx {
|
|
|
58
58
|
fee?: Fee;
|
|
59
59
|
status: TxStatus;
|
|
60
60
|
trade?: Trade;
|
|
61
|
-
transfers:
|
|
61
|
+
transfers: Transfer[];
|
|
62
62
|
txid: string;
|
|
63
63
|
}
|
|
64
64
|
export declare type ParsedTx = StandardTx;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Token, Transfer, TransferType } from './types';
|
|
2
2
|
export declare function findAsyncSequential<T, U>(array: T[], predicate: (element: T) => Promise<U | undefined>): Promise<U | undefined>;
|
|
3
|
-
export declare function aggregateTransfer(transfers:
|
|
3
|
+
export declare function aggregateTransfer(transfers: Transfer[], type: TransferType, assetId: string, from: string, to: string, value: string, token?: Token): Transfer[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/unchained-client",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"ws": "^8.3.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@shapeshiftoss/caip": "^
|
|
32
|
+
"@shapeshiftoss/caip": "^8.0.0",
|
|
33
33
|
"@shapeshiftoss/logger": "^1.1.2",
|
|
34
34
|
"@shapeshiftoss/types": "^8.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@openapitools/openapi-generator-cli": "^2.5.1",
|
|
38
|
-
"@shapeshiftoss/caip": "^
|
|
38
|
+
"@shapeshiftoss/caip": "^8.0.0",
|
|
39
39
|
"@shapeshiftoss/common-api": "^8.0.0",
|
|
40
40
|
"@shapeshiftoss/logger": "^1.1.2",
|
|
41
41
|
"@shapeshiftoss/types": "^8.1.0",
|
package/dist/cosmos/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AssetId, ChainId } from '@shapeshiftoss/caip';
|
|
2
|
-
import { Tx as CosmosTx } from '../index';
|
|
3
|
-
import { ParsedTx } from '../types';
|
|
4
|
-
export interface TransactionParserArgs {
|
|
5
|
-
chainId: ChainId;
|
|
6
|
-
assetId?: AssetId;
|
|
7
|
-
}
|
|
8
|
-
export declare class TransactionParser {
|
|
9
|
-
chainId: ChainId;
|
|
10
|
-
assetId: AssetId;
|
|
11
|
-
constructor(args: TransactionParserArgs);
|
|
12
|
-
parse(tx: CosmosTx, address: string): Promise<ParsedTx>;
|
|
13
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TransactionParser = void 0;
|
|
4
|
-
const caip_1 = require("@shapeshiftoss/caip");
|
|
5
|
-
const bignumber_js_1 = require("bignumber.js");
|
|
6
|
-
const types_1 = require("../../types");
|
|
7
|
-
const utils_1 = require("./utils");
|
|
8
|
-
class TransactionParser {
|
|
9
|
-
constructor(args) {
|
|
10
|
-
var _a;
|
|
11
|
-
this.chainId = args.chainId;
|
|
12
|
-
this.assetId =
|
|
13
|
-
(_a = args === null || args === void 0 ? void 0 : args.assetId) !== null && _a !== void 0 ? _a : (0, caip_1.toAssetId)({
|
|
14
|
-
...(0, caip_1.fromChainId)(this.chainId),
|
|
15
|
-
assetNamespace: 'slip44',
|
|
16
|
-
assetReference: caip_1.ASSET_REFERENCE.Cosmos,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
async parse(tx, address) {
|
|
20
|
-
var _a, _b;
|
|
21
|
-
const parsedTx = {
|
|
22
|
-
address,
|
|
23
|
-
blockHash: tx.blockHash,
|
|
24
|
-
blockHeight: (_a = tx.blockHeight) !== null && _a !== void 0 ? _a : -1,
|
|
25
|
-
blockTime: (_b = tx.timestamp) !== null && _b !== void 0 ? _b : Math.floor(Date.now() / 1000),
|
|
26
|
-
chainId: this.chainId,
|
|
27
|
-
confirmations: tx.confirmations,
|
|
28
|
-
status: tx.confirmations > 0 ? types_1.TxStatus.Confirmed : types_1.TxStatus.Pending,
|
|
29
|
-
transfers: [],
|
|
30
|
-
txid: tx.txid,
|
|
31
|
-
};
|
|
32
|
-
// For simplicity and to limit scope we assume 1 message per transaction
|
|
33
|
-
// This works ok enough for transactions we generate but way may want to improve in the future
|
|
34
|
-
const { from, to, data, value, origin } = (0, utils_1.valuesFromMsgEvents)(tx.messages[0], tx.events, this.assetId, address);
|
|
35
|
-
parsedTx.data = data;
|
|
36
|
-
if (from === address && value.gt(0)) {
|
|
37
|
-
parsedTx.transfers = [
|
|
38
|
-
{
|
|
39
|
-
type: types_1.TransferType.Send,
|
|
40
|
-
assetId: this.assetId,
|
|
41
|
-
from,
|
|
42
|
-
to,
|
|
43
|
-
totalValue: value.toString(10),
|
|
44
|
-
components: [{ value: value.toString(10) }],
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
}
|
|
48
|
-
if (to === address && value.gt(0)) {
|
|
49
|
-
parsedTx.transfers = [
|
|
50
|
-
{
|
|
51
|
-
type: types_1.TransferType.Receive,
|
|
52
|
-
assetId: this.assetId,
|
|
53
|
-
from,
|
|
54
|
-
to,
|
|
55
|
-
totalValue: value.toString(10),
|
|
56
|
-
components: [{ value: value.toString(10) }],
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
}
|
|
60
|
-
// We use origin for fees because some txs have a different from and origin addresses
|
|
61
|
-
if (origin === address) {
|
|
62
|
-
// network fee
|
|
63
|
-
const fees = new bignumber_js_1.BigNumber(tx.fee.amount);
|
|
64
|
-
if (fees.gt(0)) {
|
|
65
|
-
parsedTx.fee = { assetId: this.assetId, value: fees.toString(10) };
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return parsedTx;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.TransactionParser = TransactionParser;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AssetId } from '@shapeshiftoss/caip';
|
|
2
|
-
import BigNumber from 'bignumber.js';
|
|
3
|
-
import { Event, Message } from '../../generated/cosmos';
|
|
4
|
-
import { TxMetadata } from '../types';
|
|
5
|
-
export declare const valuesFromMsgEvents: (msg: Message, events: {
|
|
6
|
-
[key: string]: Event[];
|
|
7
|
-
}, assetId: AssetId, address: string) => {
|
|
8
|
-
from: string;
|
|
9
|
-
to: string;
|
|
10
|
-
value: BigNumber;
|
|
11
|
-
data: TxMetadata | undefined;
|
|
12
|
-
origin: string;
|
|
13
|
-
};
|