Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(PE-5825): ANT read interface #19

Merged
merged 11 commits into from
Mar 18, 2024
Merged

feat(PE-5825): ANT read interface #19

merged 11 commits into from
Mar 18, 2024

Conversation

atticusofsparta
Copy link
Contributor

No description provided.

src/common/ant.ts Outdated Show resolved Hide resolved
src/common/ant.ts Outdated Show resolved Hide resolved
src/contract-state.ts Outdated Show resolved Hide resolved
src/common/ant.ts Outdated Show resolved Hide resolved
@dtfiedler dtfiedler self-requested a review March 15, 2024 23:31
Copy link
Collaborator

@dtfiedler dtfiedler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some type cleanup - but overall looks good

} from '../types.js';
import { RemoteContract } from './contracts/remote-contract.js';

export class ANT implements ANTContract {
Copy link
Collaborator

@dtfiedler dtfiedler Mar 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can think about creating an abstract Contract class that both this and ArIO inherit - to avoid the duplicate constructor code - but no need for now, we'll stick with the composition and type pattern

Copy link
Collaborator

@dtfiedler dtfiedler Mar 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an example of how an abstract class works

abstract class Contract {
  private contract: SmartWeaveContract<ANTState>;

  constructor(config: ContractConfiguration) {
    if (isContractConfiguration<ANTState>(config)) {
      this.contract = config.contract;
    } else if (isContractTxIdConfiguration(config)) {
      this.contract = new RemoteContract<ANTState>({
        contractTxId: config.contractTxId,
      });
    }
  }

and then

export class ANT implements ANTContract extends Contract {
   constructor(config){
       super(config)
    }
    
