@33cn/game-cashier-react
Advanced tools
Comparing version 1.9.13 to 1.9.14
@@ -27,6 +27,6 @@ /** | ||
* @param {boolean} isWithdraw 是否是撤回 撤回时 币从目标合约地址转回到原合约地址 | ||
* @param {string} [withholdAddress] 代扣地址 needWithhold为true时生效 | ||
* @param {string} [exercerName] 代扣地址 needWithhold为true时生效 | ||
* @returns | ||
*/ | ||
export declare function transferBetweenContract(needWithhold: boolean, gameNodeURL: string, address: string, amount: number, contractAddr: string, contractName: string, isWithdraw: boolean, withholdAddress?: string): Promise<any>; | ||
export declare function transferBetweenContract(needWithhold: boolean, gameNodeURL: string, address: string, amount: number, contractAddr: string, contractName: string, isWithdraw: boolean, exercerName?: string): Promise<any>; | ||
/** | ||
@@ -33,0 +33,0 @@ * @description 从主链的coins转到paracross合约 |
@@ -64,6 +64,6 @@ import * as tslib_1 from "tslib"; | ||
* @param {boolean} isWithdraw 是否是撤回 撤回时 币从目标合约地址转回到原合约地址 | ||
* @param {string} [withholdAddress] 代扣地址 needWithhold为true时生效 | ||
* @param {string} [exercerName] 代扣地址 needWithhold为true时生效 | ||
* @returns | ||
*/ | ||
export function transferBetweenContract(needWithhold, gameNodeURL, address, amount, contractAddr, contractName, isWithdraw, withholdAddress) { | ||
export function transferBetweenContract(needWithhold, gameNodeURL, address, amount, contractAddr, contractName, isWithdraw, exercerName) { | ||
return createRawTransaction({ | ||
@@ -78,3 +78,3 @@ amount: +(amount * 1e8).toFixed(), | ||
if (needWithhold) { | ||
return signTxGroup(res, withholdAddress); | ||
return signTxGroup(res, exercerName); | ||
} | ||
@@ -81,0 +81,0 @@ else { |
@@ -16,3 +16,3 @@ import * as tslib_1 from "tslib"; | ||
App.prototype.render = function () { | ||
return (React.createElement(Cashier, { coinName: "GBTY", gameNodeURL: "http://47.98.245.85:8901", gameName: "\u5E78\u8FD0\u6570\u5B57", gameIcon: icontest, contractName: "user.p.game.user.wasm.lucky", contractAddr: "184tkVBLrp6gWbi274LBKYgkPsZq7tYHAP", dialogVisible: this.state.visible, noNeedPara: false, onClose: this.onClose, gameBalance: 10, coinsBalance: 12, onNewTransactionSend: this.onNewSended, needWithhold: false, withholdAddress: 'user.p.game.none' })); | ||
return (React.createElement(Cashier, { coinName: "GBTY", gameNodeURL: "http://47.98.245.85:8901", gameName: "\u5E78\u8FD0\u6570\u5B57", gameIcon: icontest, contractName: "user.p.game.user.wasm.lucky", contractAddr: "184tkVBLrp6gWbi274LBKYgkPsZq7tYHAP", dialogVisible: this.state.visible, noNeedPara: false, onClose: this.onClose, gameBalance: 10, coinsBalance: 12, onNewTransactionSend: this.onNewSended, needWithhold: false, exercerName: 'user.p.game.none' })); | ||
}; | ||
@@ -19,0 +19,0 @@ App.prototype.onClose = function () { |
@@ -52,3 +52,3 @@ import * as React from 'react'; | ||
*/ | ||
withholdAddress?: string; | ||
exercerName?: string; | ||
} | ||
@@ -55,0 +55,0 @@ export declare enum RWStep { |
@@ -119,12 +119,12 @@ import * as tslib_1 from "tslib"; | ||
case 'recharge': | ||
matchElem = (React.createElement(Recharge, { needWithhold: this.props.needWithhold, gameNodeURL: this.props.gameNodeURL, address: this.state.myAddress, type: "recharge", contractName: this.props.contractName, onCloseClick: this.resetPathOnClose, onPathChange: this.changePath, onNewTransactionSend: this.props.onNewTransactionSend, btyBalance: this.state.btyBalance, coinsBalance: this.props.coinsBalance - this.state.usedCoinsBalance, rechargeState: this.state.rechargeState, widthdrawState: this.state.widthdrawState, onTransactionStart: this.setRWStart, withholdAddress: this.props.withholdAddress })); | ||
matchElem = (React.createElement(Recharge, { needWithhold: this.props.needWithhold, gameNodeURL: this.props.gameNodeURL, address: this.state.myAddress, type: "recharge", contractName: this.props.contractName, onCloseClick: this.resetPathOnClose, onPathChange: this.changePath, onNewTransactionSend: this.props.onNewTransactionSend, btyBalance: this.state.btyBalance, coinsBalance: this.props.coinsBalance - this.state.usedCoinsBalance, rechargeState: this.state.rechargeState, widthdrawState: this.state.widthdrawState, onTransactionStart: this.setRWStart, exercerName: this.props.exercerName })); | ||
break; | ||
case 'widthdraw': | ||
matchElem = (React.createElement(Recharge, { needWithhold: this.props.needWithhold, gameNodeURL: this.props.gameNodeURL, address: this.state.myAddress, type: "widthdraw", contractName: this.props.contractName, onCloseClick: this.resetPathOnClose, onPathChange: this.changePath, onNewTransactionSend: this.props.onNewTransactionSend, btyBalance: this.state.btyBalance, coinsBalance: this.props.coinsBalance - this.state.usedCoinsBalance, rechargeState: this.state.rechargeState, widthdrawState: this.state.widthdrawState, onTransactionStart: this.setRWStart, withholdAddress: this.props.withholdAddress })); | ||
matchElem = (React.createElement(Recharge, { needWithhold: this.props.needWithhold, gameNodeURL: this.props.gameNodeURL, address: this.state.myAddress, type: "widthdraw", contractName: this.props.contractName, onCloseClick: this.resetPathOnClose, onPathChange: this.changePath, onNewTransactionSend: this.props.onNewTransactionSend, btyBalance: this.state.btyBalance, coinsBalance: this.props.coinsBalance - this.state.usedCoinsBalance, rechargeState: this.state.rechargeState, widthdrawState: this.state.widthdrawState, onTransactionStart: this.setRWStart, exercerName: this.props.exercerName })); | ||
break; | ||
case 'to-contract': | ||
matchElem = (React.createElement(DoTransfer, { gameBalance: this.props.gameBalance, coinsBalance: this.props.coinsBalance - this.state.usedCoinsBalance, onCloseClick: this.resetPathOnClose, gameNodeURL: this.props.gameNodeURL, address: this.state.myAddress, gameName: this.props.gameName, gameIcon: this.props.gameIcon, contractName: this.props.contractName, contractAddr: this.props.contractAddr, toContract: true, onPathChange: this.changePath, onNewTransactionSend: this.props.onNewTransactionSend, needWithhold: this.props.needWithhold, withholdAddress: this.props.withholdAddress })); | ||
matchElem = (React.createElement(DoTransfer, { gameBalance: this.props.gameBalance, coinsBalance: this.props.coinsBalance - this.state.usedCoinsBalance, onCloseClick: this.resetPathOnClose, gameNodeURL: this.props.gameNodeURL, address: this.state.myAddress, gameName: this.props.gameName, gameIcon: this.props.gameIcon, contractName: this.props.contractName, contractAddr: this.props.contractAddr, toContract: true, onPathChange: this.changePath, onNewTransactionSend: this.props.onNewTransactionSend, needWithhold: this.props.needWithhold, exercerName: this.props.exercerName })); | ||
break; | ||
case 'to-coins': | ||
matchElem = (React.createElement(DoTransfer, { gameBalance: this.props.gameBalance, coinsBalance: this.props.coinsBalance - this.state.usedCoinsBalance, onCloseClick: this.resetPathOnClose, gameNodeURL: this.props.gameNodeURL, address: this.state.myAddress, gameName: this.props.gameName, contractName: this.props.contractName, gameIcon: this.props.gameIcon, contractAddr: this.props.contractAddr, toContract: false, onPathChange: this.changePath, onNewTransactionSend: this.props.onNewTransactionSend, needWithhold: this.props.needWithhold, withholdAddress: this.props.withholdAddress })); | ||
matchElem = (React.createElement(DoTransfer, { gameBalance: this.props.gameBalance, coinsBalance: this.props.coinsBalance - this.state.usedCoinsBalance, onCloseClick: this.resetPathOnClose, gameNodeURL: this.props.gameNodeURL, address: this.state.myAddress, gameName: this.props.gameName, contractName: this.props.contractName, gameIcon: this.props.gameIcon, contractAddr: this.props.contractAddr, toContract: false, onPathChange: this.changePath, onNewTransactionSend: this.props.onNewTransactionSend, needWithhold: this.props.needWithhold, exercerName: this.props.exercerName })); | ||
break; | ||
@@ -131,0 +131,0 @@ } |
@@ -17,3 +17,3 @@ import * as React from 'react'; | ||
needWithhold: boolean; | ||
withholdAddress?: string; | ||
exercerName?: string; | ||
} | ||
@@ -20,0 +20,0 @@ interface IState { |
@@ -83,3 +83,3 @@ import * as tslib_1 from "tslib"; | ||
this.setState({ loading: true }); | ||
transferBetweenContract(this.props.needWithhold, this.props.gameNodeURL, this.props.address, +this.state.amount, this.props.contractAddr, this.props.contractName, !this.props.toContract, this.props.withholdAddress) | ||
transferBetweenContract(this.props.needWithhold, this.props.gameNodeURL, this.props.address, +this.state.amount, this.props.contractAddr, this.props.contractName, !this.props.toContract, this.props.exercerName) | ||
.then(function (res) { | ||
@@ -86,0 +86,0 @@ _this.setState({ loading: false }); |
@@ -12,3 +12,3 @@ import * as React from 'react'; | ||
needWithhold: boolean; | ||
withholdAddress?: string; | ||
exercerName?: string; | ||
onNewTransactionSend: () => void; | ||
@@ -15,0 +15,0 @@ btyBalance: number; |
@@ -193,3 +193,3 @@ import * as tslib_1 from "tslib"; | ||
tx3 = _a.sent(); | ||
return [4 /*yield*/, signTxGroup(tx3)]; | ||
return [4 /*yield*/, signTxGroup(tx3, this.props.exercerName)]; | ||
case 7: | ||
@@ -231,3 +231,3 @@ signedTx3 = _a.sent(); | ||
tx1 = _a.sent(); | ||
return [4 /*yield*/, signTxGroup(tx1)]; // 'user.p.game.none' | ||
return [4 /*yield*/, signTxGroup(tx1, this.props.exercerName)]; // 'user.p.game.none' | ||
case 13: | ||
@@ -234,0 +234,0 @@ signedTx1 = _a.sent() // 'user.p.game.none' |
{ | ||
"name": "@33cn/game-cashier-react", | ||
"version": "1.9.13", | ||
"version": "1.9.14", | ||
"main": "lib/Cashier.js", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -64,4 +64,4 @@ # @33cn/game-cashier-react | ||
| contractAddr | string | 合约地址 | | ||
| withholdAddress | string? | 代扣地址 | | ||
| exercerName | string? | 交易组签名执行器 | | ||
| dialogVisible | boolean | 弹框是否可见 | | ||
| onClose | () => void | 点击关闭或遮罩后的回调 | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
618967