Skip to main content

🔶 Interface

Github: packages/nftanvil_canisters/mo/type/pwr_interface.mo

import Pwr "mo:anvil/type/pwr_interface"
module {
...

public type Interface = actor {
balance : query BalanceRequest -> async BalanceResponse;
pwr_transfer : shared TransferRequest -> async TransferResponse;
balanceAddExternal : shared ({#anv; #pwr}, AccountIdentifier, Balance) -> async ();
pwr_withdraw : shared WithdrawRequest -> async WithdrawResponse;
pwr_purchase_intent : shared PurchaseIntentRequest -> async PurchaseIntentResponse;
pwr_purchase_claim : shared PurchaseClaimRequest -> async PurchaseClaimResponse;
nft_mint : shared (slot: Nft.CanisterSlot, request: Nft.MintRequest) -> async Nft.MintResponse;
};


public type BalanceRequest = {
user: Nft.User;
};

public type BalanceResponse = {
pwr : Balance;
anv : Balance;
oracle : Nft.Oracle;
};

public type PurchaseIntentRequest = {
user : User;
subaccount: ?SubAccount;
};

public type PurchaseIntentResponse = Result.Result<
AccountIdentifier,
Text
>;

public type PurchaseClaimRequest = {
user : User;
subaccount : ?SubAccount;
};

public type PurchaseClaimResponse = Result.Result<
{transactionId: Blob}, {
#PaymentTooSmall; // if it's smaller than Ledger ICP transfer fee we can't move it to main account and use that value at all
#Ledger: Ledger.TransferError
}
>;

public type Currency = {#anv; #pwr};

public type TransferRequest = {
from : User;
to : User;
amount : Balance;
memo : Memo;
subaccount : ?SubAccount;
};


public type TransferResponse = Result.Result<{transactionId: Blob}, Nft.TransferResponseError>;

public type WithdrawRequest = Treasury.WithdrawRequest;
public type WithdrawResponse = Treasury.WithdrawResponse;

public type AccountIdentifier = Nft.AccountIdentifier;
public type Balance = Nft.Balance;
public type User = Nft.User;
public type SubAccount = Nft.SubAccount;
public type Memo = Nft.Memo;

...
}