Skip to content

Latest commit

 

History

History
72 lines (47 loc) · 1.68 KB

File metadata and controls

72 lines (47 loc) · 1.68 KB

4.4 documentList(sent/received)

Use cases

Get the document's list sent from an acccount.

Get the document's list received from an acccount.

Tools

The Commercio SDK, our own open source tool to format transactions to Commercio.network

Functions and APIs

  • DocsHelper getSendDocuments;
  • DocsHelper getReceivedDocuments.

Step by step sequence

  1. Generate the wallet;
  2. Execute the DocsHelper getSendDocuments function to get the sent document's list;
  3. Execute DocsHelper getReceivedDocuments function to get the received document's list.

Code Examples

Here's an example of the implemetation in all the available languages.

Dart

final wallet = Wallet.derive(mnemonic, networkInfo);

final sentDocs = await DocsHelper.getSendDocuments(
  "did:com:1z6ezqssnqqc6un3henna0flr05aukcwcr5ge6t",
  wallet,
);

final receivedDocs = await DocsHelper.getReceivedDocuments(
  "did:com:1z6ezqssnqqc6un3henna0flr05aukcwcr5ge6t",
  wallet,
);

Kotlin

val wallet = Wallet.derive(mnemonic = mnemonic, networkInfo = networkInfo)

val sentDocs = DocsHelper.getSentDocuments(
    address = Did(wallet.bech32Address), 
    wallet = wallet
)

val receivedDocs = DocsHelper.getReceivedDocuments(
    address = Did(wallet.bech32Address),  
    wallet =wallet
)

C#

var wallet = commercio.sacco.lib.Wallet.derive(mnemonic, networkInfo);

var sentDocsURL = $"{wallet.networkInfo.lcdUrl}/docs/{wallet.bech32Address}/sent";

var sentDocs = commercio.sdk.Network.queryChain(sentDocsURL);

var receivedDocsURL = $"{wallet.networkInfo.lcdUrl}/docs/{wallet.bech32Address}/received";

var receivedDocs = commercio.sdk.Network.queryChain(receivedDocsURL);