Skip to content

Commit

Permalink
feat(factory client): implements factory methods on ario client for t…
Browse files Browse the repository at this point in the history
…estnet etc
  • Loading branch information
atticusofsparta committed Feb 26, 2024
1 parent e92da07 commit b102f9e
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/common/ar-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,47 @@ export class ArIO {
this.testnet = this.cache.setContractTxId(ARNS_TESTNET_REGISTRY_TX);
this.devnet = this.cache.setContractTxId(ARNS_DEVNET_REGISTRY_TX);
}

static forMainnet({
remoteCacheUrl,
}: {
remoteCacheUrl?: string;
}): ArIOContract {
return ArIO.custom({
remoteCacheUrl,
contractTxId: ARNS_TESTNET_REGISTRY_TX,
});
}
static forTestnet({
remoteCacheUrl,
}: {
remoteCacheUrl?: string;
}): ArIOContract {
return ArIO.custom({
remoteCacheUrl,
contractTxId: ARNS_TESTNET_REGISTRY_TX,
});
}
static forDevnet({
remoteCacheUrl,
}: {
remoteCacheUrl?: string;
}): ArIOContract {
// TODO: implement arlocal support
return ArIO.custom({
remoteCacheUrl,
contractTxId: ARNS_DEVNET_REGISTRY_TX,
});
}
static custom({
remoteCacheUrl,
contractTxId,
}: {
remoteCacheUrl?: string;
contractTxId: string;
}): ArIOContract {
return new ArNSRemoteCache({ url: remoteCacheUrl }).setContractTxId(
contractTxId,
);
}
}

0 comments on commit b102f9e

Please sign in to comment.