locklift
Version:
Node JS framework for working with Ever contracts. Inspired by Truffle and Hardhat. Helps you to build, test, run and maintain your smart contracts.
53 lines (52 loc) • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestnetGiver = exports.GiverFromAccount = void 0;
class GiverFromAccount {
ever;
account;
constructor(ever, account) {
this.ever = ever;
this.account = account;
}
sendTo(sendTo, value) {
return this.ever.sendMessage({
bounce: false,
amount: value,
sender: this.account,
recipient: sendTo,
});
}
}
exports.GiverFromAccount = GiverFromAccount;
class TestnetGiver {
keyPair;
giverContract;
constructor(ever, keyPair, address) {
this.keyPair = keyPair;
this.giverContract = new ever.Contract(testnetGiverAbi, address);
}
async sendTo(sendTo, value) {
return this.giverContract.methods
.sendGrams({
dest: sendTo,
amount: value,
})
.sendExternal({ publicKey: this.keyPair.publicKey });
}
}
exports.TestnetGiver = TestnetGiver;
const testnetGiverAbi = {
"ABI version": 2,
header: ["pubkey", "time", "expire"],
functions: [
{
name: "sendGrams",
inputs: [
{ name: "dest", type: "address" },
{ name: "amount", type: "uint64" },
],
outputs: [],
},
],
events: [],
};