Skip to content

Commit

Permalink
Merge pull request #288 from hangts/feature/v3.0.0
Browse files Browse the repository at this point in the history
sm2 lib
  • Loading branch information
kaifei Hu authored Mar 30, 2023
2 parents e910ee2 + a96a6d3 commit c1f8ba3
Show file tree
Hide file tree
Showing 22 changed files with 395 additions and 51 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ const res = await client.bank.send({
- submitCommunityTaxUsageProposal
- deposit
- vote
- voteWeighted

### bank `src/modules/htlc.ts`
- createHTLC
Expand Down
88 changes: 77 additions & 11 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,27 @@ const res = await client.bank.send({
}
})
```
### auth `src/modules/auth.ts`
- newStdTx
- queryAccount
- queryAccounts
- queryParams
### bank `src/modules/bank.ts`
- send
- multiSend
- queryBalance
- queryAllBalances
- queryTotalSupply
- querySupplyOf
- queryDenomMetadata
- queryDenomsMetadata
- queryParams
### auth `src/modules/auth.ts`
- newStdTx
- queryAccount
- queryParams
### bank `src/modules/coinswap.ts`
- addLiquidity
- removeLiquidity
- swapOrder
- queryLiquidity

### distribution `src/modules/distribution.ts`
- setWithdrawAddr
- withdrawRewards
Expand All @@ -171,6 +180,14 @@ const res = await client.bank.send({
- queryDelegatorValidators
- queryDelegatorWithdrawAddress
- queryCommunityPool
### keys `src/modules/farm.ts`
- stakeLp
- unStakeLp
- harvestReward
- queryFarmPools
- queryFarmPool
- queryFarmer
- queryParams
### gov `src/modules/gov.ts`
- queryProposal
- queryProposals
Expand All @@ -184,6 +201,21 @@ const res = await client.bank.send({
- submitCommunityTaxUsageProposal
- deposit
- vote
- voteWeighted

### bank `src/modules/htlc.ts`
- createHTLC
- claimHTLC
- queryHTLC
- queryAssetSupply
- queryAssetSupplies
- queryParams
### bank `src/modules/ibc.ts`
- transfer
- queryDenomTrace
- queryDenomTraces
- queryParams
- queryChannels
### keys `src/modules/keys.ts`
- add
- recover
Expand All @@ -204,6 +236,46 @@ const res = await client.bank.send({
- queryDenom
- queryDenoms
- queryNFT
### slashing `src/modules/oracle.ts`
- queryFeed
- queryFeeds
- queryFeedValue
### protobuf `src/modules/protobuf.ts`
- deserializeTx
- unpackMsg
- deserializeSignDoc
- deserializeTxRaw
- deserializeSigningInfo
- deserializePubkey
### slashing `src/modules/random.ts`
- queryRandom
- queryRequest
- request
### slashing `src/modules/service.ts`
- queryDefinition
- queryBinding
- queryBindings
- queryRequest
- queryRequests
- queryRequestsByReqCtx
- queryRequestContext
- queryResponse
- queryResponses
- queryFees
- defineService
- bindService
- updateServiceBinding
- disableServiceBinding
- enableServiceBinding
- invokeService
- setWithdrawAddress
- refundServiceDeposit
- startRequestContext
- pauseRequestContext
- killRequestContext
- updateRequestContext
- withdrawEarnedFees
- withdrawTax
### slashing `src/modules/slashing.ts`
- queryParams
- querySigningInfo
Expand Down Expand Up @@ -235,6 +307,7 @@ const res = await client.bank.send({
- queryValidators
- searchTxs
- queryNetInfo
- queryGlobalAccountNumber
### token `src/modules/token.ts`
- issueToken
- editToken
Expand All @@ -257,11 +330,4 @@ const res = await client.bank.send({
- broadcastTx
- newTxResult
- createMsg
### protobuf `src/modules/protobuf.ts`
- deserializeTx
- unpackMsg
- deserializeSignDoc
- deserializeTxRaw
- deserializeSigningInfo
- deserializePubkey

4 changes: 2 additions & 2 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@irisnet/irishub-sdk",
"version": "3.0.0",
"version": "3.0.1",
"description": "IRISHub JavaScript SDK",
"main": "index.js",
"typings": "index.ts",
Expand Down Expand Up @@ -73,7 +73,7 @@
"secp256k1": "^3.8.0",
"secure-random": "^1.1.2",
"sha256": "^0.2.0",
"sm-crypto": "git+http://github.com/bianjieai/sm-crypto-js.git#main",
"sm-crypto-bj": "0.2.2",
"tweetnacl": "^1.0.3",
"uuid": "^8.3.2"
}
Expand Down
9 changes: 9 additions & 0 deletions dist/src/modules/gov.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ export declare class Gov {
* @since v0.17
*/
vote(proposal_id: number, option: types.VoteOption, baseTx: types.BaseTx): Promise<types.TxResult>;
/**
* voteWeighted
* @param proposal_id
* @param options Note: Due to Chain precision issues, option.weight needs to be multiplied by 10^18, such as 0.3 => 0.3 * 10**18 = 3000000000000000000
* @param baseTx { types.BaseTx }
* @returns
* @since v3.0.1
*/
voteWeighted(proposal_id: number, options: types.WeightedVoteOption[], baseTx: types.BaseTx): Promise<types.TxResult>;
/**
* deposit
* @param proposal_id
Expand Down
57 changes: 50 additions & 7 deletions dist/src/modules/gov.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,49 @@ var Gov = /*#__PURE__*/function () {

return vote;
}()
/**
* voteWeighted
* @param proposal_id
* @param options Note: Due to Chain precision issues, option.weight needs to be multiplied by 10^18, such as 0.3 => 0.3 * 10**18 = 3000000000000000000
* @param baseTx { types.BaseTx }
* @returns
* @since v3.0.1
*/

}, {
key: "voteWeighted",
value: function () {
var _voteWeighted = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(proposal_id, options, baseTx) {
var from, msgs;
return _regenerator["default"].wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
from = this.client.keys.show(baseTx.from);
msgs = [{
type: types.TxType.MsgVoteWeighted,
value: {
proposal_id: proposal_id,
voter: from,
options: options
}
}];
return _context3.abrupt("return", this.client.tx.buildAndSend(msgs, baseTx));

case 3:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));

function voteWeighted(_x7, _x8, _x9) {
return _voteWeighted.apply(this, arguments);
}

return voteWeighted;
}()
/**
* deposit
* @param proposal_id
Expand All @@ -145,11 +188,11 @@ var Gov = /*#__PURE__*/function () {
}, {
key: "deposit",
value: function () {
var _deposit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(proposal_id, amount, baseTx) {
var _deposit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(proposal_id, amount, baseTx) {
var from, msgs;
return _regenerator["default"].wrap(function _callee3$(_context3) {
return _regenerator["default"].wrap(function _callee4$(_context4) {
while (1) {
switch (_context3.prev = _context3.next) {
switch (_context4.prev = _context4.next) {
case 0:
from = this.client.keys.show(baseTx.from);
msgs = [{
Expand All @@ -160,17 +203,17 @@ var Gov = /*#__PURE__*/function () {
amount: amount
}
}];
return _context3.abrupt("return", this.client.tx.buildAndSend(msgs, baseTx));
return _context4.abrupt("return", this.client.tx.buildAndSend(msgs, baseTx));

case 3:
case "end":
return _context3.stop();
return _context4.stop();
}
}
}, _callee3, this);
}, _callee4, this);
}));

function deposit(_x7, _x8, _x9) {
function deposit(_x10, _x11, _x12) {
return _deposit.apply(this, arguments);
}

Expand Down
6 changes: 6 additions & 0 deletions dist/src/modules/protobuf.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ var Protobuf = /*#__PURE__*/function () {
break;
}

case types.TxType.MsgVoteWeighted:
{
messageModelClass = types.MsgVoteWeighted.getModelClass();
break;
}

case types.TxType.MsgDeposit:
{
messageModelClass = types.MsgDeposit.getModelClass();
Expand Down
6 changes: 6 additions & 0 deletions dist/src/modules/tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,12 @@ var Tx = /*#__PURE__*/function () {
break;
}

case types.TxType.MsgVoteWeighted:
{
msg = new types.MsgVoteWeighted(txMsg.value);
break;
}

case types.TxType.MsgDeposit:
{
msg = new types.MsgDeposit(txMsg.value);
Expand Down
24 changes: 22 additions & 2 deletions dist/src/types/gov.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ export interface VoteTxParam {
}
/**
* Msg for Vote
*
* @hidden
*/
export declare class MsgVote extends Msg {
value: VoteTxParam;
Expand All @@ -42,6 +40,24 @@ export declare class MsgVote extends Msg {
getModel(): any;
validate(): void;
}
/**
* param struct for VoteWeighted tx
*/
export interface VoteWeightedTxParam {
proposal_id: number;
voter: string;
options: WeightedVoteOption[];
}
/**
* Msg for MsgVoteWeighted
*/
export declare class MsgVoteWeighted extends Msg {
value: VoteWeightedTxParam;
constructor(msg: VoteWeightedTxParam);
static getModelClass(): any;
getModel(): any;
validate(): void;
}
/**
* param struct for Deposit tx
*/
Expand Down Expand Up @@ -120,6 +136,10 @@ export interface SoftwareUpgradePlan {
export interface SoftwareUpgradeProposal extends TextProposal {
plan: SoftwareUpgradePlan;
}
export interface WeightedVoteOption {
option: VoteOption;
weight: string;
}
/**
* Vote options
*/
Expand Down
Loading

0 comments on commit c1f8ba3

Please sign in to comment.