Skip to content

transferNFT Internal Action

Nilson Lazarin edited this page Sep 11, 2024 · 2 revisions
Internal Actions Wiki

.velluscinum.tranferNFT

Transfers a Non-Fungible-Token and returns a belief like: b(A);

DESCRIPTION

.velluscinum.transferNFT(S,P,Q,N,R,M,b);
Parameters Description
b It's a belief that represents the result of an operation in DLT.
M It's a key-value array representing asset or transaction metadata.
N It's a is a literal that represents a Non-Fungible-Token.
P It's a literal that represents the agent's private key.
Q It's a literal that represents the agent's public key.
R It's a literal that represents the public key of a recipient agent.
S It's a literal that represents the address of a DLT node.

EXAMPLE

  • Agent alice

     /* Plans */
     +!start[source(Agent)] <- 
     	.velluscinum.buildWallet(myWallet);
     	.wait(myWallet(P,Q));
     	.send(Agent,achieve,transferNFT(P));
     .
  • Agent Bob

     /* Initial beliefs and rules */
     bigChainDB("http://testchain.chon.group:9984/").
     transactionInformation("key_0:value_0;key_1:value_1;key_n:value_n").
    
     /* Initial goals */
     !buildNFT.
    
     /* Plans */
     +!buildNFT <- 
     	.velluscinum.buildWallet(myWallet);
     	.wait(myWallet(P,Q));
     	?bigChainDB(S);
     	.velluscinum.deployNFT(S,P,Q,"k0:v0;k1:v1;kn:vn","k0:v0;k1:v1;kn:vn",myNFT);
     	.broadcast(achieve,start);
     .
    
     +!transferNFT(Destination)[source(Agent)]<-
     	?myWallet(P,Q);
     	?myNFT(NFTid);
     	?bigChainDB(S);
     	?transactionInformation(INFO);
     	.velluscinum.transferNFT(S,P,Q,NFTid,Destination,INFO,transaction);
     	.wait(transaction(T));
     	.print("NFT transfered to ",Agent," --> ",S,"api/v1/transactions/",T);
     .