From 582877b468baf5d8f4c94cc9983e0633427f0837 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 18 Mar 2024 22:32:02 +0000 Subject: [PATCH 1/4] chore(release): 1.0.0-alpha.9 [skip ci] # [1.0.0-alpha.9](https://github.com/ar-io/ar-io-sdk/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2024-03-18) ### Bug Fixes * **ario:** re-add contract default config ([2296cc3](https://github.com/ar-io/ar-io-sdk/commit/2296cc3e152c136e2df45481340a625a80a0be3f)) * **build:** remove redundant exported type ([134319b](https://github.com/ar-io/ar-io-sdk/commit/134319b8707cd479dc91d6832bf078bdb5c5e886)) * **readme:** update ant header ([77235ce](https://github.com/ar-io/ar-io-sdk/commit/77235ce077ef4a12dfa6b403968b6ab148ebf196)) * **readme:** update ANT usage description ([70c8520](https://github.com/ar-io/ar-io-sdk/commit/70c852087f75a17c494cc12719d1dc9f96da39f2)) * **signer:** remove signer, will do in other pr ([d02276d](https://github.com/ar-io/ar-io-sdk/commit/d02276dd9fa166d254eb76a45e2c6025f632c0ba)) * **types:** add @ to records ([53601c1](https://github.com/ar-io/ar-io-sdk/commit/53601c1d08f7bf3e522f25b58e514b0c809ad195)) * **types:** remove any types ([d8d910b](https://github.com/ar-io/ar-io-sdk/commit/d8d910b9f2d0b95232ccf3c52e74f57b086df435)) * **types:** use string instead of any ([014a262](https://github.com/ar-io/ar-io-sdk/commit/014a26210b2482b3aa5150b4fd37925760f39dd8)) ### Features * **ant:** add ANT read interface ([c941c96](https://github.com/ar-io/ar-io-sdk/commit/c941c96cd201983270cc9e04c0fcaa5b4dc3b798)) * **PE-5825:** ANT read interface ([#19](https://github.com/ar-io/ar-io-sdk/issues/19)) ([6a0c477](https://github.com/ar-io/ar-io-sdk/commit/6a0c47754689071d292eaebfa7b3af6c8e851fa4)) --- CHANGELOG.md | 20 ++++++++++++++++++++ package.json | 2 +- src/version.ts | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 531d4c49..c29a4683 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +# [1.0.0-alpha.9](https://github.com/ar-io/ar-io-sdk/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2024-03-18) + + +### Bug Fixes + +* **ario:** re-add contract default config ([2296cc3](https://github.com/ar-io/ar-io-sdk/commit/2296cc3e152c136e2df45481340a625a80a0be3f)) +* **build:** remove redundant exported type ([134319b](https://github.com/ar-io/ar-io-sdk/commit/134319b8707cd479dc91d6832bf078bdb5c5e886)) +* **readme:** update ant header ([77235ce](https://github.com/ar-io/ar-io-sdk/commit/77235ce077ef4a12dfa6b403968b6ab148ebf196)) +* **readme:** update ANT usage description ([70c8520](https://github.com/ar-io/ar-io-sdk/commit/70c852087f75a17c494cc12719d1dc9f96da39f2)) +* **signer:** remove signer, will do in other pr ([d02276d](https://github.com/ar-io/ar-io-sdk/commit/d02276dd9fa166d254eb76a45e2c6025f632c0ba)) +* **types:** add @ to records ([53601c1](https://github.com/ar-io/ar-io-sdk/commit/53601c1d08f7bf3e522f25b58e514b0c809ad195)) +* **types:** remove any types ([d8d910b](https://github.com/ar-io/ar-io-sdk/commit/d8d910b9f2d0b95232ccf3c52e74f57b086df435)) +* **types:** use string instead of any ([014a262](https://github.com/ar-io/ar-io-sdk/commit/014a26210b2482b3aa5150b4fd37925760f39dd8)) + + +### Features + +* **ant:** add ANT read interface ([c941c96](https://github.com/ar-io/ar-io-sdk/commit/c941c96cd201983270cc9e04c0fcaa5b4dc3b798)) +* **PE-5825:** ANT read interface ([#19](https://github.com/ar-io/ar-io-sdk/issues/19)) ([6a0c477](https://github.com/ar-io/ar-io-sdk/commit/6a0c47754689071d292eaebfa7b3af6c8e851fa4)) + # [1.0.0-alpha.8](https://github.com/ar-io/ar-io-sdk/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2024-03-15) diff --git a/package.json b/package.json index 2c520cf1..b8b65961 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ar.io/sdk", - "version": "1.0.0-alpha.8", + "version": "1.0.0-alpha.9", "repository": { "type": "git", "url": "git+https://github.com/ar-io/ar-io-sdk.git" diff --git a/src/version.ts b/src/version.ts index 25a80224..9933a2b9 100644 --- a/src/version.ts +++ b/src/version.ts @@ -17,4 +17,4 @@ // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH -export const version = '1.0.0-alpha.8'; +export const version = '1.0.0-alpha.9'; From 8a7e59eacb95806ae11de716f6e227296cf669b9 Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Tue, 19 Mar 2024 12:14:06 -0600 Subject: [PATCH 2/4] chore(deps): setup lint-staged to format files before commits --- .husky/pre-commit | 3 +- package.json | 10 ++- yarn.lock | 210 ++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 193 insertions(+), 30 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index dde32d79..5a182ef1 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -yarn format:fix -yarn lint +yarn lint-staged diff --git a/package.json b/package.json index b8b65961..ad942887 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "http-server": "^14.1.1", "husky": "^8.0.3", "jest": "^29.7.0", + "lint-staged": "^15.2.2", "prettier": "^3.0.2", "rimraf": "^5.0.1", "semantic-release": "^21.0.7", @@ -113,8 +114,13 @@ "dependencies": { "arweave": "^1.14.4", "axios": "1.4.0", + "setimmediate": "^1.0.5", "warp-contracts": "^1.4.38", - "winston": "^3.11.0", - "setimmediate": "^1.0.5" + "winston": "^3.11.0" + }, + "lint-staged": { + "**/*.{ts,js,mjs,cjs,md,json}": [ + "prettier --write ." + ] } } diff --git a/yarn.lock b/yarn.lock index 8ed41e76..ea61e22a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2159,7 +2159,7 @@ ansi-styles@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== -ansi-styles@^6.1.0: +ansi-styles@^6.0.0, ansi-styles@^6.1.0, ansi-styles@^6.2.1: version "6.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== @@ -2774,6 +2774,11 @@ catering@^2.1.0, catering@^2.1.1: resolved "https://registry.yarnpkg.com/catering/-/catering-2.1.1.tgz#66acba06ed5ee28d5286133982a927de9a04b510" integrity sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w== +chalk@5.3.0, chalk@^5.2.0, chalk@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" + integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== + chalk@^2.3.2, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -2791,11 +2796,6 @@ chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^5.2.0, chalk@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" - integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== - char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -2866,6 +2866,13 @@ cli-columns@^4.0.0: string-width "^4.2.3" strip-ansi "^6.0.1" +cli-cursor@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-4.0.0.tgz#3cecfe3734bf4fe02a8361cbdc0f6fe28c6a57ea" + integrity sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg== + dependencies: + restore-cursor "^4.0.0" + cli-table3@^0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.3.tgz#61ab765aac156b52f222954ffc607a6f01dbeeb2" @@ -2875,6 +2882,14 @@ cli-table3@^0.6.3: optionalDependencies: "@colors/colors" "1.5.0" +cli-truncate@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-4.0.0.tgz#6cc28a2924fee9e25ce91e973db56c7066e6172a" + integrity sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA== + dependencies: + slice-ansi "^5.0.0" + string-width "^7.0.0" + cliui@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" @@ -2949,6 +2964,11 @@ color@^3.1.3: color-convert "^1.9.3" color-string "^1.6.0" +colorette@^2.0.20: + version "2.0.20" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" + integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== + colorspace@1.1.x: version "1.1.4" resolved "https://registry.yarnpkg.com/colorspace/-/colorspace-1.1.4.tgz#8d442d1186152f60453bf8070cd66eb364e59243" @@ -2972,6 +2992,11 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" +commander@11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906" + integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ== + common-ancestor-path@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz#4f7d2d1394d91b7abdf51871c62f71eadb0182a7" @@ -3165,7 +3190,7 @@ dateformat@^3.0.3: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: +debug@4, debug@4.3.4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -3322,6 +3347,11 @@ emittery@^0.13.1: resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== +emoji-regex@^10.3.0: + version "10.3.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.3.0.tgz#76998b9268409eb3dae3de989254d456e70cfe23" + integrity sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw== + emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -3758,11 +3788,31 @@ eventemitter3@^4.0.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== +eventemitter3@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" + integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== + events@3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== +execa@8.0.1, execa@^8.0.0: + version "8.0.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-8.0.1.tgz#51f6a5943b580f963c3ca9c6321796db8cc39b8c" + integrity sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^8.0.1" + human-signals "^5.0.0" + is-stream "^3.0.0" + merge-stream "^2.0.0" + npm-run-path "^5.1.0" + onetime "^6.0.0" + signal-exit "^4.1.0" + strip-final-newline "^3.0.0" + execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -3793,21 +3843,6 @@ execa@^7.0.0: signal-exit "^3.0.7" strip-final-newline "^3.0.0" -execa@^8.0.0: - version "8.0.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-8.0.1.tgz#51f6a5943b580f963c3ca9c6321796db8cc39b8c" - integrity sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg== - dependencies: - cross-spawn "^7.0.3" - get-stream "^8.0.1" - human-signals "^5.0.0" - is-stream "^3.0.0" - merge-stream "^2.0.0" - npm-run-path "^5.1.0" - onetime "^6.0.0" - signal-exit "^4.1.0" - strip-final-newline "^3.0.0" - exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" @@ -4113,6 +4148,11 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +get-east-asian-width@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz#5e6ebd9baee6fb8b7b6bd505221065f0cd91f64e" + integrity sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA== + get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" @@ -4767,6 +4807,18 @@ is-fullwidth-code-point@^3.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== +is-fullwidth-code-point@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz#fae3167c729e7463f8461ce512b080a49268aa88" + integrity sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ== + +is-fullwidth-code-point@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-5.0.0.tgz#9609efced7c2f97da7b60145ef481c787c7ba704" + integrity sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA== + dependencies: + get-east-asian-width "^1.0.0" + is-generator-fn@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" @@ -5763,6 +5815,11 @@ libnpmversion@^5.0.1: proc-log "^3.0.0" semver "^7.3.7" +lilconfig@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.0.0.tgz#f8067feb033b5b74dab4602a5f5029420be749bc" + integrity sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g== + lines-and-columns@^1.1.6: version "1.2.4" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" @@ -5773,6 +5830,34 @@ lines-and-columns@^2.0.3: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-2.0.4.tgz#d00318855905d2660d8c0822e3f5a4715855fc42" integrity sha512-wM1+Z03eypVAVUCE7QdSqpVIvelbOakn1M0bPDoA4SGWPx3sNDVUiMo3L6To6WWGClB7VyXnhQ4Sn7gxiJbE6A== +lint-staged@^15.2.2: + version "15.2.2" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-15.2.2.tgz#ad7cbb5b3ab70e043fa05bff82a09ed286bc4c5f" + integrity sha512-TiTt93OPh1OZOsb5B7k96A/ATl2AjIZo+vnzFZ6oHK5FuTk63ByDtxGQpHm+kFETjEWqgkF95M8FRXKR/LEBcw== + dependencies: + chalk "5.3.0" + commander "11.1.0" + debug "4.3.4" + execa "8.0.1" + lilconfig "3.0.0" + listr2 "8.0.1" + micromatch "4.0.5" + pidtree "0.6.0" + string-argv "0.3.2" + yaml "2.3.4" + +listr2@8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-8.0.1.tgz#4d3f50ae6cec3c62bdf0e94f5c2c9edebd4b9c34" + integrity sha512-ovJXBXkKGfq+CwmKTjluEqFi3p4h8xvkxGQQAQan22YCgef4KZ1mKGjzfGh6PL6AW5Csw0QiQPNuQyH+6Xk3hA== + dependencies: + cli-truncate "^4.0.0" + colorette "^2.0.20" + eventemitter3 "^5.0.1" + log-update "^6.0.0" + rfdc "^1.3.0" + wrap-ansi "^9.0.0" + load-json-file@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" @@ -5927,6 +6012,17 @@ lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.21, lodash@^4.17.4: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +log-update@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-6.0.0.tgz#0ddeb7ac6ad658c944c1de902993fce7c33f5e59" + integrity sha512-niTvB4gqvtof056rRIrTZvjNYE4rCUzO6X/X+kYjd7WFxXeJ0NwEFnRxX6ehkvv3jTwrXnNdtAak5XYZuIyPFw== + dependencies: + ansi-escapes "^6.2.0" + cli-cursor "^4.0.0" + slice-ansi "^7.0.0" + strip-ansi "^7.1.0" + wrap-ansi "^9.0.0" + logform@^2.3.2, logform@^2.4.0: version "2.6.0" resolved "https://registry.yarnpkg.com/logform/-/logform-2.6.0.tgz#8c82a983f05d6eaeb2d75e3decae7a768b2bf9b5" @@ -6117,7 +6213,7 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -micromatch@^4.0.0, micromatch@^4.0.2, micromatch@^4.0.4: +micromatch@4.0.5, micromatch@^4.0.0, micromatch@^4.0.2, micromatch@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== @@ -6863,7 +6959,7 @@ one-time@^1.0.0: dependencies: fn.name "1.x.x" -onetime@^5.1.2: +onetime@^5.1.0, onetime@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== @@ -7169,6 +7265,11 @@ picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== +pidtree@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.6.0.tgz#90ad7b6d42d5841e69e0a2419ef38f8883aa057c" + integrity sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g== + pify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" @@ -7562,6 +7663,14 @@ resolve@^1.10.0, resolve@^1.20.0, resolve@^1.22.2, resolve@^1.22.4: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +restore-cursor@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-4.0.0.tgz#519560a4318975096def6e609d44100edaa4ccb9" + integrity sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + retry@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" @@ -7572,6 +7681,11 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== +rfdc@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.1.tgz#2b6d4df52dffe8bb346992a10ea9451f24373a8f" + integrity sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg== + rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -7795,7 +7909,7 @@ side-channel@^1.0.4: get-intrinsic "^1.2.4" object-inspect "^1.13.1" -signal-exit@^3.0.3, signal-exit@^3.0.7: +signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== @@ -7871,6 +7985,22 @@ slash@^5.1.0: resolved "https://registry.yarnpkg.com/slash/-/slash-5.1.0.tgz#be3adddcdf09ac38eebe8dcdc7b1a57a75b095ce" integrity sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg== +slice-ansi@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-5.0.0.tgz#b73063c57aa96f9cd881654b15294d95d285c42a" + integrity sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ== + dependencies: + ansi-styles "^6.0.0" + is-fullwidth-code-point "^4.0.0" + +slice-ansi@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-7.1.0.tgz#cd6b4655e298a8d1bdeb04250a433094b347b9a9" + integrity sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg== + dependencies: + ansi-styles "^6.2.1" + is-fullwidth-code-point "^5.0.0" + smart-buffer@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" @@ -8039,6 +8169,11 @@ stream-combiner2@~1.1.1: duplexer2 "~0.1.0" readable-stream "^2.0.2" +string-argv@0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" + integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== + string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -8065,6 +8200,15 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" +string-width@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-7.1.0.tgz#d994252935224729ea3719c49f7206dc9c46550a" + integrity sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw== + dependencies: + emoji-regex "^10.3.0" + get-east-asian-width "^1.0.0" + strip-ansi "^7.1.0" + string.prototype.trim@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz#f9ac6f8af4bd55ddfa8895e6aea92a96395393bd" @@ -8113,7 +8257,7 @@ string_decoder@~1.1.1: dependencies: ansi-regex "^5.0.1" -strip-ansi@^7.0.1: +strip-ansi@^7.0.1, strip-ansi@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== @@ -8865,6 +9009,15 @@ wrap-ansi@^8.1.0: string-width "^5.0.1" strip-ansi "^7.0.1" +wrap-ansi@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-9.0.0.tgz#1a3dc8b70d85eeb8398ddfb1e4a02cd186e58b3e" + integrity sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q== + dependencies: + ansi-styles "^6.2.1" + string-width "^7.0.0" + strip-ansi "^7.1.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -8906,6 +9059,11 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== +yaml@2.3.4: + version "2.3.4" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.4.tgz#53fc1d514be80aabf386dc6001eb29bf3b7523b2" + integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA== + yargs-parser@^20.2.3: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" From 4d10902c2314ffb07b7840afd3132e0545618ae6 Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Tue, 19 Mar 2024 16:58:42 -0600 Subject: [PATCH 3/4] chore(docs): update README --- README.md | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c3c3ac25..57d67300 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,17 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting - [NodeJS Environments](#node) - [Web Environments](#web) - [Typescript](#typescript) -- [APIs](#apis) +- [ArIO Contract](#ario-contract) - [getBalance](#getbalance-address-evaluationoptions-) - [getBalances](#getbalances-evaluationoptions-) - [getGateway](#getgateway-address-evaluationoptions-) - [getGateways](#getgateways-evaluationoptions-) - [getArNSRecord](#getarnsrecord-domain-evaluationoptions-) - [getArNSRecords](#getarnsrecords-evaluationoptions-) +- [ANT Contracts](#arweave-name-tokens-ants) + - [getRecords](#getrecords-evaluationoptions-) + - [getOwner](#getowner-evaluationoptions-) + - [getControllers](#getcontrollers-evaluationoptions-) - [Examples](./examples) - [Developers](#developers) - [Requirements](#requirements) @@ -165,7 +169,7 @@ const remoteCacheCustomArIO = new ArIO({ }); ``` -## APIs +## ArIO Contract ### `getBalance({ address, evaluationOptions })` @@ -550,6 +554,30 @@ const auctions = await arIO.getAuctions({ evaluationOptions }); The ANT contract client class exposes APIs relevant to compliant Arweave Name Token contracts. 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. +### `getOwner({ evaluationOptions })` + +Returns the owner of the configured ANT contract. + +```typescript +const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM'; +const ant = new ANT({ contractTxId }); +const owner = await ant.getOwner(); + +// output: "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM" +``` + +### `getControllers({ evaluationOptions })` + +Returns the controllers of the configured ANT contract. + +```typescript +const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM'; +const ant = new ANT({ contractTxId }); +const controllers = await ant.getControllers(); + +// output: ["bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM"] +``` + ### `getRecords({ evaluationOptions })` Returns all records on the configured ANT contract, including the required `@` record that resolve connected ArNS names. From ec34071f700f02e349b8f439de135540add98ff0 Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Tue, 19 Mar 2024 17:10:30 -0600 Subject: [PATCH 4/4] chore(docs): add contact evaluation examples for ANTs --- README.md | 158 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 106 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 57d67300..65288f44 100644 --- a/README.md +++ b/README.md @@ -12,16 +12,27 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting - [Web Environments](#web) - [Typescript](#typescript) - [ArIO Contract](#ario-contract) - - [getBalance](#getbalance-address-evaluationoptions-) - - [getBalances](#getbalances-evaluationoptions-) - - [getGateway](#getgateway-address-evaluationoptions-) - - [getGateways](#getgateways-evaluationoptions-) - - [getArNSRecord](#getarnsrecord-domain-evaluationoptions-) - - [getArNSRecords](#getarnsrecords-evaluationoptions-) + - [APIs](#apis) + - [getBalance](#getbalance-address-evaluationoptions-) + - [getBalances](#getbalances-evaluationoptions-) + - [getGateway](#getgateway-address-evaluationoptions-) + - [getGateways](#getgateways-evaluationoptions-) + - [getArNSRecord](#getarnsrecord-domain-evaluationoptions-) + - [getArNSRecords](#getarnsrecords-evaluationoptions-) + - [getObservations](#getobservations-evaluationoptions-) + - [getDistributions](#getdistributions-evaluationoptions-) + - [getEpoch](#getepoch-evaluationoptions-) + - [getCurrentEpoch](#getcurrentepoch-evaluationoptions-) + - [getPrescribedObservers](#getprescribedobservers-evaluationoptions-) + - [getAuction](#getauction-domain-evaluationoptions-) + - [getAuctions](#getauctions-evauluationoptions-) + - [Custom Contracts](#custom-contracts) - [ANT Contracts](#arweave-name-tokens-ants) - - [getRecords](#getrecords-evaluationoptions-) - - [getOwner](#getowner-evaluationoptions-) - - [getControllers](#getcontrollers-evaluationoptions-) + - [APIs](#apis-1) + - [getRecords](#getrecords-evaluationoptions-) + - [getOwner](#getowner-evaluationoptions-) + - [getControllers](#getcontrollers-evaluationoptions-) + - [Configuration](#configuration) - [Examples](./examples) - [Developers](#developers) - [Requirements](#requirements) @@ -130,48 +141,37 @@ const gateways = arIO.getGateways(); #### Node +##### ESM (NodeNext) + ```javascript -const { ArIO } = require('@ar-io/sdk'); +import { ArIO } from '@ar-io/sdk/node'; + // set up client const arIO = new ArIO(); // fetch gateways const gateways = await arIO.getGateways(); ``` -## Typescript - -The SDK provides TypeScript types. When you import the SDK in a TypeScript project types are exported from `./lib/types/[node/web]/index.d.ts` and should be automatically recognized by package managers, offering benefits such as type-checking and autocompletion. - -## Configuration - -### Custom Contracts +##### CJS -The ArIO contract client class exposes APIs relevant to the ar.io contract. It can be configured to use any contract ID that adheres to the spec of the ar.io contract. In the default case, it will automatically build and utilize a contract data provider interface that is configured to point the the known mainnet contract ID at construction time. You can provide custom contract data provider or, alternatively, a `contractTxId` to the ArIO constructor to use a different, ar.io-spec-compatible contract. +```javascript +import { ArIO } from '@ar-io/sdk'; -```typescript -// provide a custom contractTxId to the client and default to remote evaluation -const remoteCustomArIO = new ArIO({ - contractTxId: 'TESTNET_CONTRACT_TX_ID', -}); +// set up client +const arIO = new ArIO(); +// fetch gateways +const gateways = await arIO.getGateways(); +``` -// provide a custom contract to the client, and specify local evaluation using warp -const localCustomArIO = new ArIO({ - contract: new WarpContract({ - contractTxId: 'TESTNET_CONTRACT_TX_ID', - }), -}); +## Typescript -// provide a custom contract to the client, and specify local evaluation using remote cache -const remoteCacheCustomArIO = new ArIO({ - contract: new RemoteContract({ - contractTxId: 'TESTNET_CONTRACT_TX_ID', - }), -}); -``` +The SDK provides TypeScript types. When you import the SDK in a TypeScript project types are exported from `./lib/types/[node/web]/index.d.ts` and should be automatically recognized by package managers, offering benefits such as type-checking and autocompletion. ## ArIO Contract -### `getBalance({ address, evaluationOptions })` +### APIs + +#### `getBalance({ address, evaluationOptions })` Retrieves the balance of the specified wallet address. @@ -184,7 +184,7 @@ const balance = arIO.getBalance({ // outputs: 0 ``` -### `getBalances({ evaluationOptions })` +#### `getBalances({ evaluationOptions })` Retrieves the balances of the ArIO contract. @@ -208,7 +208,7 @@ const balances = arIO.getBalances(); // } ``` -### `getGateway({ address, evaluationOptions })` +#### `getGateway({ address, evaluationOptions })` Retrieves a gateway's info by its staking wallet address. @@ -253,7 +253,7 @@ const gateway = arIO.getGateway({ // } ``` -### `getGateways({ evaluationOptions })` +#### `getGateways({ evaluationOptions })` Retrieves the registered gateways of the ArIO contract. @@ -303,7 +303,7 @@ const gateways = arIO.getGateways(); // } ``` -### `getArNSRecord({ domain, evaluationOptions })` +#### `getArNSRecord({ domain, evaluationOptions })` Retrieves the record info of the specified ArNS name. @@ -322,7 +322,7 @@ const record = arIO.getArNSRecord({ domain: 'ardrive' }); // } ``` -### `getArNSRecords({ evaluationOptions })` +#### `getArNSRecords({ evaluationOptions })` Retrieves all registered ArNS records of the ArIO contract. @@ -351,7 +351,7 @@ const records = arIO.getArNSRecords(); // } ``` -### `getObservations({ evaluationOptions })` +#### `getObservations({ evaluationOptions })` Returns the epoch-indexed observation list. @@ -375,7 +375,7 @@ const observations = await arIO.getObservations(); // } ``` -### `getDistributions({ evaluationOptions })` +#### `getDistributions({ evaluationOptions })` Returns the current rewards distribution information. The resulting object is pruned, to get older distributions use the `evaluationOptions` to `evalTo` a previous state. @@ -394,7 +394,7 @@ const distributions = await arIO.getDistributions(); // } ``` -### `getEpoch({ evaluationOptions })` +#### `getEpoch({ evaluationOptions })` Returns the epoch data for the specified block height. @@ -414,7 +414,7 @@ const epoch = await arIO.getEpoch({ blockHeight: 1382230 }); // } ``` -### `getCurrentEpoch({ evaluationOptions })` +#### `getCurrentEpoch({ evaluationOptions })` Returns the current epoch data. @@ -434,7 +434,7 @@ const epoch = await arIO.getCurrentEpoch(); // } ``` -### `getPrescribedObservers({ evaluationOptions })` +#### `getPrescribedObservers({ evaluationOptions })` Retrieves the prescribed observers of the ArIO contract. To fetch prescribed observers for a previous epoch set the `evaluationOptions` to the desired epoch. @@ -484,7 +484,7 @@ const previousEpochObservers = arIO.getPrescribedObservers({ // ] ``` -### `getAuction({ domain, evaluationOptions })` +#### `getAuction({ domain, evaluationOptions })` Return the auction info for the supplied domain, be it in auction, registered, or available to auction. @@ -519,7 +519,7 @@ const auction = await arIO.getAuction({ domain }); // } ``` -### `getAuctions({ evauluationOptions })` +#### `getAuctions({ evauluationOptions })` Retrieves all active auctions. @@ -550,11 +550,38 @@ const auctions = await arIO.getAuctions({ evaluationOptions }); // } ``` +### Custom Contracts + +The ArIO contract client class exposes APIs relevant to the ar.io contract. It can be configured to use any contract ID that adheres to the spec of the ar.io contract. In the default case, it will automatically build and utilize a contract data provider interface that is configured to point the the known mainnet contract ID at construction time. You can provide custom contract data provider or, alternatively, a `contractTxId` to the ArIO constructor to use a different, ar.io-spec-compatible contract. + +```typescript +// provide a custom contractTxId to the client and default to remote evaluation +const remoteCustomArIO = new ArIO({ + contractTxId: 'TESTNET_CONTRACT_TX_ID', +}); + +// provide a custom contract to the client, and specify local evaluation using warp +const localCustomArIO = new ArIO({ + contract: new WarpContract({ + contractTxId: 'TESTNET_CONTRACT_TX_ID', + }), +}); + +// provide a custom contract to the client, and specify local evaluation using remote cache +const remoteCacheCustomArIO = new ArIO({ + contract: new RemoteContract({ + contractTxId: 'TESTNET_CONTRACT_TX_ID', + }), +}); +``` + ## Arweave Name Tokens (ANT's) The ANT contract client class exposes APIs relevant to compliant Arweave Name Token contracts. 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. -### `getOwner({ evaluationOptions })` +### APIs + +#### `getOwner({ evaluationOptions })` Returns the owner of the configured ANT contract. @@ -566,7 +593,7 @@ const owner = await ant.getOwner(); // output: "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM" ``` -### `getControllers({ evaluationOptions })` +#### `getControllers({ evaluationOptions })` Returns the controllers of the configured ANT contract. @@ -578,7 +605,7 @@ const controllers = await ant.getControllers(); // output: ["bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM"] ``` -### `getRecords({ evaluationOptions })` +#### `getRecords({ evaluationOptions })` Returns all records on the configured ANT contract, including the required `@` record that resolve connected ArNS names. @@ -600,6 +627,33 @@ const records = await ANT.getRecords(); // } ``` +### Configuration + +ANT clients can be configured to use custom contract evaluator. By default they will use the remote evaluator that leverages the [arns-service]. + +```typescript +// provide a contractTxId to the client and default to remote evaluation +const remoteANT = new ANT({ + contractTxId: 'ANT_CONTRACT_TX_ID', +}); + +// provide a custom contract to the client, and specify local evaluation using warp +const warpEvaluatedANT = new ANT({ + contract: new WarpContract({ + contractTxId: 'ANT_CONTRACT_TX_ID', + }), +}); + +// provide a custom contract to the client, and specify local evaluation using remote cache +const remoteANTContract = new ANT({ + contract: new RemoteContract({ + contractTxId: 'ANT_CONTRACT_TX_ID', + // the remote api that returns warp compliant contract evaluation + url: 'https://api.arns.app/v1/contract', + }), +}); +``` + ## Developers ### Requirements