-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into toshi/provider-basic-auth
- Loading branch information
Showing
7 changed files
with
191 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,6 @@ | |
"abort-controller": "^3.0.0", | ||
"buffer": "^6.0.3", | ||
"debug": "^4.3.3", | ||
"undici": "^5.0.0" | ||
"undici": "^5.26.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
packages/transaction-builder/src/models/msgs/msg-proto-app-transfer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Buffer } from 'buffer' | ||
import { MsgProtoStake } from '../proto/generated/tx-signer' | ||
import { Any } from '../proto/generated/google/protobuf/any' | ||
import { TxMsg } from './tx-msg' | ||
|
||
/** | ||
* MsgProtoAppTransfer is a special case of MsgProtoAppStake where | ||
* chains and amount are not set | ||
*/ | ||
export class MsgProtoAppTransfer extends TxMsg { | ||
public readonly KEY: string = '/x.apps.MsgProtoStake' | ||
public readonly AMINO_KEY: string = 'apps/MsgAppStake' | ||
public readonly pubKey: Buffer | ||
|
||
/** | ||
* Constructor for this class | ||
* @param {Buffer} pubKey - Application public key to be transferred to | ||
*/ | ||
constructor(pubKey: string) { | ||
super() | ||
this.pubKey = Buffer.from(pubKey, 'hex') | ||
} | ||
|
||
/** | ||
* Converts an Msg Object to StdSignDoc | ||
* @returns {object} - Msg type key value. | ||
* @memberof MsgAppStake | ||
*/ | ||
public toStdSignDocMsgObj(): object { | ||
return { | ||
type: this.AMINO_KEY, | ||
value: { | ||
chains: null, | ||
pubkey: { | ||
type: 'crypto/ed25519_public_key', | ||
value: this.pubKey.toString('hex'), | ||
}, | ||
value: '0', | ||
}, | ||
} | ||
} | ||
|
||
/** | ||
* Converts an Msg Object for StdTx encoding | ||
* @returns {any} - Msg type key value. | ||
* @memberof MsgAppStake | ||
*/ | ||
public toStdTxMsgObj(): any { | ||
const data : MsgProtoStake = { | ||
pubKey: this.pubKey, | ||
chains: [], | ||
value: '0', | ||
} | ||
|
||
return Any.fromJSON({ | ||
typeUrl: this.KEY, | ||
value: Buffer.from(MsgProtoStake.encode(data).finish()).toString( | ||
'base64' | ||
), | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.