@stellar/stellar-sdk 11.0.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/CHANGELOG.md +1275 -0
- package/LICENSE +228 -0
- package/README.md +274 -0
- package/dist/stellar-sdk.js +56470 -0
- package/dist/stellar-sdk.min.js +2 -0
- package/dist/stellar-sdk.min.js.LICENSE.txt +71 -0
- package/lib/browser.d.ts +6 -0
- package/lib/browser.js +37 -0
- package/lib/config.d.ts +52 -0
- package/lib/config.js +49 -0
- package/lib/contract_spec.d.ts +130 -0
- package/lib/contract_spec.js +549 -0
- package/lib/errors.d.ts +59 -0
- package/lib/errors.js +105 -0
- package/lib/federation/api.d.ts +11 -0
- package/lib/federation/api.js +7 -0
- package/lib/federation/index.d.ts +2 -0
- package/lib/federation/index.js +24 -0
- package/lib/federation/server.d.ts +118 -0
- package/lib/federation/server.js +253 -0
- package/lib/friendbot/index.d.ts +5 -0
- package/lib/friendbot/index.js +7 -0
- package/lib/horizon/account_call_builder.d.ts +55 -0
- package/lib/horizon/account_call_builder.js +64 -0
- package/lib/horizon/account_response.d.ts +58 -0
- package/lib/horizon/account_response.js +50 -0
- package/lib/horizon/assets_call_builder.d.ts +27 -0
- package/lib/horizon/assets_call_builder.js +45 -0
- package/lib/horizon/call_builder.d.ts +128 -0
- package/lib/horizon/call_builder.js +360 -0
- package/lib/horizon/claimable_balances_call_builder.d.ts +49 -0
- package/lib/horizon/claimable_balances_call_builder.js +58 -0
- package/lib/horizon/effect_call_builder.d.ts +53 -0
- package/lib/horizon/effect_call_builder.js +58 -0
- package/lib/horizon/friendbot_builder.d.ts +5 -0
- package/lib/horizon/friendbot_builder.js +33 -0
- package/lib/horizon/horizon_api.d.ts +523 -0
- package/lib/horizon/horizon_api.js +96 -0
- package/lib/horizon/horizon_axios_client.d.ts +30 -0
- package/lib/horizon/horizon_axios_client.js +48 -0
- package/lib/horizon/index.d.ts +7 -0
- package/lib/horizon/index.js +78 -0
- package/lib/horizon/ledger_call_builder.d.ts +22 -0
- package/lib/horizon/ledger_call_builder.js +39 -0
- package/lib/horizon/liquidity_pool_call_builder.d.ts +38 -0
- package/lib/horizon/liquidity_pool_call_builder.js +61 -0
- package/lib/horizon/offer_call_builder.d.ts +64 -0
- package/lib/horizon/offer_call_builder.js +81 -0
- package/lib/horizon/operation_call_builder.d.ts +68 -0
- package/lib/horizon/operation_call_builder.js +71 -0
- package/lib/horizon/orderbook_call_builder.d.ts +16 -0
- package/lib/horizon/orderbook_call_builder.js +46 -0
- package/lib/horizon/path_call_builder.d.ts +31 -0
- package/lib/horizon/path_call_builder.js +42 -0
- package/lib/horizon/payment_call_builder.d.ts +36 -0
- package/lib/horizon/payment_call_builder.js +48 -0
- package/lib/horizon/server.d.ts +361 -0
- package/lib/horizon/server.js +507 -0
- package/lib/horizon/server_api.d.ts +279 -0
- package/lib/horizon/server_api.js +19 -0
- package/lib/horizon/strict_receive_path_call_builder.d.ts +34 -0
- package/lib/horizon/strict_receive_path_call_builder.js +51 -0
- package/lib/horizon/strict_send_path_call_builder.d.ts +34 -0
- package/lib/horizon/strict_send_path_call_builder.js +51 -0
- package/lib/horizon/trade_aggregation_call_builder.d.ts +48 -0
- package/lib/horizon/trade_aggregation_call_builder.js +82 -0
- package/lib/horizon/trades_call_builder.d.ts +50 -0
- package/lib/horizon/trades_call_builder.js +74 -0
- package/lib/horizon/transaction_call_builder.d.ts +58 -0
- package/lib/horizon/transaction_call_builder.js +66 -0
- package/lib/horizon/types/account.d.ts +5 -0
- package/lib/horizon/types/account.js +5 -0
- package/lib/horizon/types/assets.d.ts +19 -0
- package/lib/horizon/types/assets.js +5 -0
- package/lib/horizon/types/effects.d.ts +285 -0
- package/lib/horizon/types/effects.js +62 -0
- package/lib/horizon/types/offer.d.ts +20 -0
- package/lib/horizon/types/offer.js +5 -0
- package/lib/horizon/types/trade.d.ts +13 -0
- package/lib/horizon/types/trade.js +5 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +79 -0
- package/lib/soroban/api.d.ts +247 -0
- package/lib/soroban/api.js +32 -0
- package/lib/soroban/axios.d.ts +3 -0
- package/lib/soroban/axios.js +16 -0
- package/lib/soroban/browser.d.ts +6 -0
- package/lib/soroban/browser.js +37 -0
- package/lib/soroban/index.d.ts +8 -0
- package/lib/soroban/index.js +72 -0
- package/lib/soroban/jsonrpc.d.ts +33 -0
- package/lib/soroban/jsonrpc.js +93 -0
- package/lib/soroban/parsers.d.ts +17 -0
- package/lib/soroban/parsers.js +111 -0
- package/lib/soroban/server.d.ts +427 -0
- package/lib/soroban/server.js +598 -0
- package/lib/soroban/transaction.d.ts +20 -0
- package/lib/soroban/transaction.js +55 -0
- package/lib/soroban/utils.d.ts +1 -0
- package/lib/soroban/utils.js +9 -0
- package/lib/stellartoml/index.d.ts +121 -0
- package/lib/stellartoml/index.js +78 -0
- package/lib/utils.d.ts +12 -0
- package/lib/utils.js +32 -0
- package/lib/webauth/errors.d.ts +4 -0
- package/lib/webauth/errors.js +37 -0
- package/lib/webauth/index.d.ts +2 -0
- package/lib/webauth/index.js +27 -0
- package/lib/webauth/utils.d.ts +294 -0
- package/lib/webauth/utils.js +332 -0
- package/package.json +153 -0
- package/types/dom-monkeypatch.d.ts +126 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* The buffer module from node.js, for the browser.
|
|
3
|
+
*
|
|
4
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*!
|
|
9
|
+
* URI.js - Mutating URLs
|
|
10
|
+
*
|
|
11
|
+
* Version: 1.19.11
|
|
12
|
+
*
|
|
13
|
+
* Author: Rodney Rehm
|
|
14
|
+
* Web: http://medialize.github.io/URI.js/
|
|
15
|
+
*
|
|
16
|
+
* Licensed under
|
|
17
|
+
* MIT License http://www.opensource.org/licenses/mit-license
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/*!
|
|
22
|
+
* URI.js - Mutating URLs
|
|
23
|
+
* IPv6 Support
|
|
24
|
+
*
|
|
25
|
+
* Version: 1.19.11
|
|
26
|
+
*
|
|
27
|
+
* Author: Rodney Rehm
|
|
28
|
+
* Web: http://medialize.github.io/URI.js/
|
|
29
|
+
*
|
|
30
|
+
* Licensed under
|
|
31
|
+
* MIT License http://www.opensource.org/licenses/mit-license
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/*!
|
|
36
|
+
* URI.js - Mutating URLs
|
|
37
|
+
* Second Level Domain (SLD) Support
|
|
38
|
+
*
|
|
39
|
+
* Version: 1.19.11
|
|
40
|
+
*
|
|
41
|
+
* Author: Rodney Rehm
|
|
42
|
+
* Web: http://medialize.github.io/URI.js/
|
|
43
|
+
*
|
|
44
|
+
* Licensed under
|
|
45
|
+
* MIT License http://www.opensource.org/licenses/mit-license
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/*!
|
|
50
|
+
* URI.js - Mutating URLs
|
|
51
|
+
* URI Template Support - http://tools.ietf.org/html/rfc6570
|
|
52
|
+
*
|
|
53
|
+
* Version: 1.19.11
|
|
54
|
+
*
|
|
55
|
+
* Author: Rodney Rehm
|
|
56
|
+
* Web: http://medialize.github.io/URI.js/
|
|
57
|
+
*
|
|
58
|
+
* Licensed under
|
|
59
|
+
* MIT License http://www.opensource.org/licenses/mit-license
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/*! https://mths.be/punycode v1.4.0 by @mathias */
|
|
64
|
+
|
|
65
|
+
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
66
|
+
|
|
67
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
68
|
+
|
|
69
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
70
|
+
|
|
71
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
package/lib/browser.d.ts
ADDED
package/lib/browser.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
StellarBase: true,
|
|
9
|
+
axios: true
|
|
10
|
+
};
|
|
11
|
+
exports.StellarBase = void 0;
|
|
12
|
+
Object.defineProperty(exports, "axios", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _axios.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
exports.default = void 0;
|
|
19
|
+
var _index = require("./index");
|
|
20
|
+
Object.keys(_index).forEach(function (key) {
|
|
21
|
+
if (key === "default" || key === "__esModule") return;
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
+
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
+
Object.defineProperty(exports, key, {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _index[key];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var _StellarBase = _interopRequireWildcard(require("@stellar/stellar-base"));
|
|
32
|
+
exports.StellarBase = _StellarBase;
|
|
33
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
36
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
37
|
+
var _default = exports.default = module.exports;
|
package/lib/config.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global config class.
|
|
3
|
+
*
|
|
4
|
+
* Usage node:
|
|
5
|
+
* ```
|
|
6
|
+
* import {Config} from 'stellar-sdk';
|
|
7
|
+
* Config.setAllowHttp(true);
|
|
8
|
+
* Config.setTimeout(5000);
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Usage browser:
|
|
12
|
+
* ```
|
|
13
|
+
* StellarSdk.Config.setAllowHttp(true);
|
|
14
|
+
* StellarSdk.Config.setTimeout(5000);
|
|
15
|
+
* ```
|
|
16
|
+
* @static
|
|
17
|
+
*/
|
|
18
|
+
declare class Config {
|
|
19
|
+
/**
|
|
20
|
+
* Sets `allowHttp` flag globally. When set to `true`, connections to insecure http protocol servers will be allowed.
|
|
21
|
+
* Must be set to `false` in production. Default: `false`.
|
|
22
|
+
* @param {boolean} value new allowHttp value
|
|
23
|
+
* @returns {void}
|
|
24
|
+
* @static
|
|
25
|
+
*/
|
|
26
|
+
static setAllowHttp(value: boolean): void;
|
|
27
|
+
/**
|
|
28
|
+
* Sets `timeout` flag globally. When set to anything besides 0, the request will timeout after specified time (ms).
|
|
29
|
+
* Default: 0.
|
|
30
|
+
* @param {number} value new timeout value
|
|
31
|
+
* @returns {void}
|
|
32
|
+
* @static
|
|
33
|
+
*/
|
|
34
|
+
static setTimeout(value: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* @static
|
|
37
|
+
* @returns {boolean} allowHttp flag
|
|
38
|
+
*/
|
|
39
|
+
static isAllowHttp(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* @static
|
|
42
|
+
* @returns {number} timeout flag
|
|
43
|
+
*/
|
|
44
|
+
static getTimeout(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Sets all global config flags to default values.
|
|
47
|
+
* @static
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
static setDefault(): void;
|
|
51
|
+
}
|
|
52
|
+
export { Config };
|
package/lib/config.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Config = void 0;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
+
var defaultConfig = {
|
|
14
|
+
allowHttp: false,
|
|
15
|
+
timeout: 0
|
|
16
|
+
};
|
|
17
|
+
var config = Object.assign({}, defaultConfig);
|
|
18
|
+
var Config = exports.Config = function () {
|
|
19
|
+
function Config() {
|
|
20
|
+
_classCallCheck(this, Config);
|
|
21
|
+
}
|
|
22
|
+
_createClass(Config, null, [{
|
|
23
|
+
key: "setAllowHttp",
|
|
24
|
+
value: function setAllowHttp(value) {
|
|
25
|
+
config.allowHttp = value;
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
key: "setTimeout",
|
|
29
|
+
value: function setTimeout(value) {
|
|
30
|
+
config.timeout = value;
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
key: "isAllowHttp",
|
|
34
|
+
value: function isAllowHttp() {
|
|
35
|
+
return config.allowHttp;
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
key: "getTimeout",
|
|
39
|
+
value: function getTimeout() {
|
|
40
|
+
return config.timeout;
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
key: "setDefault",
|
|
44
|
+
value: function setDefault() {
|
|
45
|
+
config = Object.assign({}, defaultConfig);
|
|
46
|
+
}
|
|
47
|
+
}]);
|
|
48
|
+
return Config;
|
|
49
|
+
}();
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { xdr } from '@stellar/stellar-base';
|
|
2
|
+
export interface Union<T> {
|
|
3
|
+
tag: string;
|
|
4
|
+
values?: T;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Provides a ContractSpec class which can contains the XDR types defined by the contract.
|
|
8
|
+
* This allows the class to be used to convert between native and raw `xdr.ScVal`s.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const specEntries = [...]; // XDR spec entries of a smart contract
|
|
12
|
+
* const contractSpec = new ContractSpec(specEntries);
|
|
13
|
+
*
|
|
14
|
+
* // Convert native value to ScVal
|
|
15
|
+
* const args = {
|
|
16
|
+
* arg1: 'value1',
|
|
17
|
+
* arg2: 1234
|
|
18
|
+
* };
|
|
19
|
+
* const scArgs = contractSpec.funcArgsToScVals('funcName', args);
|
|
20
|
+
*
|
|
21
|
+
* // Call contract
|
|
22
|
+
* const resultScv = await callContract(contractId, 'funcName', scArgs);
|
|
23
|
+
*
|
|
24
|
+
* // Convert result ScVal back to native value
|
|
25
|
+
* const result = contractSpec.funcResToNative('funcName', resultScv);
|
|
26
|
+
*
|
|
27
|
+
* console.log(result); // {success: true}
|
|
28
|
+
*/
|
|
29
|
+
export declare class ContractSpec {
|
|
30
|
+
entries: xdr.ScSpecEntry[];
|
|
31
|
+
/**
|
|
32
|
+
* Constructs a new ContractSpec from an array of XDR spec entries.
|
|
33
|
+
*
|
|
34
|
+
* @param {xdr.ScSpecEntry[] | string[]} entries the XDR spec entries
|
|
35
|
+
*
|
|
36
|
+
* @throws {Error} if entries is invalid
|
|
37
|
+
*/
|
|
38
|
+
constructor(entries: xdr.ScSpecEntry[] | string[]);
|
|
39
|
+
/**
|
|
40
|
+
* Gets the XDR function spec for the given function name.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} name the name of the function
|
|
43
|
+
* @returns {xdr.ScSpecFunctionV0} the function spec
|
|
44
|
+
*
|
|
45
|
+
* @throws {Error} if no function with the given name exists
|
|
46
|
+
*/
|
|
47
|
+
getFunc(name: string): xdr.ScSpecFunctionV0;
|
|
48
|
+
/**
|
|
49
|
+
* Converts native JS arguments to ScVals for calling a contract function.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} name the name of the function
|
|
52
|
+
* @param {Object} args the arguments object
|
|
53
|
+
* @returns {xdr.ScVal[]} the converted arguments
|
|
54
|
+
*
|
|
55
|
+
* @throws {Error} if argument is missing or incorrect type
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```js
|
|
59
|
+
* const args = {
|
|
60
|
+
* arg1: 'value1',
|
|
61
|
+
* arg2: 1234
|
|
62
|
+
* };
|
|
63
|
+
* const scArgs = contractSpec.funcArgsToScVals('funcName', args);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
funcArgsToScVals(name: string, args: object): xdr.ScVal[];
|
|
67
|
+
/**
|
|
68
|
+
* Converts the result ScVal of a function call to a native JS value.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} name the name of the function
|
|
71
|
+
* @param {xdr.ScVal | string} val_or_base64 the result ScVal or base64 encoded string
|
|
72
|
+
* @returns {any} the converted native value
|
|
73
|
+
*
|
|
74
|
+
* @throws {Error} if return type mismatch or invalid input
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```js
|
|
78
|
+
* const resultScv = 'AAA=='; // Base64 encoded ScVal
|
|
79
|
+
* const result = contractSpec.funcResToNative('funcName', resultScv);
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
funcResToNative(name: string, val_or_base64: xdr.ScVal | string): any;
|
|
83
|
+
/**
|
|
84
|
+
* Finds the XDR spec entry for the given name.
|
|
85
|
+
*
|
|
86
|
+
* @param {string} name the name to find
|
|
87
|
+
* @returns {xdr.ScSpecEntry} the entry
|
|
88
|
+
*
|
|
89
|
+
* @throws {Error} if no entry with the given name exists
|
|
90
|
+
*/
|
|
91
|
+
findEntry(name: string): xdr.ScSpecEntry;
|
|
92
|
+
/**
|
|
93
|
+
* Converts a native JS value to an ScVal based on the given type.
|
|
94
|
+
*
|
|
95
|
+
* @param {any} val the native JS value
|
|
96
|
+
* @param {xdr.ScSpecTypeDef} [ty] the expected type
|
|
97
|
+
* @returns {xdr.ScVal} the converted ScVal
|
|
98
|
+
*
|
|
99
|
+
* @throws {Error} if value cannot be converted to the given type
|
|
100
|
+
*/
|
|
101
|
+
nativeToScVal(val: any, ty: xdr.ScSpecTypeDef): xdr.ScVal;
|
|
102
|
+
private nativeToUdt;
|
|
103
|
+
private nativeToUnion;
|
|
104
|
+
private nativeToStruct;
|
|
105
|
+
private nativeToEnum;
|
|
106
|
+
/**
|
|
107
|
+
* Converts an base64 encoded ScVal back to a native JS value based on the given type.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} scv the base64 encoded ScVal
|
|
110
|
+
* @param {xdr.ScSpecTypeDef} typeDef the expected type
|
|
111
|
+
* @returns {any} the converted native JS value
|
|
112
|
+
*
|
|
113
|
+
* @throws {Error} if ScVal cannot be converted to the given type
|
|
114
|
+
*/
|
|
115
|
+
scValStrToNative<T>(scv: string, typeDef: xdr.ScSpecTypeDef): T;
|
|
116
|
+
/**
|
|
117
|
+
* Converts an ScVal back to a native JS value based on the given type.
|
|
118
|
+
*
|
|
119
|
+
* @param {xdr.ScVal} scv the ScVal
|
|
120
|
+
* @param {xdr.ScSpecTypeDef} typeDef the expected type
|
|
121
|
+
* @returns {any} the converted native JS value
|
|
122
|
+
*
|
|
123
|
+
* @throws {Error} if ScVal cannot be converted to the given type
|
|
124
|
+
*/
|
|
125
|
+
scValToNative<T>(scv: xdr.ScVal, typeDef: xdr.ScSpecTypeDef): T;
|
|
126
|
+
private scValUdtToNative;
|
|
127
|
+
private unionToNative;
|
|
128
|
+
private structToNative;
|
|
129
|
+
private enumToNative;
|
|
130
|
+
}
|