    ....

just showing for how it could work - but again, not necessary to implement

src/contract-state.ts Outdated Show resolved Hide resolved
Comment on lines 36 to 38
export type ArIOSigner = ArweaveSigner | ArconnectSigner;
export type ContractConfiguration = {
signer?: ArIOSigner; // TODO: optionally allow JWK in place of signer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not for this PR 🥲

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woops!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
atticusofsparta and others added 2 commits March 18, 2024 11:12
Co-authored-by: Dylan Fiedler <dtfiedler@users.noreply.github.com>
src/common/ar-io.ts Outdated Show resolved Hide resolved
dtfiedler
dtfiedler previously approved these changes Mar 18, 2024
README.md Show resolved Hide resolved
README.md Outdated

## Arweave Name Tokens (ANT's)

The ANT contract class allows for fetching data given a provided ANT contract ID.
Copy link
Collaborator

@dtfiedler dtfiedler Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ANT contract client class exposes APIs relevant to compliant Arweave Name Token contract's. It can be configured to use any contract ID that adheres to the ANT contract spec. You must provide either a custom contract data provider or a contractTxId to the ANT class constructor to use.

@atticusofsparta atticusofsparta merged commit 6a0c477 into alpha Mar 18, 2024
8 checks passed
dtfiedler pushed a commit that referenced this pull request Mar 18, 2024
# [1.0.0-alpha.9](v1.0.0-alpha.8...v1.0.0-alpha.9) (2024-03-18)

### Bug Fixes

* **ario:** re-add contract default config ([2296cc3](2296cc3))
* **build:** remove redundant exported type ([134319b](134319b))
* **readme:** update ant header ([77235ce](77235ce))
* **readme:** update ANT usage description ([70c8520](70c8520))
* **signer:** remove signer, will do in other pr ([d02276d](d02276d))
* **types:** add @ to records ([53601c1](53601c1))
* **types:** remove any types ([d8d910b](d8d910b))
* **types:** use string instead of any ([014a262](014a262))

### Features

* **ant:** add ANT read interface ([c941c96](c941c96))
* **PE-5825:** ANT read interface ([#19](#19)) ([6a0c477](6a0c477))
@dtfiedler
Copy link
Collaborator

🎉 This PR is included in version 1.0.0-alpha.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@dtfiedler dtfiedler deleted the PE-5825 branch March 18, 2024 22:38
dtfiedler pushed a commit that referenced this pull request Apr 23, 2024
# 1.0.0 (2024-04-23)

### Bug Fixes

* **actions:** bump node setup action ([4eb49cd](4eb49cd))
* **actions:** freeze lockfile ([dba7313](dba7313))
* add cache config in ario constructor ([1f3c0ba](1f3c0ba))
* **ant:** add ant contract to exports ([a2ff57b](a2ff57b))
* **ant:** add signer to ant test ([4581b8d](4581b8d))
* **ant:** default evaluation options for ant apis that do not take an… ([#25](#25)) ([0c8b55d](0c8b55d))
* **ant:** default evaluation options for ant apis that do not take another parameter ([7c59033](7c59033))
* **ant:** default evaluation options for apis that do not require them ([72b57d5](72b57d5))
* **ant:** fix API for getRecords ([c714aa3](c714aa3))
* **apis:** remove epoch from distributions and observations ([7b2d279](7b2d279))
* **arbundle version:** pin version ([35ffab6](35ffab6))
* **arbundles:** update arbundles import ([f02d83f](f02d83f))
* **ario:** add cache config in ario constructor ([#11](#11)) ([ecb279d](ecb279d))
* **ario:** formatting ([c61570a](c61570a))
* **ario:** make state provider nullable and default to remote arns-service provider ([fa1cb72](fa1cb72))
* **ario:** re-add contract default config ([2296cc3](2296cc3))
* **ario:** remove unused cache property ([7f2d02e](7f2d02e))
* **build:** add setImmediate polyfill for web only ([ad36776](ad36776))
* **build:** remove redundant exported type ([134319b](134319b))
* **cache:** remove cache folder ([2ac9427](2ac9427))
* **cacheURL:** update ario cache url setting pattern to use custom url appropriately ([c76e67d](c76e67d))
* **cache:** validate arweave id before setting it ([5ba1175](5ba1175))
* **casing:** revert to lower case casing ([b5da0ab](b5da0ab))
* **comments:** make class logger private, remove comments ([7483246](7483246))
* **connect:** add init static function on ario class to create interaction classes ([765f39c](765f39c))
* **contract configuration:** return cache url as well ([b4a7bc3](b4a7bc3))
* **contract functions:** correct contract function names ([ad9bc56](ad9bc56))
* **contracts:** add configuration view method and update types ([4fae4a2](4fae4a2))
* **contracts:** remove write method and type from remote contract ([740d8b8](740d8b8))
* **contracttxid:** make contractTxID require in remote state cache instance ([dc82d21](dc82d21))
* **contracttxid:** make contractTxID required in remote state cache instance ([#10](#10)) ([bf651bb](bf651bb))
* **ctrl flow:** remove else from control flow ([4b3c4c2](4b3c4c2))
* **deps:** pin arweave ([d39391c](d39391c))
* **deps:** remove axios-retry, will implement later ([0218e95](0218e95))
* **deps:** remove extra crypto-browserify ([9b42898](9b42898))
* **deps:** remove warp-contracts-deploy from deps ([9d4f9fa](9d4f9fa))
* **docs:** remove docs folder ([47e8403](47e8403))
* **drywrite:** throw on bad drywrite and continue if successful ([5052c0a](5052c0a))
* **eslintignore:** remove old file names ([415c163](415c163))
* **eslint:** remove eslint comments and use this signer ([32530eb](32530eb))
* **esm:** add polyfills for crypto ([dd8fbfe](dd8fbfe))
* **esm:** add polyfills for crypto ([#27](#27)) ([553822c](553822c))
* **example web:** update ario instatiation ([77c6842](77c6842))
* **example:** escape quotes in packagejson for example package json ([fb47de0](fb47de0))
* **example:** simplify example and remove unused method on remote cache ([81637f8](81637f8))
* **examples:** update comments and fix package.json ([db7140b](db7140b))
* **examples:** update examples to use devnet ([cc037ac](cc037ac))
* **examples:** update examples with records methods, and balance methods ([a2d2a02](a2d2a02))
* **exports:** add arweavesigner and arconnectsigner to exports, clean up docs ([c7860ed](c7860ed))
* **exports:** update exports in indices ([f794437](f794437))
* **exports:** update package exports to have index in src folder ([2cce9e3](2cce9e3))
* **files:** clean git cache of duplicate casing ([e9eaa2d](e9eaa2d))
* **filters:** punt filters ([1c23cb3](1c23cb3))
* **fixture:** add type to arns state fixture ([5bcac32](5bcac32))
* **formating:** format ([3f30f77](3f30f77))
* **gar write:** fix types and flow on gar write ([f5e7774](f5e7774))
* **gateway:** update gateway settings to support autostake ([82c6840](82c6840))
* **generics:** use named generic ([4b647f0](4b647f0))
* **gitignore:** remove cache from gitignore ([2867abc](2867abc))
* **git:** test fix with file casing issue ([c3611ee](c3611ee))
* **headers:** use source-version for header ([2b26d88](2b26d88))
* **http:** add headers sdk headers to http config ([94810ed](94810ed))
* **husky:** add commit hooks ([885ce68](885ce68))
* **imports:** update to use indexed imports from warp ([1242568](1242568))
* **indentation:** fix indentation in examples ([a266731](a266731))
* **interface:** removed filters and added base records types ([849834d](849834d))
* **interface:** rename interface to ContractCache ([2a0a765](2a0a765))
* **jest:** remove extra config ([014fbde](014fbde))
* **lint:** disable no-any warning certain types ([de5f108](de5f108))
* **lint:** formatting ([21224e2](21224e2))
* **logger, errors, http:** Updated to axios and axios-retry, added winston logger, more extensive custom error objects ([b944f4d](b944f4d))
* **logger:** remove unused logger property ([9501d1d](9501d1d))
* **logs:** removing debug logs ([f025171](f025171))
* **mixin:** filter private methods in mixin util ([beb8610](beb8610))
* **naming:** change epoch to epochStartHeight ([908971c](908971c))
* **naming:** rename getRecord[s] to getArNSRecord[s] ([bd3d4bc](bd3d4bc))
* **overloads:** only accept warp contract as a contract config for ariowritable ([e3c97e9](e3c97e9))
* **polyfills:** rollback polyfill on logger ([0cdb2f0](0cdb2f0))
* **postinstall:** remove husky postinstall script ([c74a135](c74a135))
* **readme:** add grammar and example recs ([ecc07f7](ecc07f7))
* **readme:** condense quick start ([b35e5bd](b35e5bd))
* **readme:** refactor api list to header tags ([817d99b](817d99b))
* **readme:** update ant header ([77235ce](77235ce))
* **readme:** update ANT usage description ([70c8520](70c8520))
* **readme:** update joinNetwork docs ([9fcf440](9fcf440))
* **readme:** update quick start ([a60d96a](a60d96a))
* **readme:** update readme with default provider example ([68a5a16](68a5a16))
* **readme:** update readme with examples ([d9ee23e](d9ee23e))
* **record records:** update key to use result instead of record ([90314db](90314db))
* **records:** remove contractTxId filter remove lodash shrink readme ([50669e1](50669e1))
* **records:** use state endpoint to fetch records ([2f02c53](2f02c53))
* **recs:** modify the interfaces for contracts and implement with warp and remote service ([#13](#13)) ([56ebb08](56ebb08))
* **release:** remove release assets entirely ([9d5a1b3](9d5a1b3))
* **release:** update github release config to publish packages to github ([5534d9d](5534d9d))
* **remote:** getState not properly setting evalTo in http requests ([55745c1](55745c1))
* **safety:** update type safety checks ([32eebbc](32eebbc))
* **setimmediate:** make set immediate a build dependency as it is required by the node winston ([9292eaa](9292eaa))
* **signer:** check that contract is connected before trying to write ([d352e9c](d352e9c))
* **signer:** check that contract is connected before trying to write ([#29](#29)) ([536a116](536a116))
* **signer:** fix signer in WarpContracts - update tests ([ea9448f](ea9448f))
* **signer:** fix signer in WarpContracts - update tests ([#32](#32)) ([16d69d8](16d69d8))
* **signer:** remove jwk use, ignore web example for now ([bc7e577](bc7e577))
* **signer:** remove signer, will do in other pr ([d02276d](d02276d))
* **signer:** remove use of JWK, simplify constructor ([#22](#22)) ([d2ef573](d2ef573))
* **signer:** update ANT to have signer ([c7f8eee](c7f8eee))
* **structure:** update cache provider folder to be named caches ([844c1aa](844c1aa))
* **structure:** use snake case for file and folder names ([37f27d3](37f27d3))
* **test warp-contract:** use beforeAll to read env vars ([95cc019](95cc019))
* **tests:** add test cases as a const ([8458185](8458185))
* **tests:** add test for custom arIO client config ([0e6142b](0e6142b))
* **tests:** change control flow pattern to .catch instead of trycatch ([883de51](883de51))
* **tests:** dont make blockHeight or sortKey undefined but rather evalTo ([f76a201](f76a201))
* **tests:** instantiate new ant to connect in tests ([9869415](9869415))
* **tests:** remove dryWrite from writeInteraction, update tests ([bc1becc](bc1becc))
* **tests:** remove fixture and use live service for tests ([30d3e8c](30d3e8c))
* **tests:** test 404 response ([590dea6](590dea6))
* **tests:** update ario test ([4208bd0](4208bd0))
* **tests:** update client instantiation test to check read vs write clients ([059653c](059653c))
* **tests:** update docker compose params ([a71befd](a71befd))
* **tests:** update gateways test ([1fcb3e6](1fcb3e6))
* **tests:** update stubs in tests ([e4bbc6e](e4bbc6e))
* **tests:** update test to match jest syntax ([553bdbb](553bdbb))
* **tests:** update tests for named prop expectation ([4ea04a7](4ea04a7))
* **tests:** update tests to use younger contract, add evalParams config ([ae890c8](ae890c8))
* **tests:** update tests with constants and update types ([1bdcfeb](1bdcfeb))
* **tests:** update tests with new name ([2cd1b5c](2cd1b5c))
* **tests:** update with new names on methods ([619c193](619c193))
* **tests:** use angela for testing ([10f30fe](10f30fe))
* **tests:** use http not https in tests ([fddba1e](fddba1e))
* **tests:** use process vars as priority url ([faab4f3](faab4f3))
* **test:** update test to use ArweaveTransactionID class ([f6c4f8b](f6c4f8b))
* **tsconfig, names:** reverted tsconfig to nodenext resolution, changed naming convention on provider, removed extraeneous error classes, rolled back axios-retry to match our tsconfig settings ([d412d44](d412d44))
* **tyeps:** set types to objects rather than top level params for easier readability ([edfd77b](edfd77b))
* **type:** rename all type implementations ([5959045](5959045))
* **types and tests:** update evalTo to allow undefined sortKey and block and test that ([a59f05c](a59f05c))
* **types:** add @ to records ([53601c1](53601c1))
* **types:** make props nullable on certain read apis ([f8ff552](f8ff552))
* **types:** remove any type ([5c80242](5c80242))
* **types:** remove any types ([d8d910b](d8d910b))
* **types:** remove ArweaveTransactionID type for now ([3adf53b](3adf53b))
* **types:** remove unnecesssary empty defaults ([7d14edb](7d14edb))
* **types:** rename signer to ContractSigner ([87d6c90](87d6c90))
* **types:** require atleast one param to update gateway settings ([857ebdc](857ebdc))
* **types:** update interaction type to only use read for now ([2c02e90](2c02e90))
* **types:** update tests, readme, and types ([e9985dd](e9985dd))
* **types:** use partial write type ([fa6a638](fa6a638))
* **types:** use string instead of any ([014a262](014a262))
* **validate id:** make validator a private method ([dce4a94](dce4a94))
* **validity util:** isBlockheight check more strict ([2b28675](2b28675))
* **warp contract:** added test for getting state after connecting with warp ([060ee2c](060ee2c))
* **warp-contract:** provide logger - update isTransaction flow ctrl - use typed props ([5f6e0a1](5f6e0a1))
* **warp-contracts:** bump warp to 1.4.38 - fixed warp exports ([af4a20b](af4a20b))
* **winston:** move the winston polyfill - this will prevent any esm based web projects from getting polyfill issues ([c8b7998](c8b7998))
* **write:** add dry run - sync state - abortSignal - update interface ([970bdef](970bdef))
* **write:** update utils - change error flow - update arweave constructor props ([0a81c92](0a81c92))
* **write:** update write methods on warp ([9c0540b](9c0540b))
* **yarn:** update lockfile ([fd5e0ee](fd5e0ee))

### Features

* **ant:** add ANT read interface ([c941c96](c941c96))
* **ant:** create ant contract class for interacting with ant contracts ([6eb7ef5](6eb7ef5))
* **ants:** add readable-writable framework to the ant client and implement write methods ([3019f53](3019f53))
* **ario contract:** add distributions and observation apis ([21e38d1](21e38d1))
* **arioContract:** update ArIO interface and ArIOContract interface ([5d87e2e](5d87e2e))
* **auctions:** add auctions apis ([faf08c5](faf08c5))
* **contract:** add distribution, observations apis, update readme and examples ([0208317](0208317))
* **contract:** create new contract classes that impelement both warp and remote cache for ant contract and ar-io contracts ([855da2d](855da2d))
* **first issue:** setup examples, readme, and initial gateways provider ([5a9e232](5a9e232))
* **gar methods:** add gar write methods to the ario client ([e01b08b](e01b08b))
* **inital providers:** scaffold initial providers ([4949514](4949514))
* **io transfer:** add transfer api to ario writable client ([0d37623](0d37623))
* **observerations:** add `saveObservations` write interaction ([8dd977c](8dd977c))
* **observers:** add API for fetching prescribed observers ([a18e130](a18e130))
* **observers:** add API for fetching prescribed observers ([#17](#17)) ([17ce6de](17ce6de))
* **PE-5742:** add records api to arns remote cache ([#8](#8)) ([c46cd39](c46cd39))
* **PE-5751:** add blockheight and sortkey eval filters ([#12](#12)) ([832a1ad](832a1ad))
* **PE-5758:** add signer to ario class ([#20](#20)) ([1b82077](1b82077))
* **PE-5759:** observations and distributions apis ([#16](#16)) ([dded361](dded361))
* **PE-5773:** add auctions read apis ([#18](#18)) ([e0c6fca](e0c6fca))
* **PE-5800:** add epoch apis ([48ee4ba](48ee4ba))
* **PE-5800:** epoch apis ([#15](#15)) ([70563b1](70563b1))
* **PE-5825:** ANT read interface ([#19](#19)) ([6a0c477](6a0c477))
* **records:** add records api to arns remote cache ([1b7f54f](1b7f54f))
* **signer:** add arweave signer to ario class ([7e08097](7e08097))
* **write:** add write interface and base implementation on warp-contract ([6dfc969](6dfc969))
@dtfiedler
Copy link
Collaborator

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants