Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 6x 6x 6x 6x 6x 1x 1x 3x | import { Keypair } from "shelter-sdk";
import type { Client as SAC } from "sac-sdk";
import { Shelter } from "../shelter/shelter";
import { Rpc } from "../rpc/rpc";
import type { Pass } from "../pass/pass.interface";
import { Transfer } from "../transfer/transfer";
import { FakeSAC } from "../fake-sac/fake-sac";
import { Transaction } from "../transaction/transaction";
export class Aid {
constructor(
private readonly _recipient: Keypair,
private readonly _sponsor: Keypair,
private readonly _token: SAC | FakeSAC,
private readonly _shelter: Shelter,
private readonly _rpc: Rpc
) { }
async bound(amount: bigint, expiration: bigint): Promise<void> {
await this._shelter.boundAid(
this._recipient.rawPublicKey(),
this._token.options.contractId,
amount,
expiration
);
}
async unbound(): Promise<void> {
await this._shelter.unboundAid(
this._recipient.rawPublicKey(),
this._token.options.contractId,
);
}
async transfer(to: string, amount: bigint, pass: Pass) {
await new Transaction(
await new Transfer(this._shelter.id(), to, amount, this._token).value(
pass
),
this._sponsor,
this._rpc,
"Transfer Aid Error",
true
).result();
}
}
|