Skip to content

Commit

Permalink
feat: dip721 with namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed Apr 17, 2024
1 parent b951cc8 commit 96be0ac
Show file tree
Hide file tree
Showing 11 changed files with 391 additions and 352 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ethers-contract = { version = "2", default-features = false, features = [
ethers-core = "2"
ethers-signers = "2"
ethnum = "1"
dip721-rs = "0.1"
dip721-rs = "0.2"
getrandom = { version = "0.2", features = ["custom"] }
hex = "0.4"
ic-cdk = "0.12"
Expand Down
2 changes: 1 addition & 1 deletion docs/canisters/deferred.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

## Introduction

Deferred is a canister which provides a **Non-fungible Token (NFT)** which implements the **DIP-721** Standard <https://github.com/Psychedelic/DIP721/blob/develop/spec.md>.
Deferred is a canister which provides a **Non-fungible Token (NFT)** which implements the **DIP-721** Standard <https://github.com/Psychedelic/DIP721/blob/develop/spec.md> with the `dip721_` namespace.

The Deferred canister takes care of registering the sell or financing of a real estate between two or more parts, **Buyers** and **Sellers**. This agreement between parts is called **Contract**.

Expand Down
8 changes: 4 additions & 4 deletions integration-tests/src/client/deferred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl<'a> DeferredClient<'a> {
.query(
self.env.deferred_id,
admin(),
"total_supply",
"dip721_total_supply",
Encode!(&()).unwrap(),
)
.unwrap();
Expand All @@ -162,7 +162,7 @@ impl<'a> DeferredClient<'a> {
.query(
self.env.deferred_id,
alice(),
"token_metadata",
"dip721_token_metadata",
Encode!(&token_id).unwrap(),
)
.unwrap();
Expand All @@ -189,7 +189,7 @@ impl<'a> DeferredClient<'a> {
.update::<()>(
self.env.deferred_id,
admin(),
"set_custodians",
"dip721_set_custodians",
Encode!(&principals).unwrap(),
)
.unwrap();
Expand All @@ -206,7 +206,7 @@ impl<'a> DeferredClient<'a> {
.update(
self.env.deferred_id,
caller,
"transfer_from",
"dip721_transfer_from",
Encode!(&from, &to, &id).unwrap(),
)
.unwrap()
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/tests/inspect/deferred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn test_should_inspect_is_custodian() {
.update::<()>(
env.deferred_id,
alice(),
"set_name",
"dip721_set_name",
Encode!(&"new name").unwrap(),
)
.is_ok());
Expand All @@ -68,7 +68,7 @@ fn test_should_inspect_is_custodian_not_custodian() {
.update::<()>(
env.deferred_id,
admin(),
"set_name",
"dip721_set_name",
Encode!(&"new name").unwrap(),
)
.is_err());
Expand Down Expand Up @@ -584,7 +584,7 @@ fn test_should_inspect_burn() {
.update::<Result<Nat, NftError>>(
env.deferred_id,
bob(),
"burn",
"dip721_burn",
Encode!(&token_id).unwrap(),
)
.is_ok());
Expand Down
81 changes: 42 additions & 39 deletions src/declarations/deferred/deferred.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ export type Result_4 = { 'Ok' : Array<bigint> } |
{ 'Err' : NftError };
export type Result_5 = { 'Ok' : Array<TokenMetadata> } |
{ 'Err' : NftError };
export type Result_6 = { 'Ok' : bigint } |
{ 'Err' : DeferredError };
export type Result_7 = { 'Ok' : TokenMetadata } |
export type Result_6 = { 'Ok' : TokenMetadata } |
{ 'Err' : NftError };
export type Result_8 = { 'Ok' : TxEvent } |
export type Result_7 = { 'Ok' : TxEvent } |
{ 'Err' : NftError };
export type Result_8 = { 'Ok' : bigint } |
{ 'Err' : DeferredError };
export type Role = { 'Custodian' : null } |
{ 'Agent' : null };
export interface Seller { 'principal' : Principal, 'quota' : number }
Expand Down Expand Up @@ -282,11 +282,43 @@ export interface _SERVICE {
'admin_set_ekoke_reward_pool_canister' : ActorMethod<[Principal], undefined>,
'admin_set_marketplace_canister' : ActorMethod<[Principal], undefined>,
'admin_set_role' : ActorMethod<[Principal, Role], undefined>,
'approve' : ActorMethod<[Principal, bigint], Result_1>,
'balance_of' : ActorMethod<[Principal], Result_1>,
'burn' : ActorMethod<[bigint], Result_1>,
'custodians' : ActorMethod<[], Array<Principal>>,
'cycles' : ActorMethod<[], bigint>,
'dip721_approve' : ActorMethod<[Principal, bigint], Result_1>,
'dip721_balance_of' : ActorMethod<[Principal], Result_1>,
'dip721_burn' : ActorMethod<[bigint], Result_1>,
'dip721_custodians' : ActorMethod<[], Array<Principal>>,
'dip721_cycles' : ActorMethod<[], bigint>,
'dip721_is_approved_for_all' : ActorMethod<[Principal, Principal], Result_2>,
'dip721_logo' : ActorMethod<[], [] | [string]>,
'dip721_metadata' : ActorMethod<[], Metadata>,
'dip721_mint' : ActorMethod<
[Principal, bigint, Array<[string, GenericValue]>],
Result_1
>,
'dip721_name' : ActorMethod<[], [] | [string]>,
'dip721_operator_of' : ActorMethod<[bigint], Result_3>,
'dip721_operator_token_identifiers' : ActorMethod<[Principal], Result_4>,
'dip721_operator_token_metadata' : ActorMethod<[Principal], Result_5>,
'dip721_owner_of' : ActorMethod<[bigint], Result_3>,
'dip721_owner_token_identifiers' : ActorMethod<[Principal], Result_4>,
'dip721_owner_token_metadata' : ActorMethod<[Principal], Result_5>,
'dip721_set_approval_for_all' : ActorMethod<[Principal, boolean], Result_1>,
'dip721_set_custodians' : ActorMethod<[Array<Principal>], undefined>,
'dip721_set_logo' : ActorMethod<[string], undefined>,
'dip721_set_name' : ActorMethod<[string], undefined>,
'dip721_set_symbol' : ActorMethod<[string], undefined>,
'dip721_stats' : ActorMethod<[], Stats>,
'dip721_supported_interfaces' : ActorMethod<[], Array<SupportedInterface>>,
'dip721_symbol' : ActorMethod<[], [] | [string]>,
'dip721_token_metadata' : ActorMethod<[bigint], Result_6>,
'dip721_total_supply' : ActorMethod<[], bigint>,
'dip721_total_transactions' : ActorMethod<[], bigint>,
'dip721_total_unique_holders' : ActorMethod<[], bigint>,
'dip721_transaction' : ActorMethod<[bigint], Result_7>,
'dip721_transfer' : ActorMethod<[Principal, bigint], Result_1>,
'dip721_transfer_from' : ActorMethod<
[Principal, Principal, bigint],
Result_1
>,
'get_agencies' : ActorMethod<[], Array<Agency>>,
'get_contract' : ActorMethod<[bigint], [] | [Contract]>,
'get_restricted_contract_properties' : ActorMethod<
Expand All @@ -298,38 +330,9 @@ export interface _SERVICE {
'get_unsigned_contracts' : ActorMethod<[], Array<bigint>>,
'http_request' : ActorMethod<[HttpRequest], HttpResponse>,
'increment_contract_value' : ActorMethod<[bigint, bigint, bigint], Result>,
'is_approved_for_all' : ActorMethod<[Principal, Principal], Result_2>,
'logo' : ActorMethod<[], [] | [string]>,
'metadata' : ActorMethod<[], Metadata>,
'mint' : ActorMethod<
[Principal, bigint, Array<[string, GenericValue]>],
Result_1
>,
'name' : ActorMethod<[], [] | [string]>,
'operator_of' : ActorMethod<[bigint], Result_3>,
'operator_token_identifiers' : ActorMethod<[Principal], Result_4>,
'operator_token_metadata' : ActorMethod<[Principal], Result_5>,
'owner_of' : ActorMethod<[bigint], Result_3>,
'owner_token_identifiers' : ActorMethod<[Principal], Result_4>,
'owner_token_metadata' : ActorMethod<[Principal], Result_5>,
'register_contract' : ActorMethod<[ContractRegistration], Result_6>,
'register_contract' : ActorMethod<[ContractRegistration], Result_8>,
'remove_agency' : ActorMethod<[Principal], Result>,
'set_approval_for_all' : ActorMethod<[Principal, boolean], Result_1>,
'set_custodians' : ActorMethod<[Array<Principal>], undefined>,
'set_logo' : ActorMethod<[string], undefined>,
'set_name' : ActorMethod<[string], undefined>,
'set_symbol' : ActorMethod<[string], undefined>,
'sign_contract' : ActorMethod<[bigint], Result>,
'stats' : ActorMethod<[], Stats>,
'supported_interfaces' : ActorMethod<[], Array<SupportedInterface>>,
'symbol' : ActorMethod<[], [] | [string]>,
'token_metadata' : ActorMethod<[bigint], Result_7>,
'total_supply' : ActorMethod<[], bigint>,
'total_transactions' : ActorMethod<[], bigint>,
'total_unique_holders' : ActorMethod<[], bigint>,
'transaction' : ActorMethod<[bigint], Result_8>,
'transfer' : ActorMethod<[Principal, bigint], Result_1>,
'transfer_from' : ActorMethod<[Principal, Principal, bigint], Result_1>,
'update_contract_buyers' : ActorMethod<[bigint, Array<Principal>], Result>,
'update_contract_property' : ActorMethod<
[bigint, string, GenericValue],
Expand Down
Loading

0 comments on commit 96be0ac

Please sign in to comment.