Skip to content

Commit

Permalink
Merge pull request #406 from hangts/master
Browse files Browse the repository at this point in the history
#upgrade lib
  • Loading branch information
hangts authored Jun 17, 2024
2 parents 82e8757 + e98db0e commit 0e09b3d
Show file tree
Hide file tree
Showing 51 changed files with 1,781 additions and 1,972 deletions.
14 changes: 7 additions & 7 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@irisnet/irishub-sdk",
"version": "3.4.0",
"version": "3.4.1",
"description": "IRISHub JavaScript SDK",
"main": "index.js",
"typings": "index.ts",
Expand Down Expand Up @@ -32,7 +32,7 @@
"proto-gen": "sh ./scripts/protocgen.sh"
},
"devDependencies": {
"@babel/cli": "^7.24.1",
"@babel/cli": "^7.24.7",
"@babel/core": "^7.23.7",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-transform-runtime": "^7.23.7",
Expand All @@ -43,26 +43,26 @@
"babel-loader": "^9.1.2",
"eslint": "^6.8.0",
"eslint-loader": "^4.0.0",
"gts": "5.2.0",
"gts": "^5.3.1",
"jest": "29.7.0",
"rimraf": "^5.0.7",
"ts-loader": "^9.4.4",
"tslint": "^6.1.0",
"typedoc": "^0.25.7",
"typescript": "^5.3.3"
"typescript": "^5.4.5"
},
"dependencies": {
"@babel/runtime": "^7.23.8",
"@cosmjs/crypto": "^0.32.3",
"@types/mathjs": "6.0.11",
"@types/ws": "^8.5.10",
"axios": "^1.6.5",
"axios": "^1.7.2",
"bcryptjs": "^2.4.3",
"bech32": "^1.1.3",
"buffer": "^6.0.3",
"crypto-js": "^4.0.0",
"events": "^3.1.0",
"google-protobuf": "3.13.0",
"google-protobuf": "^3.21.2",
"grpc-web": "^1.2.1",
"is_js": "^0.9.0",
"isomorphic-ws": "^5.0.0",
Expand All @@ -76,4 +76,4 @@
"tweetnacl": "^1.0.3",
"uuid": "^9.0.0"
}
}
}
149 changes: 78 additions & 71 deletions dist/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
exports.DefaultKeyDAOImpl = exports.DefaultClientConfig = exports.Client = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var consts = _interopRequireWildcard(require("./types/constants"));
var modules = _interopRequireWildcard(require("./modules"));
var _rpcClient = require("./nets/rpc-client");
Expand All @@ -16,12 +17,79 @@ var _errors = require("./errors");
var AES = _interopRequireWildcard(require("crypto-js/aes"));
var ENC = _interopRequireWildcard(require("crypto-js/enc-utf8"));
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); }
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; }
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 && {}.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; }
/** IRISHub Client */
var Client = exports.Client = /*#__PURE__*/function () {
/** IRISHub SDK Constructor */
function Client(config) {
(0, _classCallCheck2["default"])(this, Client);
/** IRISHub Client Config */
(0, _defineProperty2["default"])(this, "config", void 0);
/** Axios client for tendermint rpc requests */
(0, _defineProperty2["default"])(this, "_rpcClient", void 0);
/** Auth module */
(0, _defineProperty2["default"])(this, "_auth", void 0);
/** Token module */
(0, _defineProperty2["default"])(this, "_token", void 0);
/** Bank module */
(0, _defineProperty2["default"])(this, "_bank", void 0);
/** Key management module */
(0, _defineProperty2["default"])(this, "_keys", void 0);
/** Protobuf module */
(0, _defineProperty2["default"])(this, "_protobuf", void 0);
/** Staking module */
(0, _defineProperty2["default"])(this, "_staking", void 0);
/** Tx module */
(0, _defineProperty2["default"])(this, "_tx", void 0);
/** Gov module */
(0, _defineProperty2["default"])(this, "_gov", void 0);
/** Slashing module */
(0, _defineProperty2["default"])(this, "_slashing", void 0);
/** Distribution module */
(0, _defineProperty2["default"])(this, "_distribution", void 0);
/** Service module */
// private _service?: modules.Service;
// get service(): modules.Service{
// if (this.config.chainNetwork != consts.ChainNetwork.Iris) {
// throw new SdkError('This module is not supported on the current chain network.',CODES.Panic);
// }
// if (!this._service) {this._service = new modules.Service(this)}
// return this._service;
// }
/** Oracle module */
// private _oracle?: modules.Oracle;
// get oracle(): modules.Oracle{
// if (this.config.chainNetwork != consts.ChainNetwork.Iris) {
// throw new SdkError('This module is not supported on the current chain network.',CODES.Panic);
// }
// if (!this._oracle) {this._oracle = new modules.Oracle(this)}
// return this._oracle;
// }
/** Random module */
// private _random?: modules.Random;
// get random(): modules.Random{
// if (this.config.chainNetwork != consts.ChainNetwork.Iris) {
// throw new SdkError('This module is not supported on the current chain network.',CODES.Panic);
// }
// if (!this._random) {this._random = new modules.Random(this)}
// return this._random;
// }
/** Utils module */
(0, _defineProperty2["default"])(this, "_utils", void 0);
/** Tendermint module */
(0, _defineProperty2["default"])(this, "_tendermint", void 0);
/** Coinswap module */
(0, _defineProperty2["default"])(this, "_coinswap", void 0);
/** Farm module */
(0, _defineProperty2["default"])(this, "_farm", void 0);
/** NFT module */
(0, _defineProperty2["default"])(this, "_nft", void 0);
/** Htlc module */
(0, _defineProperty2["default"])(this, "_htlc", void 0);
/** Ibc module */
(0, _defineProperty2["default"])(this, "_ibc", void 0);
/** Ibc nft transfer module */
(0, _defineProperty2["default"])(this, "_ibcNftTransfer", void 0);
this.config = config;
if (!this.config.rpcConfig) this.config.rpcConfig = {};
if (!this.config.bech32Prefix || !this.config.bech32Prefix.AccAddr) {
Expand Down Expand Up @@ -56,18 +124,12 @@ var Client = exports.Client = /*#__PURE__*/function () {
*/
return (0, _createClass2["default"])(Client, [{
key: "rpcClient",
get: /** IRISHub Client Config */

/** Axios client for tendermint rpc requests */

function get() {
get: function get() {
if (!this._rpcClient) {
this._rpcClient = new _rpcClient.RpcClient(this.config.rpcConfig);
}
return this._rpcClient;
}

/** Auth module */
}, {
key: "auth",
get: function get() {
Expand All @@ -76,8 +138,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._auth;
}

/** Token module */
}, {
key: "token",
get: function get() {
Expand All @@ -89,8 +149,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._token;
}

/** Bank module */
}, {
key: "bank",
get: function get() {
Expand All @@ -99,8 +157,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._bank;
}

/** Key management module */
}, {
key: "keys",
get: function get() {
Expand All @@ -109,8 +165,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._keys;
}

/** Protobuf module */
}, {
key: "protobuf",
get: function get() {
Expand All @@ -119,8 +173,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._protobuf;
}

/** Staking module */
}, {
key: "staking",
get: function get() {
Expand All @@ -129,8 +181,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._staking;
}

/** Tx module */
}, {
key: "tx",
get: function get() {
Expand All @@ -139,8 +189,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._tx;
}

/** Gov module */
}, {
key: "gov",
get: function get() {
Expand All @@ -149,8 +197,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._gov;
}

/** Slashing module */
}, {
key: "slashing",
get: function get() {
Expand All @@ -159,8 +205,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._slashing;
}

/** Distribution module */
}, {
key: "distribution",
get: function get() {
Expand All @@ -169,38 +213,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._distribution;
}

/** Service module */
// private _service?: modules.Service;
// get service(): modules.Service{
// if (this.config.chainNetwork != consts.ChainNetwork.Iris) {
// throw new SdkError('This module is not supported on the current chain network.',CODES.Panic);
// }
// if (!this._service) {this._service = new modules.Service(this)}
// return this._service;
// }

/** Oracle module */
// private _oracle?: modules.Oracle;
// get oracle(): modules.Oracle{
// if (this.config.chainNetwork != consts.ChainNetwork.Iris) {
// throw new SdkError('This module is not supported on the current chain network.',CODES.Panic);
// }
// if (!this._oracle) {this._oracle = new modules.Oracle(this)}
// return this._oracle;
// }

/** Random module */
// private _random?: modules.Random;
// get random(): modules.Random{
// if (this.config.chainNetwork != consts.ChainNetwork.Iris) {
// throw new SdkError('This module is not supported on the current chain network.',CODES.Panic);
// }
// if (!this._random) {this._random = new modules.Random(this)}
// return this._random;
// }

/** Utils module */
}, {
key: "utils",
get: function get() {
Expand All @@ -209,8 +221,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._utils;
}

/** Tendermint module */
}, {
key: "tendermint",
get: function get() {
Expand All @@ -219,8 +229,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._tendermint;
}

/** Coinswap module */
}, {
key: "coinswap",
get: function get() {
Expand All @@ -232,7 +240,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._coinswap;
}
/** Farm module */
}, {
key: "farm",
get: function get() {
Expand All @@ -244,8 +251,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._farm;
}

/** NFT module */
}, {
key: "nft",
get: function get() {
Expand All @@ -257,8 +262,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._nft;
}

/** Htlc module */
}, {
key: "htlc",
get: function get() {
Expand All @@ -270,8 +273,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._htlc;
}

/** Ibc module */
}, {
key: "ibc",
get: function get() {
Expand All @@ -280,8 +281,6 @@ var Client = exports.Client = /*#__PURE__*/function () {
}
return this._ibc;
}

/** Ibc nft transfer module */
}, {
key: "ibcNftTransfer",
get: function get() {
Expand Down Expand Up @@ -377,6 +376,14 @@ var Client = exports.Client = /*#__PURE__*/function () {
/** Default IRISHub Client Config */
var DefaultClientConfig = exports.DefaultClientConfig = /*#__PURE__*/(0, _createClass2["default"])(function DefaultClientConfig() {
(0, _classCallCheck2["default"])(this, DefaultClientConfig);
(0, _defineProperty2["default"])(this, "node", void 0);
(0, _defineProperty2["default"])(this, "chainNetwork", void 0);
(0, _defineProperty2["default"])(this, "chainId", void 0);
(0, _defineProperty2["default"])(this, "gas", void 0);
(0, _defineProperty2["default"])(this, "fee", void 0);
(0, _defineProperty2["default"])(this, "keyDAO", void 0);
(0, _defineProperty2["default"])(this, "bech32Prefix", void 0);
(0, _defineProperty2["default"])(this, "rpcConfig", void 0);
this.node = '';
this.chainNetwork = types.ChainNetwork.Iris;
this.chainId = '';
Expand Down
2 changes: 1 addition & 1 deletion dist/src/helper/modelCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
var types = _interopRequireWildcard(require("../types"));
var is = _interopRequireWildcard(require("is_js"));
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); }
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; }
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 && {}.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; }
var ModelCreator = exports.ModelCreator = /*#__PURE__*/function () {
function ModelCreator() {
(0, _classCallCheck2["default"])(this, ModelCreator);
Expand Down
2 changes: 1 addition & 1 deletion dist/src/helper/txHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var types = _interopRequireWildcard(require("../types"));
var _errors = require("../errors");
var _buffer = require("buffer");
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); }
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; }
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 && {}.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; }
var TxHelper = exports.TxHelper = /*#__PURE__*/function () {
function TxHelper() {
(0, _classCallCheck2["default"])(this, TxHelper);
Expand Down
2 changes: 1 addition & 1 deletion dist/src/helper/txModelCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var _txHelper = require("./txHelper");
var _errors = require("../errors");
var _buffer = require("buffer");
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); }
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; }
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 && {}.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; }
var TxModelCreator = exports.TxModelCreator = /*#__PURE__*/function () {
function TxModelCreator() {
(0, _classCallCheck2["default"])(this, TxModelCreator);
Expand Down
2 changes: 1 addition & 1 deletion dist/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var _utils = _interopRequireWildcard(require("./utils"));
exports.utils = _utils;
var _client = require("./client");
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); }
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; }
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 && {}.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; }
/**
* Initialize IRISHub SDK
*
Expand Down
Loading

0 comments on commit 0e09b3d

Please sign in to comment.