-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmint.ts
35 lines (29 loc) · 904 Bytes
/
mint.ts
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
import { MINTING_COST } from "../../constants";
import { MakeOfferCallback } from "../../interfaces";
import { formOfferResultCallback } from "../../util/contract-callbacks";
interface MintCharacter {
name: string;
service: {
kreadInstance: any;
istBrand: any;
makeOffer: any;
};
callback: MakeOfferCallback;
}
export const mintCharacter = async ({ name, service, callback }: MintCharacter): Promise<void> => {
const instance = service.kreadInstance;
const spec = {
source: "contract",
instance,
publicInvitationMaker: "makeMintCharacterInvitation",
};
const offerArgs = {
name: name,
};
const give = { Price: { brand: service.istBrand, value: BigInt(MINTING_COST) } };
const proposal = {
give,
};
if (callback.setIsLoading) callback.setIsLoading(true);
service.makeOffer(spec, proposal, offerArgs, formOfferResultCallback(callback));
};