-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
139 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { IDL } from '@dfinity/candid'; | ||
import { nat64 } from '../candid/types/primitive/nats/nat64'; | ||
|
||
/** | ||
* Gets the amount of funds available in the canister | ||
* @returns the number of cycles in the canister | ||
*/ | ||
export function canisterBalance(): bigint { | ||
export function canisterBalance(): nat64 { | ||
const canisterBalanceCandidBytes = globalThis._azleIc.canisterBalance(); | ||
return IDL.decode([IDL.Nat64], canisterBalanceCandidBytes)[0]; | ||
return BigInt( | ||
IDL.decode([IDL.Nat64], canisterBalanceCandidBytes)[0] as number | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import { IDL } from '@dfinity/candid'; | ||
import { nat } from '../candid/types/primitive/nats/nat'; | ||
|
||
/** | ||
* Gets the amount of funds available in the canister | ||
* @returns the number of cycles in the canister | ||
*/ | ||
export function canisterBalance128(): bigint { | ||
export function canisterBalance128(): nat { | ||
const canisterBalance128CandidBytes = | ||
globalThis._azleIc.canisterBalance128(); | ||
return IDL.decode([IDL.Nat], canisterBalance128CandidBytes)[0]; | ||
return BigInt( | ||
IDL.decode([IDL.Nat], canisterBalance128CandidBytes)[0] as number | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import { IDL } from '@dfinity/candid'; | ||
import { nat64 } from '../candid/types/primitive/nats/nat64'; | ||
|
||
/** | ||
* Returns the canister version number | ||
* | ||
* @returns the version number | ||
*/ | ||
export function canisterVersion(): bigint { | ||
export function canisterVersion(): nat64 { | ||
const canisterVersionCandidBytes = globalThis._azleIc.canisterVersion(); | ||
return IDL.decode([IDL.Nat64], canisterVersionCandidBytes)[0]; | ||
return BigInt( | ||
IDL.decode([IDL.Nat64], canisterVersionCandidBytes)[0] as number | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
import { IDL } from '@dfinity/candid'; | ||
import { nat64 } from '../candid/types/primitive/nats/nat64'; | ||
import { nat } from '../candid/types/primitive/nats/nat'; | ||
|
||
/** | ||
* Moves cycles from the call to the canister balance | ||
* @param maxAmount the max amount of cycles to move | ||
* @returns the actual amount moved | ||
*/ | ||
export function msgCyclesAccept128(maxAmount: nat64): bigint { | ||
export function msgCyclesAccept128(maxAmount: nat): nat { | ||
const maxAmountCandidBytes = new Uint8Array( | ||
IDL.encode([IDL.Nat], [maxAmount]) | ||
).buffer; | ||
|
||
const msgCyclesAccept128CandidBytes = | ||
globalThis._azleIc.msgCyclesAccept128(maxAmountCandidBytes); | ||
|
||
return IDL.decode([IDL.Nat], msgCyclesAccept128CandidBytes)[0]; | ||
return BigInt( | ||
IDL.decode([IDL.Nat], msgCyclesAccept128CandidBytes)[0] as number | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { IDL } from '@dfinity/candid'; | ||
import { nat64 } from '../candid/types/primitive/nats/nat64'; | ||
|
||
/** | ||
* Returns the amount of cycles that were transferred by the caller of the | ||
* current call, and is still available in this message | ||
* @returns the amount of cycles | ||
*/ | ||
export function msgCyclesAvailable(): bigint { | ||
export function msgCyclesAvailable(): nat64 { | ||
const msgCyclesAvailableCandidBytes = | ||
globalThis._azleIc.msgCyclesAvailable(); | ||
|
||
return IDL.decode([IDL.Nat64], msgCyclesAvailableCandidBytes)[0]; | ||
return BigInt( | ||
IDL.decode([IDL.Nat64], msgCyclesAvailableCandidBytes)[0] as number | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { IDL } from '@dfinity/candid'; | ||
import { nat } from '../candid/types/primitive/nats/nat'; | ||
|
||
/** | ||
* Returns the amount of cycles that were transferred by the caller of the | ||
* current call, and is still available in this message | ||
* @returns the amount of cycles | ||
*/ | ||
export function msgCyclesAvailable128(): bigint { | ||
export function msgCyclesAvailable128(): nat { | ||
const msgCyclesAvailable128CandidBytes = | ||
globalThis._azleIc.msgCyclesAvailable128(); | ||
|
||
return IDL.decode([IDL.Nat], msgCyclesAvailable128CandidBytes)[0]; | ||
return BigInt( | ||
IDL.decode([IDL.Nat], msgCyclesAvailable128CandidBytes)[0] as number | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import { IDL } from '@dfinity/candid'; | ||
import { nat64 } from '../candid/types/primitive/nats/nat64'; | ||
|
||
/** | ||
* Returns the amount of cycles that came back with the response as a refund. | ||
* The refund has already been added to the canister balance automatically. | ||
* @returns the amount of cycles | ||
*/ | ||
export function msgCyclesRefunded() { | ||
export function msgCyclesRefunded(): nat64 { | ||
const msgCyclesRefundedCandidBytes = globalThis._azleIc.msgCyclesRefunded(); | ||
|
||
return IDL.decode([IDL.Nat64], msgCyclesRefundedCandidBytes)[0]; | ||
return BigInt( | ||
IDL.decode([IDL.Nat64], msgCyclesRefundedCandidBytes)[0] as number | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { IDL } from '@dfinity/candid'; | ||
import { nat } from '../candid/types/primitive/nats/nat'; | ||
|
||
/** | ||
* Returns the amount of cycles that came back with the response as a refund. | ||
* The refund has already been added to the canister balance automatically. | ||
* @returns the amount of cycles | ||
*/ | ||
export function msgCyclesRefunded128(): bigint { | ||
export function msgCyclesRefunded128(): nat { | ||
const msgCyclesRefunded128CandidBytes = | ||
globalThis._azleIc.msgCyclesRefunded128(); | ||
|
||
return IDL.decode([IDL.Nat], msgCyclesRefunded128CandidBytes)[0]; | ||
return BigInt( | ||
IDL.decode([IDL.Nat], msgCyclesRefunded128CandidBytes)[0] as number | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.