rubic-sdk
Version:
Simplify dApp creation
29 lines • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DedustTxSender = void 0;
const core_1 = require("@ton/core");
class DedustTxSender {
constructor(walletAddress, web3Private, onHash) {
this.web3Private = web3Private;
this.onHash = onHash;
this.address = core_1.Address.parse(walletAddress);
}
async send(args) {
const { to, value, body, init } = args;
const stateInit = init
? (0, core_1.beginCell)().storeWritable((0, core_1.storeStateInit)(init)).endCell().toBoc().toString('base64')
: undefined;
const message = {
address: to.toString(),
amount: value.toString(),
payload: body?.toBoc().toString('base64'),
stateInit
};
await this.web3Private.sendTransaction({
messages: [message],
onTransactionHash: this.onHash
});
}
}
exports.DedustTxSender = DedustTxSender;
//# sourceMappingURL=dedust-sender-class.js.map