Low vs High level API
Last updated
Was this helpful?
Last updated
Was this helpful?
AeSdk
is a general, high-level interface that wraps multiple low-level interfaces. A general interface is preferred for its simplicity and resilience to breaking changes.
But there is also low-level interfaces. It's excellent for additional control, and as a teaching tool to understand the underlying operations. Most real-world requirements involves a series of low-level operations, so the SDK provides abstractions for these.
The aeternity node exposes . This API is described in the . SDK uses this document to generate a TypeScript client. The result client (implemented in ) a basically a mapping of all node endpoints as functions.
So to get a transaction based on its hash you would invoke node.getTransactionByHash('th_fWEsg152BNYcrqA9jDh9VVpacYojCUb1yu45zUnqhmQ3dAAC6')
. In this way the SDK is simply a mapping of the raw API calls into JavaScript.
Any blockchain state change requires signing a transaction. Transaction should be built according to the . SDK implements it in , , and . requires fewer arguments than , but it expects the node instance provided in arguments.
Example spend call, using æternity's SDK abstraction:
The same spend execution, but using low-level SDK functions: