forked from dfinity/canister-profiling
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Azle Implementation of DIP721 NFT example
- Loading branch information
Showing
6 changed files
with
511 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { State } from "./types"; | ||
|
||
export function state(): State { | ||
return { | ||
nfts: [], | ||
custodians: new Set(), | ||
operators: new Map(), | ||
logo: { | ||
logo_type: "", | ||
data: "", | ||
}, | ||
name: "", | ||
symbol: "", | ||
txid: 0n, | ||
nextTxid() { | ||
return ++this.txid; | ||
}, | ||
}; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
service: (record {logo:record {data:text; logo_type:text}; name:text; custodians:opt vec principal; symbol:text}) -> { | ||
approveDip721: (principal, nat64) -> (variant {Ok:nat; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
balanceOfDip721: (principal) -> (nat64) query; | ||
burnDip721: (nat64) -> (variant {Ok:nat; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
isApprovedForAllDip721: (principal) -> (bool) query; | ||
is_custodian: (principal) -> (bool) query; | ||
mintDip721: (principal, vec record {data:vec nat8; key_val_data:vec record {text; variant {Nat64Content:nat64; Nat32Content:nat32; Nat8Content:nat8; NatContent:nat; Nat16Content:nat16; BlobContent:vec nat8; TextContent:text}}; purpose:variant {Preview; Rendered}}) -> (variant {Ok:record {id:nat; token_id:nat64}; Err:variant {Unauthorized}}); | ||
nameDip721: () -> (text) query; | ||
ownerOfDip721: (nat64) -> (variant {Ok:principal; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}) query; | ||
safeTransferFromDip721: (principal, principal, nat64) -> (variant {Ok:nat; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
safeTransferFromNotifyDip721: (principal, principal, nat64, vec nat8) -> (variant {Ok:nat; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
setApprovalForAllDip721: (principal, bool) -> (variant {Ok:nat; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
set_custodian: (principal, bool) -> (variant {Ok:bool; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
set_logo: (record {data:text; logo_type:text}) -> (variant {Ok:bool; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
set_name: (text) -> (variant {Ok:bool; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
set_symbol: (text) -> (variant {Ok:bool; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
supportedInterfacesDip721: () -> (vec variant {Burn; Mint; Approval; TransactionHistory; TransferNotification}) query; | ||
symbolDip721: () -> (text) query; | ||
totalSupplyDip721: () -> (nat64) query; | ||
transferFromDip721: (principal, principal, nat64) -> (variant {Ok:nat; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
transferFromNotifyDip721: (principal, principal, nat64, vec nat8) -> (variant {Ok:nat; Err:variant {ZeroAddress; InvalidTokenId; Unauthorized; Other}}); | ||
} |
Oops, something went wrong.