Skip to content

Commit

Permalink
Merge pull request #120 from ar-io/PE-6241-ant-apis
Browse files Browse the repository at this point in the history
feat(ants): support ANT apis in SDK
  • Loading branch information
dtfiedler authored Jun 18, 2024
2 parents 5ead196 + ec67440 commit c4c10e7
Show file tree
Hide file tree
Showing 12 changed files with 556 additions and 23 deletions.
22 changes: 21 additions & 1 deletion examples/esm/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IO, ioDevnetProcessId } from '@ar.io/sdk';
import { ANT, IO, ioDevnetProcessId } from '@ar.io/sdk';

(async () => {
const arIO = IO.init({
Expand Down Expand Up @@ -26,4 +26,24 @@ import { IO, ioDevnetProcessId } from '@ar.io/sdk';
},
{ depth: 2 },
);

// io ant
const ant = ANT.init({
processId: 'LGN8MUAMvTvr6i-WGdXBu1z9jz01LZVnVwklp9z7D6U',
});
const antRecords = await ant.getRecords();
const rootRecord = await ant.getRecord({ undername: '@' });
const owner = await ant.getOwner();
const controllers = await ant.getControllers();
const info = await ant.getInfo();
console.dir(
{
antRecords,
rootRecord,
controllers,
info,
owner,
},
{ depth: 2 },
);
})();
3 changes: 2 additions & 1 deletion src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export type SortKey = string;
export type Timestamp = number;
export type WalletAddress = string;
export type TransactionId = string;
export type ProcessId = string;

export type DataProtocolTransaction = Pick<
GQLNodeInterface,
Expand All @@ -56,7 +57,7 @@ export type WithSigner<T = NonNullable<unknown>> = {
signer: ContractSigner;
} & T; // TODO: optionally allow JWK in place of signer
export type OptionalSigner<T = NonNullable<unknown>> = {
signer?: ContractSigner;
signer?: ContractSigner | undefined;
} & T;
export type ContractConfiguration<T = NonNullable<unknown>> =
| {
Expand Down
Loading

0 comments on commit c4c10e7

Please sign in to comment.