From 56fbf58f456a7b1d46899cfe05380165aecba550 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 10:10:23 -0700 Subject: [PATCH 01/25] chore(deps): bump typedoc to 0.26.7 --- package.json | 2 +- yarn.lock | 56 +++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 688f3349307..a4d63950c87 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "prettier-plugin-jsdoc": "^1.3.0", "prettier-plugin-sh": "^0.14.0", "type-coverage": "^2.27.1", - "typedoc": "^0.26.4", + "typedoc": "^0.26.7", "typedoc-plugin-markdown": "^4.2.1", "typescript": "^5.5.3", "typescript-eslint": "^7.15.0" diff --git a/yarn.lock b/yarn.lock index 8755903aa58..8e869ecee32 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3422,12 +3422,20 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@shikijs/core@1.10.3": - version "1.10.3" - resolved "https://registry.yarnpkg.com/@shikijs/core/-/core-1.10.3.tgz#f01763b36f08ad3d2ef46cea7e61858d9d9947d6" - integrity sha512-D45PMaBaeDHxww+EkcDQtDAtzv00Gcsp72ukBtaLSmqRvh0WgGMq3Al0rl1QQBZfuneO75NXMIzEZGFitThWbg== +"@shikijs/core@1.16.3": + version "1.16.3" + resolved "https://registry.yarnpkg.com/@shikijs/core/-/core-1.16.3.tgz#082b53928bf201a8d7cfbe0b5540dc1c609d0a5e" + integrity sha512-yETIvrETCeC39gSPIiSADmjri9FwKmxz0QvONMtTIUYlKZe90CJkvcjPksayC2VQOtzOJonEiULUa8v8crUQvA== dependencies: + "@shikijs/vscode-textmate" "^9.2.0" "@types/hast" "^3.0.4" + oniguruma-to-js "0.3.3" + regex "4.3.2" + +"@shikijs/vscode-textmate@^9.2.0": + version "9.2.2" + resolved "https://registry.yarnpkg.com/@shikijs/vscode-textmate/-/vscode-textmate-9.2.2.tgz#24571f50625c7cd075f9efe0def8b9d2c0930ada" + integrity sha512-TMp15K+GGYrWlZM8+Lnj9EaHEFmOen0WJBrfa17hF7taDOYthuPPV0GWzfd/9iMij0akS/8Yw2ikquH7uVi/fg== "@sinclair/typebox@^0.24.1": version "0.24.51" @@ -9492,6 +9500,11 @@ onetime@^6.0.0: dependencies: mimic-fn "^4.0.0" +oniguruma-to-js@0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/oniguruma-to-js/-/oniguruma-to-js-0.3.3.tgz#3527f7e0fb9e5259c10962a7b015f28c602280dd" + integrity sha512-m90/WEhgs8g4BxG37+Nu3YrMfJDs2YXtYtIllhsEPR+wP3+K4EZk6dDUvy2v2K4MNFDDOYKL4/yqYPXDqyozTQ== + open@^7.4.2: version "7.4.2" resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" @@ -10359,6 +10372,11 @@ regenerator-transform@^0.15.2: dependencies: "@babel/runtime" "^7.8.4" +regex@4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/regex/-/regex-4.3.2.tgz#a68a68c9b337a77bf4ce4ed0b4b1a49d97cb3b7b" + integrity sha512-kK/AA3A9K6q2js89+VMymcboLOlF5lZRCYJv3gzszXFHBr6kO6qLGzbm+UIugBEV8SMMKCTR59txoY6ctRHYVw== + regexp.prototype.flags@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz#138f644a3350f981a858c44f6bb1a61ff59be334" @@ -10759,12 +10777,13 @@ shelljs@0.8.5: interpret "^1.0.0" rechoir "^0.6.2" -shiki@^1.9.1: - version "1.10.3" - resolved "https://registry.yarnpkg.com/shiki/-/shiki-1.10.3.tgz#2276fb21a07043b28c5b16001e6a04fef99dbb8f" - integrity sha512-eneCLncGuvPdTutJuLyUGS8QNPAVFO5Trvld2wgEq1e002mwctAhJKeMGWtWVXOIEzmlcLRqcgPSorR6AVzOmQ== +shiki@^1.16.2: + version "1.16.3" + resolved "https://registry.yarnpkg.com/shiki/-/shiki-1.16.3.tgz#d78b0c644c2a46b25ec638a9a58861999bd3495c" + integrity sha512-GypUE+fEd06FqDs63LSAVlmq7WsahhPQU62cgZxGF+TJT5LjD2k7HTxXj4/CKOVuMM3+wWQ1t4Y5oooeJFRRBQ== dependencies: - "@shikijs/core" "1.10.3" + "@shikijs/core" "1.16.3" + "@shikijs/vscode-textmate" "^9.2.0" "@types/hast" "^3.0.4" side-channel@^1.0.4: @@ -11692,16 +11711,16 @@ typedoc-plugin-markdown@^4.2.1: resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.2.1.tgz#b32fddc246c5bfe7e4879834fc3f8b1486de7286" integrity sha512-7hQt/1WaW/VI4+x3sxwcCGsEylP1E1GvF6OTTELK5sfTEp6AeK+83jkCOgZGp1pI2DiOammMYQMnxxOny9TKsQ== -typedoc@^0.26.4: - version "0.26.4" - resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.26.4.tgz#7e83047369a29a710d429dac20996680cae9a314" - integrity sha512-FlW6HpvULDKgc3rK04V+nbFyXogPV88hurarDPOjuuB5HAwuAlrCMQ5NeH7Zt68a/ikOKu6Z/0hFXAeC9xPccQ== +typedoc@^0.26.7: + version "0.26.7" + resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.26.7.tgz#1980e3ed51c6c315b7a09786b2b9af1106a3aa80" + integrity sha512-gUeI/Wk99vjXXMi8kanwzyhmeFEGv1LTdTQsiyIsmSYsBebvFxhbcyAx7Zjo4cMbpLGxM4Uz3jVIjksu/I2v6Q== dependencies: lunr "^2.3.9" markdown-it "^14.1.0" minimatch "^9.0.5" - shiki "^1.9.1" - yaml "^2.4.5" + shiki "^1.16.2" + yaml "^2.5.1" typescript-eslint@^7.15.0, typescript-eslint@^7.3.1: version "7.15.0" @@ -12172,11 +12191,16 @@ yaml@^1.10.0: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yaml@^2.2.2, yaml@^2.3.4, yaml@^2.4.5: +yaml@^2.2.2, yaml@^2.3.4: version "2.4.5" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.4.5.tgz#60630b206dd6d84df97003d33fc1ddf6296cca5e" integrity sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg== +yaml@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.1.tgz#c9772aacf62cb7494a95b0c4f1fb065b563db130" + integrity sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q== + yargs-parser@20.2.4: version "20.2.4" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" From b8c6841bd988c530d9f6f1a54667c713f5432e41 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 10:10:57 -0700 Subject: [PATCH 02/25] chore(deps): npx yarn-deduplicate --- yarn.lock | 62 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 60 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8e869ecee32..c3eaa17b259 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1537,23 +1537,11 @@ "@endo/zip" "^1.0.7" ses "^1.8.0" -"@endo/env-options@^1.1.5": - version "1.1.5" - resolved "https://registry.yarnpkg.com/@endo/env-options/-/env-options-1.1.5.tgz#2314da7e125c04516e13ef6005ec09406e82c256" - integrity sha512-Pkov8WqmOIdwgREtntxSoYgRdRXqHE9N/ZMIPjSI6LV9p7c2bC9wc4pPZPjGPIb/O4phOikbvC6BcENE83T30Q== - "@endo/env-options@^1.1.6": version "1.1.6" resolved "https://registry.yarnpkg.com/@endo/env-options/-/env-options-1.1.6.tgz#f4e2dcb22f19f33c0431303c7387c7f5b54c757f" integrity sha512-Uqy94PwLTco90Yfign43muvDtjsYTbL6Ck4W5sSWQUqJiFOL+YP8kiBOoGyQynDsGTY0MCQvMxEPfphaJKnzlQ== -"@endo/errors@^1.2.4": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@endo/errors/-/errors-1.2.4.tgz#ba8eeeda015d85402d3a6208e6d5c9fda37bc499" - integrity sha512-kvNEtWXyYHydn0d+JMRRGuGJaxga3NbRVL66LnvNk8exwXDIkkhJdakoGxR9yg8Sx1AY3Bvh2GU7uvsKZzSDOw== - dependencies: - ses "^1.7.0" - "@endo/errors@^1.2.5": version "1.2.5" resolved "https://registry.yarnpkg.com/@endo/errors/-/errors-1.2.5.tgz#158bc584b9e648e4ca2978a240b57cb45df05c03" @@ -1582,13 +1570,6 @@ "@babel/traverse" "^7.23.6" source-map-js "^1.2.0" -"@endo/eventual-send@^1.2.4": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@endo/eventual-send/-/eventual-send-1.2.4.tgz#2ba90fb6682857ab1cf8039df6aac1b073ac2514" - integrity sha512-HFqFHAkPtPxIkvTzlsZeslsDLAs4ISNVv4cgwhzfPhERn/bO+oTJ1NjpaOtlNk7CklxO30Pra+jw1sJ4Vjy3iQ== - dependencies: - "@endo/env-options" "^1.1.5" - "@endo/eventual-send@^1.2.5": version "1.2.5" resolved "https://registry.yarnpkg.com/@endo/eventual-send/-/eventual-send-1.2.5.tgz#f6aef45f6f8d30c42a57512315aa43a4215f425b" @@ -1609,16 +1590,7 @@ "@endo/pass-style" "^1.4.3" "@endo/patterns" "^1.4.3" -"@endo/far@^1.0.0": - version "1.1.4" - resolved "https://registry.yarnpkg.com/@endo/far/-/far-1.1.4.tgz#ffdf74d27ad7179fc76d666f9cade0b10de37715" - integrity sha512-bYNScFhFAvUO5114CMEkvMB/M8HR9y09xiXA/iYY37YH7VJW/lskJ7i/8pOfbFX1Pp8QDRoyU7Y+QrPyaScVjw== - dependencies: - "@endo/errors" "^1.2.4" - "@endo/eventual-send" "^1.2.4" - "@endo/pass-style" "^1.4.2" - -"@endo/far@^1.1.5": +"@endo/far@^1.0.0", "@endo/far@^1.1.5": version "1.1.5" resolved "https://registry.yarnpkg.com/@endo/far/-/far-1.1.5.tgz#182530eac9a3dbc129bb6bf60f4dddce1fda4523" integrity sha512-x4D8OjzHBqMD0mjq09iZE46xbuhGDkqypE6dGGNTJkQNpMp8y6oWxvLj+Be2YQJ7dkXCZMnLfn1CcrQGhI0N2g== @@ -1693,17 +1665,6 @@ "@endo/stream" "^1.2.5" ses "^1.8.0" -"@endo/pass-style@^1.4.2": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@endo/pass-style/-/pass-style-1.4.2.tgz#7555681074b53bae302b6bbcab09ccacf850d4d5" - integrity sha512-lup/xKxBcWFDMqIy9gkw4OXYwbSbCOKjNNsEG+4E8n94hM5iBWyTRXCelbm0M5HDBSXqhhfG5tgki7vRxv+bEA== - dependencies: - "@endo/env-options" "^1.1.5" - "@endo/errors" "^1.2.4" - "@endo/eventual-send" "^1.2.4" - "@endo/promise-kit" "^1.1.4" - "@fast-check/ava" "^1.1.5" - "@endo/pass-style@^1.4.3": version "1.4.3" resolved "https://registry.yarnpkg.com/@endo/pass-style/-/pass-style-1.4.3.tgz#9449ce2bc297c5bcaf81fe0c4e29692b61586b52" @@ -1726,13 +1687,6 @@ "@endo/marshal" "^1.5.3" "@endo/promise-kit" "^1.1.5" -"@endo/promise-kit@^1.1.4": - version "1.1.4" - resolved "https://registry.yarnpkg.com/@endo/promise-kit/-/promise-kit-1.1.4.tgz#1092be0b9c56861c9795475c01a7dc2f3146d6f8" - integrity sha512-oHaAz/AY7VISd51Nb7AeHN+2yNlFR58W6m3EIWMz8A7T9NALsCUNzlSQwF9k9u/7lH4ljwR0x1saLq4Q5jnGgQ== - dependencies: - ses "^1.7.0" - "@endo/promise-kit@^1.1.5": version "1.1.5" resolved "https://registry.yarnpkg.com/@endo/promise-kit/-/promise-kit-1.1.5.tgz#75f369ae967ab5ffb47f187059deea0ea50994c3" @@ -10672,13 +10626,6 @@ serve-static@1.15.0: parseurl "~1.3.3" send "0.18.0" -ses@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/ses/-/ses-1.7.0.tgz#3b74db6104870d598da3b072f85e2d7a58e40fdc" - integrity sha512-hgoFhIT4/axmORurcIeSx/j0ZY62X4qAUuuiA0di4DZLLKjN5TKIRI5Is/nqcfxAKBw5VOa3kMX4aYanbqkaCA== - dependencies: - "@endo/env-options" "^1.1.5" - ses@^1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/ses/-/ses-1.8.0.tgz#8031ba3ce5bd55ced0e7a805c9cc906b9f5e29da" @@ -12191,12 +12138,7 @@ yaml@^1.10.0: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yaml@^2.2.2, yaml@^2.3.4: - version "2.4.5" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.4.5.tgz#60630b206dd6d84df97003d33fc1ddf6296cca5e" - integrity sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg== - -yaml@^2.5.1: +yaml@^2.2.2, yaml@^2.3.4, yaml@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.1.tgz#c9772aacf62cb7494a95b0c4f1fb065b563db130" integrity sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q== From 96bf8c305dc5dc182a3ab7d6486046d7e1ae105d Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 12:18:47 -0700 Subject: [PATCH 03/25] chore: update type-coverage --- packages/SwingSet/package.json | 2 +- packages/agoric-cli/package.json | 2 +- packages/boot/package.json | 2 +- packages/builders/package.json | 2 +- packages/cosmic-swingset/package.json | 2 +- packages/deploy-script-support/package.json | 2 +- packages/inter-protocol/package.json | 2 +- packages/internal/package.json | 2 +- packages/network/package.json | 2 +- packages/orchestration/package.json | 2 +- packages/pegasus/package.json | 2 +- packages/solo/package.json | 2 +- packages/store/package.json | 2 +- packages/swing-store/package.json | 2 +- packages/swingset-liveslots/package.json | 2 +- packages/vats/package.json | 2 +- packages/vow/package.json | 2 +- packages/xsnap/package.json | 2 +- packages/zoe/package.json | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/SwingSet/package.json b/packages/SwingSet/package.json index 19b3859cc85..b5aa9ad3012 100644 --- a/packages/SwingSet/package.json +++ b/packages/SwingSet/package.json @@ -101,6 +101,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 75.1 + "atLeast": 75.7 } } diff --git a/packages/agoric-cli/package.json b/packages/agoric-cli/package.json index ecf932120b3..6bcf1a914a7 100644 --- a/packages/agoric-cli/package.json +++ b/packages/agoric-cli/package.json @@ -99,6 +99,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 77.36 + "atLeast": 77.44 } } diff --git a/packages/boot/package.json b/packages/boot/package.json index 3363977a440..8be443aa505 100644 --- a/packages/boot/package.json +++ b/packages/boot/package.json @@ -90,6 +90,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 86.64 + "atLeast": 90.03 } } diff --git a/packages/builders/package.json b/packages/builders/package.json index 0d577250574..7bcc10454e3 100644 --- a/packages/builders/package.json +++ b/packages/builders/package.json @@ -79,6 +79,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 76.03 + "atLeast": 81.8 } } diff --git a/packages/cosmic-swingset/package.json b/packages/cosmic-swingset/package.json index 339579e6740..8622cf27efa 100644 --- a/packages/cosmic-swingset/package.json +++ b/packages/cosmic-swingset/package.json @@ -69,6 +69,6 @@ "timeout": "20m" }, "typeCoverage": { - "atLeast": 80.6 + "atLeast": 80.53 } } diff --git a/packages/deploy-script-support/package.json b/packages/deploy-script-support/package.json index 337bc531dc0..81d37b649b7 100644 --- a/packages/deploy-script-support/package.json +++ b/packages/deploy-script-support/package.json @@ -72,6 +72,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 82.44 + "atLeast": 82.6 } } diff --git a/packages/inter-protocol/package.json b/packages/inter-protocol/package.json index 8b83b9ca7f5..334690cbdf0 100644 --- a/packages/inter-protocol/package.json +++ b/packages/inter-protocol/package.json @@ -82,6 +82,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 95.81 + "atLeast": 95.8 } } diff --git a/packages/internal/package.json b/packages/internal/package.json index fdef5be7e42..63018dc4fea 100755 --- a/packages/internal/package.json +++ b/packages/internal/package.json @@ -57,6 +57,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 93.82 + "atLeast": 93.32 } } diff --git a/packages/network/package.json b/packages/network/package.json index 62c6817da21..b3f379269c3 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -66,6 +66,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 90.69 + "atLeast": 91.15 } } diff --git a/packages/orchestration/package.json b/packages/orchestration/package.json index c7f6de8cf30..24edc15ebfd 100644 --- a/packages/orchestration/package.json +++ b/packages/orchestration/package.json @@ -92,6 +92,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 98.1 + "atLeast": 97.54 } } diff --git a/packages/pegasus/package.json b/packages/pegasus/package.json index f5c45b704e5..1dc2ae6ce40 100644 --- a/packages/pegasus/package.json +++ b/packages/pegasus/package.json @@ -70,6 +70,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 91.18 + "atLeast": 91.21 } } diff --git a/packages/solo/package.json b/packages/solo/package.json index 77b84bce263..110bd0210d1 100644 --- a/packages/solo/package.json +++ b/packages/solo/package.json @@ -78,6 +78,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 73.36 + "atLeast": 73.4 } } diff --git a/packages/store/package.json b/packages/store/package.json index 72a185d0ba3..3c218f401cb 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -59,6 +59,6 @@ "timeout": "2m" }, "typeCoverage": { - "atLeast": 89.39 + "atLeast": 89.53 } } diff --git a/packages/swing-store/package.json b/packages/swing-store/package.json index a9572138ed5..5a6dae3b5bd 100644 --- a/packages/swing-store/package.json +++ b/packages/swing-store/package.json @@ -49,6 +49,6 @@ "timeout": "2m" }, "typeCoverage": { - "atLeast": 76.31 + "atLeast": 78.77 } } diff --git a/packages/swingset-liveslots/package.json b/packages/swingset-liveslots/package.json index 04001c04f29..a0d032f6ccb 100644 --- a/packages/swingset-liveslots/package.json +++ b/packages/swingset-liveslots/package.json @@ -66,6 +66,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 75.35 + "atLeast": 75.1 } } diff --git a/packages/vats/package.json b/packages/vats/package.json index 8604004a1df..6a93f60a68f 100644 --- a/packages/vats/package.json +++ b/packages/vats/package.json @@ -77,6 +77,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 91.52 + "atLeast": 91.51 } } diff --git a/packages/vow/package.json b/packages/vow/package.json index 3946f5222ab..b938dbcd1fc 100755 --- a/packages/vow/package.json +++ b/packages/vow/package.json @@ -54,6 +54,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 89.93 + "atLeast": 89.96 } } diff --git a/packages/xsnap/package.json b/packages/xsnap/package.json index 5f19d32f83e..c3b9db78cc3 100644 --- a/packages/xsnap/package.json +++ b/packages/xsnap/package.json @@ -76,6 +76,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 93.99 + "atLeast": 94.04 } } diff --git a/packages/zoe/package.json b/packages/zoe/package.json index adf1a31d7df..fd67cdeea85 100644 --- a/packages/zoe/package.json +++ b/packages/zoe/package.json @@ -141,6 +141,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 84.99 + "atLeast": 85.02 } } From 23ef07c9620b61c21105a75a7d917765e2a38c8d Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Thu, 1 Aug 2024 08:50:13 -0500 Subject: [PATCH 04/25] docs: @example for withOrchestration --- packages/orchestration/src/utils/start-helper.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/orchestration/src/utils/start-helper.js b/packages/orchestration/src/utils/start-helper.js index 4af597a463e..5030ab59802 100644 --- a/packages/orchestration/src/utils/start-helper.js +++ b/packages/orchestration/src/utils/start-helper.js @@ -176,6 +176,13 @@ harden(provideOrchestration); * Simplifies contract functions for Orchestration by wrapping a simpler * function with all the tools it needs in order to use Orchestration. * + * @example + * + * ```js + * const contract = (zcf, privateArgs, zone, tools) => { ... }; + * export const start = withOrchestration(contract); + * ``` + * * @template {Record} CT * @template {OrchestrationPowers & { * marshaller: Marshaller; From 901efc541e3aa9854b1462f4686e9f75ff47822c Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 24 Jul 2024 10:48:28 -0500 Subject: [PATCH 05/25] docs: StakingAccountQueries, StakingAccountActions, ... --- packages/orchestration/src/cosmos-api.ts | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/orchestration/src/cosmos-api.ts b/packages/orchestration/src/cosmos-api.ts index 194e7831f70..7e48e30d89f 100644 --- a/packages/orchestration/src/cosmos-api.ts +++ b/packages/orchestration/src/cosmos-api.ts @@ -97,6 +97,12 @@ export type CosmosChainInfo = Readonly<{ stakingTokens?: Readonly>; }>; +/** + * Queries for the staking properties of an account. + * + * @see {@link https://docs.cosmos.network/main/build/modules/staking#messages x/staking messages} + * {@link https://cosmos.github.io/cosmjs/latest/stargate/interfaces/StakingExtension.html StakingExtension} in cosmjs + */ export interface StakingAccountQueries { /** * @returns all active delegations from the account to any validator (or [] if none) @@ -141,6 +147,13 @@ export interface StakingAccountQueries { */ getReward: (validator: CosmosValidatorAddress) => Promise; } + +/** + * Transactions for doing staking operations on an individual account. + * + * @see {@link https://docs.cosmos.network/main/build/modules/staking#messages x/staking messages} + * {@link https://cosmos.github.io/cosmjs/latest/stargate/interfaces/StakingExtension.html StakingExtension} in cosmjs + */ export interface StakingAccountActions { /** * Delegate an amount to a validator. The promise settles when the delegation is complete. @@ -263,12 +276,26 @@ export type LocalAccountMethods = { monitorTransfers: (tap: TargetApp) => Promise; }; +/** + * Options for {@link OrchestrationAccountI} `transfer` method. + * + * @see {@link https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures ICS 20 Data Structures} + */ export type IBCMsgTransferOptions = { timeoutHeight?: MsgTransfer['timeoutHeight']; timeoutTimestamp?: MsgTransfer['timeoutTimestamp']; memo?: string; }; +/** + * Cosmos-specific methods to extend `OrchestrationAccountI`, parameterized + * by `CosmosChainInfo`. + * + * In particular, if the chain info includes a staking token, `StakingAccountActions` + * are available. + * + * @see {OrchestrationAccountI} + */ export type CosmosChainAccountMethods = (CCI extends { icaEnabled: true; From 4a149cc912a2f118beabfe22ca2b7239950e368c Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 24 Jul 2024 12:16:48 -0500 Subject: [PATCH 06/25] docs: ChainInfo --- packages/orchestration/src/chain-info.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/orchestration/src/chain-info.js b/packages/orchestration/src/chain-info.js index efded7f3550..347c77afb68 100644 --- a/packages/orchestration/src/chain-info.js +++ b/packages/orchestration/src/chain-info.js @@ -9,10 +9,14 @@ import { import fetchedChainInfo from './fetched-chain-info.js'; // Refresh with scripts/refresh-chain-info.ts import { CosmosAssetInfoShape, CosmosChainInfoShape } from './typeGuards.js'; -/** @import {CosmosAssetInfo, CosmosChainInfo, EthChainInfo, IBCConnectionInfo} from './types.js'; */ +/** @import {Chain, CosmosAssetInfo, CosmosChainInfo, EthChainInfo, IBCConnectionInfo} from './types.js'; */ /** @import {NameAdmin} from '@agoric/vats'; */ -/** @typedef {CosmosChainInfo | EthChainInfo} ChainInfo */ +/** + * Info used to build a {@link Chain} object - naming, connections, etc. + * + * @typedef {CosmosChainInfo | EthChainInfo} ChainInfo + */ const knownChains = /** @satisfies {Record} */ ( harden({ From da56653ad90771d32b77cc149b28d345bae120c4 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 24 Jul 2024 12:52:51 -0500 Subject: [PATCH 07/25] docs: CosmosInterchainService --- .../src/examples/send-anywhere.contract.js | 2 +- .../examples/staking-combinations.contract.js | 2 +- .../src/examples/swap.contract.js | 2 +- .../src/examples/unbond.contract.js | 2 +- .../src/examples/unbond.flows.js | 2 +- .../src/exos/cosmos-interchain-service.js | 17 +++++---- .../orchestration/src/exos/exo-interfaces.ts | 35 +++++++++++++++++++ .../src/exos/local-chain-facade.js | 2 +- .../orchestration/src/exos/orchestrator.js | 2 +- .../src/exos/remote-chain-facade.js | 2 +- packages/orchestration/src/facade.js | 2 +- packages/orchestration/src/types.ts | 1 + .../orchestration/src/utils/start-helper.js | 2 +- 13 files changed, 57 insertions(+), 16 deletions(-) create mode 100644 packages/orchestration/src/exos/exo-interfaces.ts diff --git a/packages/orchestration/src/examples/send-anywhere.contract.js b/packages/orchestration/src/examples/send-anywhere.contract.js index 093bb576183..85a9b4f1c26 100644 --- a/packages/orchestration/src/examples/send-anywhere.contract.js +++ b/packages/orchestration/src/examples/send-anywhere.contract.js @@ -13,7 +13,7 @@ import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js'; * @import {Remote, Vow} from '@agoric/vow'; * @import {Zone} from '@agoric/zone'; * @import {VBankAssetDetail} from '@agoric/vats/tools/board-utils.js'; - * @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js'; + * @import {CosmosInterchainService} from '../exos/exo-interfaces.js'; * @import {OrchestrationTools} from '../utils/start-helper.js'; */ diff --git a/packages/orchestration/src/examples/staking-combinations.contract.js b/packages/orchestration/src/examples/staking-combinations.contract.js index dbcb93185fe..62d15438364 100644 --- a/packages/orchestration/src/examples/staking-combinations.contract.js +++ b/packages/orchestration/src/examples/staking-combinations.contract.js @@ -22,7 +22,7 @@ import * as flows from './staking-combinations.flows.js'; * @import {Vow} from '@agoric/vow'; * @import {Remote} from '@agoric/internal'; * @import {Zone} from '@agoric/zone'; - * @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js'; + * @import {CosmosInterchainService} from '../exos/exo-interfaces.js'; * @import {OrchestrationTools} from '../utils/start-helper.js'; * @import {CosmosOrchestrationAccount} from '../exos/cosmos-orchestration-account.js'; */ diff --git a/packages/orchestration/src/examples/swap.contract.js b/packages/orchestration/src/examples/swap.contract.js index b4af770f7b0..fa2a7e0bff1 100644 --- a/packages/orchestration/src/examples/swap.contract.js +++ b/packages/orchestration/src/examples/swap.contract.js @@ -8,7 +8,7 @@ import * as flows from './swap.flows.js'; * @import {TimerService} from '@agoric/time'; * @import {LocalChain} from '@agoric/vats/src/localchain.js'; * @import {Remote} from '@agoric/internal'; - * @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js'; + * @import {CosmosInterchainService} from '../exos/exo-interfaces.js'; * @import {NameHub} from '@agoric/vats'; * @import {Zone} from '@agoric/zone'; * @import {OrchestrationTools} from '../utils/start-helper.js'; diff --git a/packages/orchestration/src/examples/unbond.contract.js b/packages/orchestration/src/examples/unbond.contract.js index c3768146660..a303afddf10 100644 --- a/packages/orchestration/src/examples/unbond.contract.js +++ b/packages/orchestration/src/examples/unbond.contract.js @@ -8,7 +8,7 @@ import * as flows from './unbond.flows.js'; * @import {NameHub} from '@agoric/vats'; * @import {Remote} from '@agoric/internal'; * @import {Zone} from '@agoric/zone'; - * @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js'; + * @import {CosmosInterchainService} from '../exos/exo-interfaces.js'; * @import {OrchestrationTools} from '../utils/start-helper.js'; */ diff --git a/packages/orchestration/src/examples/unbond.flows.js b/packages/orchestration/src/examples/unbond.flows.js index c936d93b630..a203dd088f1 100644 --- a/packages/orchestration/src/examples/unbond.flows.js +++ b/packages/orchestration/src/examples/unbond.flows.js @@ -5,7 +5,7 @@ * @import {NameHub} from '@agoric/vats'; * @import {Remote} from '@agoric/internal'; * @import {Zone} from '@agoric/zone'; - * @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js'; + * @import {CosmosInterchainService} from '../exos/exo-interfaces.js'; * @import {OrchestrationTools} from '../utils/start-helper.js'; */ diff --git a/packages/orchestration/src/exos/cosmos-interchain-service.js b/packages/orchestration/src/exos/cosmos-interchain-service.js index ec2bffb9f41..e74b4dd6cd8 100644 --- a/packages/orchestration/src/exos/cosmos-interchain-service.js +++ b/packages/orchestration/src/exos/cosmos-interchain-service.js @@ -1,15 +1,16 @@ /** @file Orchestration service */ +import { Shape as NetworkShape } from '@agoric/network'; +import { pickFacet } from '@agoric/vat-data'; import { E } from '@endo/far'; import { M, mustMatch } from '@endo/patterns'; -import { Shape as NetworkShape } from '@agoric/network'; -import { prepareIcaAccountKit } from './ica-account-kit.js'; -import { prepareICQConnectionKit } from './icq-connection-kit.js'; import { DEFAULT_ICQ_VERSION, makeICAChannelAddress, makeICQChannelAddress, } from '../utils/address.js'; +import { prepareIcaAccountKit } from './ica-account-kit.js'; +import { prepareICQConnectionKit } from './icq-connection-kit.js'; /** * @import {Zone} from '@agoric/base-zone'; @@ -20,6 +21,7 @@ import { * @import {Vow, VowTools} from '@agoric/vow'; * @import {ICQConnection, IcaAccount, ICQConnectionKit, IcaAccountKit} from '../types.js'; * @import {ICAChannelAddressOpts} from '../utils/address.js'; + * @import {CosmosInterchainService} from './exo-interfaces.js'; */ const { Vow$ } = NetworkShape; // TODO #9611 @@ -183,6 +185,7 @@ const prepareCosmosOrchestrationServiceKit = ( }, public: { /** + * @satisfies {CosmosInterchainService['makeAccount']} * @param {string} chainId * @param {IBCConnectionID} hostConnectionId the counterparty * connection_id @@ -208,6 +211,7 @@ const prepareCosmosOrchestrationServiceKit = ( ); }, /** + * @satisfies {CosmosInterchainService['provideICQConnection']} * @param {IBCConnectionID} controllerConnectionId * @param {string} [version] * @returns {Vow | ICQConnection} @@ -262,12 +266,13 @@ export const prepareCosmosInterchainService = (zone, vowTools) => { makeICQConnectionKit, ); - const makeCosmosInterchainService = initialPowers => - makeCosmosOrchestrationServiceKit(initialPowers).public; + const makeCosmosInterchainService = pickFacet( + makeCosmosOrchestrationServiceKit, + 'public', + ); return makeCosmosInterchainService; }; harden(prepareCosmosInterchainService); /** @typedef {ReturnType} MakeCosmosInterchainService */ -/** @typedef {ReturnType} CosmosInterchainService */ diff --git a/packages/orchestration/src/exos/exo-interfaces.ts b/packages/orchestration/src/exos/exo-interfaces.ts new file mode 100644 index 00000000000..9916556b9af --- /dev/null +++ b/packages/orchestration/src/exos/exo-interfaces.ts @@ -0,0 +1,35 @@ +import type { IBCConnectionID } from '@agoric/vats'; +import type { Vow } from '@agoric/vow'; +import type { IcaAccount } from '../cosmos-api.ts'; +import type { ICAChannelAddressOpts } from '../utils/address'; +import type { ICQConnection } from './icq-connection-kit'; + +/** + * Authority to make a Cosmos interchain account or an interchain query connection. + */ +export interface CosmosInterchainService { + /** + * @param {string} chainId + * @param {IBCConnectionID} hostConnectionId the counterparty + * connection_id + * @param {IBCConnectionID} controllerConnectionId self connection_id + * @param {ICAChannelAddressOpts} [opts] optional to configure the + * channel address, such as version and ordering + * @returns {Vow} + */ + makeAccount( + chainId: string, + hostConnectionId: IBCConnectionID, + controllerConnectionId: IBCConnectionID, + opts?: ICAChannelAddressOpts | undefined, + ): Vow; + /** + * @param {IBCConnectionID} controllerConnectionId + * @param {string} [version] + * @returns {Vow | ICQConnection} + */ + provideICQConnection( + controllerConnectionId: IBCConnectionID, + version?: string | undefined, + ): Vow | ICQConnection; +} diff --git a/packages/orchestration/src/exos/local-chain-facade.js b/packages/orchestration/src/exos/local-chain-facade.js index 62ca0cf71ba..27987593ebb 100644 --- a/packages/orchestration/src/exos/local-chain-facade.js +++ b/packages/orchestration/src/exos/local-chain-facade.js @@ -17,7 +17,7 @@ import { chainFacadeMethods, TypedJsonShape } from '../typeGuards.js'; * @import {AssetInfo} from '@agoric/vats/src/vat-bank.js'; * @import {NameHub} from '@agoric/vats'; * @import {Vow, VowTools} from '@agoric/vow'; - * @import {CosmosInterchainService} from './cosmos-interchain-service.js'; + * @import {CosmosInterchainService} from './exo-interfaces.js'; * @import {LocalOrchestrationAccountKit, MakeLocalOrchestrationAccountKit} from './local-orchestration-account.js'; * @import {Chain, ChainAddress, ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount} from '../types.js'; */ diff --git a/packages/orchestration/src/exos/orchestrator.js b/packages/orchestration/src/exos/orchestrator.js index cce65214507..9a3a2ed31ad 100644 --- a/packages/orchestration/src/exos/orchestrator.js +++ b/packages/orchestration/src/exos/orchestrator.js @@ -24,7 +24,7 @@ import { * @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js'. * @import {Remote} from '@agoric/internal'; * @import {PickFacet} from '@agoric/swingset-liveslots'; - * @import {CosmosInterchainService} from './cosmos-interchain-service.js'; + * @import {CosmosInterchainService} from './exo-interfaces.js'; * @import {MakeLocalChainFacade} from './local-chain-facade.js'; * @import {MakeRemoteChainFacade} from './remote-chain-facade.js'; * @import {Chain, ChainInfo, IBCConnectionInfo, Orchestrator} from '../types.js'; diff --git a/packages/orchestration/src/exos/remote-chain-facade.js b/packages/orchestration/src/exos/remote-chain-facade.js index 76b78d15a9d..555839e70d0 100644 --- a/packages/orchestration/src/exos/remote-chain-facade.js +++ b/packages/orchestration/src/exos/remote-chain-facade.js @@ -20,7 +20,7 @@ import { * @import {Remote} from '@agoric/internal'; * @import {Vow, VowTools} from '@agoric/vow'; * @import {LocalIbcAddress, RemoteIbcAddress} from '@agoric/vats/tools/ibc-utils.js'; - * @import {CosmosInterchainService} from './cosmos-interchain-service.js'; + * @import {CosmosInterchainService} from './exo-interfaces.js'; * @import {prepareCosmosOrchestrationAccount} from './cosmos-orchestration-account.js'; * @import {CosmosChainInfo, IBCConnectionInfo, ChainAddress, IcaAccount, Chain, ICQConnection} from '../types.js'; */ diff --git a/packages/orchestration/src/facade.js b/packages/orchestration/src/facade.js index 71a11ad430e..64a2e48e73f 100644 --- a/packages/orchestration/src/facade.js +++ b/packages/orchestration/src/facade.js @@ -9,7 +9,7 @@ import { assertAllDefined, deepMapObject } from '@agoric/internal'; * @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js'. * @import {HostOrchestrator} from './exos/orchestrator.js'; * @import {Remote} from '@agoric/internal'; - * @import {CosmosInterchainService} from './exos/cosmos-interchain-service.js'; + * @import {CosmosInterchainService} from './exos/exo-interfaces.js'; * @import {Chain, ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount, OrchestrationFlow, Orchestrator} from './types.js'; */ diff --git a/packages/orchestration/src/types.ts b/packages/orchestration/src/types.ts index ef70cc8595a..a8a0bf4d2b4 100644 --- a/packages/orchestration/src/types.ts +++ b/packages/orchestration/src/types.ts @@ -6,6 +6,7 @@ export type * from './ethereum-api.js'; export type * from './exos/ica-account-kit.js'; export type * from './exos/local-chain-facade.js'; export type * from './exos/icq-connection-kit.js'; +export type * from './exos/exo-interfaces.js'; export type * from './orchestration-api.js'; export type * from './exos/cosmos-interchain-service.js'; export type * from './exos/chain-hub.js'; diff --git a/packages/orchestration/src/utils/start-helper.js b/packages/orchestration/src/utils/start-helper.js index 5030ab59802..b2706f3f04f 100644 --- a/packages/orchestration/src/utils/start-helper.js +++ b/packages/orchestration/src/utils/start-helper.js @@ -19,7 +19,7 @@ import { makeZoeTools } from './zoe-tools.js'; * @import {NameHub} from '@agoric/vats'; * @import {Remote} from '@agoric/vow'; * @import {Zone} from '@agoric/zone'; - * @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js'; + * @import {CosmosInterchainService} from '../exos/exo-interfaces.js'; */ /** From 1d0d961ffb8dedae235af8497ef72bd0599741b1 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Thu, 1 Aug 2024 09:30:22 -0500 Subject: [PATCH 08/25] docs: for ChainHubAdmin.registerChain --- packages/orchestration/src/exos/chain-hub-admin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/orchestration/src/exos/chain-hub-admin.js b/packages/orchestration/src/exos/chain-hub-admin.js index fd18f2b7d60..bbb0e5514c6 100644 --- a/packages/orchestration/src/exos/chain-hub-admin.js +++ b/packages/orchestration/src/exos/chain-hub-admin.js @@ -33,9 +33,11 @@ export const prepareChainHubAdmin = (zone, chainHub) => { }), { /** - * @param {string} chainName + * Register information for a chain + * + * @param {string} chainName - must not exist in chainHub * @param {CosmosChainInfo} chainInfo - * @param {IBCConnectionInfo} connectionInfo + * @param {IBCConnectionInfo} connectionInfo - from Agoric chain */ async initChain(chainName, chainInfo, connectionInfo) { // when() because chainHub methods return vows. If this were inside From ed3f2e6bc1fad5d39df5f04b366d6d1330254079 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Thu, 1 Aug 2024 09:31:05 -0500 Subject: [PATCH 09/25] chore: export * from chain-hub-admin --- packages/orchestration/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/orchestration/index.js b/packages/orchestration/index.js index 09afecb813d..5ddb94512dd 100644 --- a/packages/orchestration/index.js +++ b/packages/orchestration/index.js @@ -4,4 +4,5 @@ export * from './src/types.js'; export * from './src/exos/cosmos-interchain-service.js'; +export * from './src/exos/chain-hub-admin.js'; export * from './src/typeGuards.js'; From 15fe11bbee5118219163be02f427f5f0e4fcecb1 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Mon, 5 Aug 2024 19:51:59 +0500 Subject: [PATCH 10/25] docs: chainHubAdmin example --- packages/orchestration/src/exos/chain-hub-admin.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/orchestration/src/exos/chain-hub-admin.js b/packages/orchestration/src/exos/chain-hub-admin.js index bbb0e5514c6..772d188b04b 100644 --- a/packages/orchestration/src/exos/chain-hub-admin.js +++ b/packages/orchestration/src/exos/chain-hub-admin.js @@ -16,6 +16,17 @@ import { DenomDetailShape } from './chain-hub.js'; * developers to add new chain configurations to a local chainHub, in the event * the information is not available widely in `agoricNames`. * + * @example + * + * ```js + * const chainHubAdmin = prepareChainHubAdmin(zone, chainHub); + * chainHubAdmin.initChain( + * 'hotNewChain', + * hotNewChainInfo, + * agoricTohotNewChainConnectionInfo, + * ); + * ``` + * * @param {Zone} zone * @param {ChainHub} chainHub */ From 48a325cb93ffb8e505649e9e2a413429e2ac87d1 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 11:18:23 -0700 Subject: [PATCH 11/25] docs: vat-orchestration buildRootObject --- packages/orchestration/src/vat-orchestration.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/orchestration/src/vat-orchestration.js b/packages/orchestration/src/vat-orchestration.js index 357ecb24eb4..016ccfac7b7 100644 --- a/packages/orchestration/src/vat-orchestration.js +++ b/packages/orchestration/src/vat-orchestration.js @@ -3,9 +3,21 @@ import { prepareSwingsetVowTools } from '@agoric/vow/vat.js'; import { makeDurableZone } from '@agoric/zone/durable.js'; import { prepareCosmosInterchainService } from './exos/cosmos-interchain-service.js'; -/** @import {OrchestrationPowers} from './exos/cosmos-interchain-service.js' */ +/** + * @import {Baggage} from '@agoric/vat-data'; + * @import {OrchestrationPowers} from './exos/cosmos-interchain-service.js'; + */ -export const buildRootObject = (_vatPowers, _args, baggage) => { +/** + * Build root object of the Orchestration vat. + * + * @param {VatPowers & { + * D: DProxy; + * }} vatPowers + * @param {never} vatParameters + * @param {Baggage} baggage + */ +export const buildRootObject = (vatPowers, vatParameters, baggage) => { const zone = makeDurableZone(baggage); const vowTools = prepareSwingsetVowTools(zone.subZone('VowTools')); const makeCosmosInterchainService = prepareCosmosInterchainService( From eb5b978b1e63c3fb5783e971e6036bd083f8cf33 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 11:26:07 -0700 Subject: [PATCH 12/25] docs: OrchestrationAccount --- packages/orchestration/src/orchestration-api.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/orchestration/src/orchestration-api.ts b/packages/orchestration/src/orchestration-api.ts index 9c065056d80..322063b4902 100644 --- a/packages/orchestration/src/orchestration-api.ts +++ b/packages/orchestration/src/orchestration-api.ts @@ -68,6 +68,11 @@ export type ChainAddress = { encoding: 'bech32' | 'ethereum'; }; +/** + * Object that controls an account on a particular chain. + * + * The methods available depend on the chain and its capabilities. + */ export type OrchestrationAccount = OrchestrationAccountI & (CI extends CosmosChainInfo ? CI['chainId'] extends `agoric${string}` From 1f3fc93cb2896da1cd6b2bbe070e9e541c3fecff Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 11:29:57 -0700 Subject: [PATCH 13/25] docs: Orchestration methods --- packages/orchestration/src/orchestration-api.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/orchestration/src/orchestration-api.ts b/packages/orchestration/src/orchestration-api.ts index 322063b4902..6cd0d15d659 100644 --- a/packages/orchestration/src/orchestration-api.ts +++ b/packages/orchestration/src/orchestration-api.ts @@ -124,6 +124,11 @@ export interface DenomInfo< * Provided in the callback to `orchestrate()`. */ export interface Orchestrator { + /** + * Get a Chain object for working with the given chain. + * + * @param {C} chainName name of the chain in KnownChains or the ChainHub backing the Orchestrator + */ getChain: ( chainName: C, ) => Promise< @@ -131,7 +136,11 @@ export interface Orchestrator { (C extends 'agoric' ? AgoricChainMethods : {}) >; + /** + * Make a new local (Agoric) ChainAccount + */ makeLocalAccount: () => Promise; + /** * For a denom, return information about a denom including the equivalent * local Brand, the Chain on which the denom is held, and the Chain that @@ -144,7 +153,7 @@ export interface Orchestrator { >( denom: Denom, ) => DenomInfo; - // TODO preload the mapping so this can be synchronous + /** * Convert an amount described in native data to a local, structured Amount. * @param amount - the described amount From a7e19175458b807e53775ca678e02622d43ae275 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 11:32:09 -0700 Subject: [PATCH 14/25] docs: OrchestrationFlow --- .../orchestration/src/orchestration-api.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/orchestration/src/orchestration-api.ts b/packages/orchestration/src/orchestration-api.ts index 6cd0d15d659..c3d0ad11c81 100644 --- a/packages/orchestration/src/orchestration-api.ts +++ b/packages/orchestration/src/orchestration-api.ts @@ -234,6 +234,26 @@ export interface OrchestrationAccountI { getPublicTopics: () => Promise>>; } +/** + * Flows to orchestrate are regular Javascript functions but have some + * constraints to fulfill the requirements of resumability after termination of + * the enclosing vat. Some requirements for each orchestration flow: + * - must not close over any values that could change between invocations + * - must satisfy the `OrchestrationFlow` interface + * - must be hardened + * - must not use `E()` (eventual send) + * + * The call to `orchestrate` using a flow function in reincarnations of the vat + * must have the same `durableName` as before. To help enforce these + * constraints, we recommend: + * + * - keeping flows in a `.flows.js` module + * - importing them all with `import * as flows` to get a single object keyed by + * the export name + * - using `orchestrateAll` to treat each export name as the `durableName` of + * the flow + * - adopting `@agoric/eslint-config` that has rules to help detect problems + */ export interface OrchestrationFlow { (orc: Orchestrator, ctx: CT, ...args: Passable[]): Promise; } From 47a4ff6ee556be8556d3a611b4e97a7ea4e47782 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 11:36:49 -0700 Subject: [PATCH 15/25] docs: Proto3Shape, AmountArgShape --- packages/orchestration/src/typeGuards.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/orchestration/src/typeGuards.js b/packages/orchestration/src/typeGuards.js index f1c9ccea31b..2b04cdaac51 100644 --- a/packages/orchestration/src/typeGuards.js +++ b/packages/orchestration/src/typeGuards.js @@ -4,7 +4,8 @@ import { M } from '@endo/patterns'; /** * @import {TypedPattern} from '@agoric/internal'; - * @import {ChainAddress, CosmosAssetInfo, Chain, ChainInfo, CosmosChainInfo, DenomAmount, DenomDetail, DenomInfo} from './types.js'; + * @import {ChainAddress, CosmosAssetInfo, Chain, ChainInfo, CosmosChainInfo, DenomAmount, DenomDetail, DenomInfo, AmountArg} from './types.js'; + * @import {Any as Proto3Msg} from '@agoric/cosmic-proto/google/protobuf/any.js'; * @import {Delegation} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js'; * @import {TxBody} from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js'; * @import {TypedJson} from '@agoric/cosmic-proto'; @@ -32,6 +33,7 @@ export const ChainAddressShape = { value: M.string(), }; +/** @type {TypedPattern} */ export const Proto3Shape = { typeUrl: M.string(), value: M.string(), @@ -123,6 +125,7 @@ export const DenomInfoShape = { /** @type {TypedPattern} */ export const DenomAmountShape = { denom: DenomShape, value: M.bigint() }; +/** @type {TypedPattern} */ export const AmountArgShape = M.or(AmountShape, DenomAmountShape); export const ICQMsgShape = M.splitRecord( From 54cc2b9bc00c39375646ca0171e5be76fc7f1c5d Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 11:42:12 -0700 Subject: [PATCH 16/25] docs: mark internal, alpha symbols --- packages/orchestration/src/orchestration-api.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/orchestration/src/orchestration-api.ts b/packages/orchestration/src/orchestration-api.ts index c3d0ad11c81..47873d7444c 100644 --- a/packages/orchestration/src/orchestration-api.ts +++ b/packages/orchestration/src/orchestration-api.ts @@ -263,6 +263,7 @@ export interface OrchestrationFlow { * The type must be able to express transfers across different chains and transports. * * NOTE Expected to change, so consider an opaque structure. + * @internal */ export type TransferMsg = { toAccount: ChainAddress; @@ -271,8 +272,11 @@ export type TransferMsg = { data?: object; }; +/** @alpha */ export type AfterAction = { destChain: string; destAddress: ChainAddress }; +/** @alpha */ export type SwapExact = { amountIn: Amount; amountOut: Amount }; +/** @alpha */ export type SwapMaxSlippage = { amountIn: Amount; brandOut: Brand; From 7b97301033f4dcb70301fbb2739c1abd40a3a9c7 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 11:47:51 -0700 Subject: [PATCH 17/25] build: filter docs output (alpha, internal, private) --- typedoc.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/typedoc.json b/typedoc.json index 685abaab401..90667d1f50f 100644 --- a/typedoc.json +++ b/typedoc.json @@ -9,5 +9,10 @@ "entryPointStrategy": "packages", "out": "api-docs", "includeVersion": true, + "visibilityFilters": { + "@alpha": false, + "@internal": false, + "private": false, + }, "logLevel": "Verbose" } From 1af613563d9fb7a40bc6dc15babcf3434d0c4b1c Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 11:51:19 -0700 Subject: [PATCH 18/25] chore: remove unnecessary exports --- packages/orchestration/src/exos/chain-hub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/orchestration/src/exos/chain-hub.js b/packages/orchestration/src/exos/chain-hub.js index 81fcdaae28a..202b2329fff 100644 --- a/packages/orchestration/src/exos/chain-hub.js +++ b/packages/orchestration/src/exos/chain-hub.js @@ -82,7 +82,7 @@ export const connectionKey = (chainId1, chainId2) => { * @param {IBCConnectionInfo} connInfo * @returns {IBCConnectionInfo} */ -export const reverseConnInfo = connInfo => { +const reverseConnInfo = connInfo => { const { transferChannel } = connInfo; return { id: connInfo.counterparty.connection_id, From c3df059196652c2c20eef986e520f1d7dfa49134 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 12:11:34 -0700 Subject: [PATCH 19/25] docs: mark internal,private --- packages/orchestration/src/chain-info.js | 5 ++++- packages/orchestration/src/exos/chain-hub.js | 2 ++ .../src/exos/cosmos-interchain-service.js | 3 +++ .../src/exos/cosmos-orchestration-account.js | 2 ++ packages/orchestration/src/exos/ica-account-kit.js | 8 +++++++- packages/orchestration/src/exos/icq-connection-kit.js | 3 +++ packages/orchestration/src/exos/local-chain-facade.js | 3 +++ .../src/exos/local-orchestration-account.js | 2 ++ packages/orchestration/src/typeGuards.js | 11 ++++++++++- 9 files changed, 36 insertions(+), 3 deletions(-) diff --git a/packages/orchestration/src/chain-info.js b/packages/orchestration/src/chain-info.js index 347c77afb68..4e826f6fc66 100644 --- a/packages/orchestration/src/chain-info.js +++ b/packages/orchestration/src/chain-info.js @@ -73,7 +73,10 @@ const knownChains = /** @satisfies {Record} */ ( }) ); -/** @typedef {typeof knownChains} KnownChains */ +/** + * @typedef {typeof knownChains} KnownChains + * @internal + */ /** * TODO(#9572): include this in registerChain diff --git a/packages/orchestration/src/exos/chain-hub.js b/packages/orchestration/src/exos/chain-hub.js index 202b2329fff..6fbd8142e03 100644 --- a/packages/orchestration/src/exos/chain-hub.js +++ b/packages/orchestration/src/exos/chain-hub.js @@ -24,6 +24,7 @@ import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js'; * @typedef {K extends keyof KnownChains * ? ChainInfo & Omit * : ChainInfo} ActualChainInfo + * @internal */ /** @@ -40,6 +41,7 @@ export const DenomDetailShape = M.splitRecord( { brand: BrandShape }, ); +// TODO refactor into an enum-ish object /** agoricNames key for ChainInfo hub */ export const CHAIN_KEY = 'chain'; /** namehub for connection info */ diff --git a/packages/orchestration/src/exos/cosmos-interchain-service.js b/packages/orchestration/src/exos/cosmos-interchain-service.js index e74b4dd6cd8..00e8389959c 100644 --- a/packages/orchestration/src/exos/cosmos-interchain-service.js +++ b/packages/orchestration/src/exos/cosmos-interchain-service.js @@ -252,8 +252,11 @@ const prepareCosmosOrchestrationServiceKit = ( ); /** + * Used only by vat-orchestration and tests mocking it + * * @param {Zone} zone * @param {VowTools} vowTools + * @internal */ export const prepareCosmosInterchainService = (zone, vowTools) => { const makeIcaAccountKit = prepareIcaAccountKit(zone, vowTools); diff --git a/packages/orchestration/src/exos/cosmos-orchestration-account.js b/packages/orchestration/src/exos/cosmos-orchestration-account.js index d3bb08e7af7..59dcee5b58c 100644 --- a/packages/orchestration/src/exos/cosmos-orchestration-account.js +++ b/packages/orchestration/src/exos/cosmos-orchestration-account.js @@ -69,6 +69,7 @@ const { Vow$ } = NetworkShape; // TODO #9611 */ /** + * @private * @typedef {{ * topicKit: RecorderKit; * account: IcaAccount; @@ -79,6 +80,7 @@ const { Vow$ } = NetworkShape; // TODO #9611 * bondDenom: string; * timer: Remote; * }} State + * Internal to the IcaAccountHolder exo */ /** diff --git a/packages/orchestration/src/exos/ica-account-kit.js b/packages/orchestration/src/exos/ica-account-kit.js index aa1e8302b10..1802666bb9f 100644 --- a/packages/orchestration/src/exos/ica-account-kit.js +++ b/packages/orchestration/src/exos/ica-account-kit.js @@ -26,7 +26,6 @@ import { makeTxPacket, parseTxPacket } from '../utils/packet.js'; const trace = makeTracer('IcaAccountKit'); -/** @typedef {'UNPARSABLE_CHAIN_ADDRESS'} UnparsableChainAddress */ const UNPARSABLE_CHAIN_ADDRESS = 'UNPARSABLE_CHAIN_ADDRESS'; export const IcaAccountI = M.interface('IcaAccount', { @@ -42,7 +41,9 @@ export const IcaAccountI = M.interface('IcaAccount', { reactivate: M.call().returns(VowShape), }); +// XXX none of these modifiers are working to exclude this type from api-docs /** + * @private * @typedef {{ * chainId: string; * port: Port; @@ -53,11 +54,16 @@ export const IcaAccountI = M.interface('IcaAccount', { * chainAddress: ChainAddress | undefined; * isInitiatingClose: boolean; * }} State + * Internal to the IcaAccountKit exo + * @internal */ /** + * Used only by CosmosInterchainService + * * @param {Zone} zone * @param {VowTools} vowTools + * @internal */ export const prepareIcaAccountKit = (zone, { watch, asVow }) => zone.exoClassKit( diff --git a/packages/orchestration/src/exos/icq-connection-kit.js b/packages/orchestration/src/exos/icq-connection-kit.js index a2ac5bba4aa..e01e4499908 100644 --- a/packages/orchestration/src/exos/icq-connection-kit.js +++ b/packages/orchestration/src/exos/icq-connection-kit.js @@ -34,6 +34,8 @@ export const ICQConnectionI = M.interface('ICQConnection', { */ /** + * Used only by CosmosInterchainService + * * Prepares an ICQ Connection Kit based on the * {@link https://github.com/cosmos/ibc-apps/blob/e9b46e4bf0ad0a66cf6bc53b5e5496f6e2b4b02b/modules/async-icq/README.md | `icq/v1` IBC application protocol}. * @@ -48,6 +50,7 @@ export const ICQConnectionI = M.interface('ICQConnection', { * * @param {Zone} zone * @param {VowTools} vowTools + * @internal */ export const prepareICQConnectionKit = (zone, { watch, asVow }) => zone.exoClassKit( diff --git a/packages/orchestration/src/exos/local-chain-facade.js b/packages/orchestration/src/exos/local-chain-facade.js index 27987593ebb..63498c0fb96 100644 --- a/packages/orchestration/src/exos/local-chain-facade.js +++ b/packages/orchestration/src/exos/local-chain-facade.js @@ -178,8 +178,11 @@ const prepareLocalChainFacadeKit = ( harden(prepareLocalChainFacadeKit); /** + * Used only by `withOrchestration` helper + * * @param {Zone} zone * @param {LocalChainFacadePowers} powers + * @internal */ export const prepareLocalChainFacade = (zone, powers) => { const makeLocalChainFacadeKit = prepareLocalChainFacadeKit(zone, powers); diff --git a/packages/orchestration/src/exos/local-orchestration-account.js b/packages/orchestration/src/exos/local-orchestration-account.js index 355852bb889..a17c4d4063c 100644 --- a/packages/orchestration/src/exos/local-orchestration-account.js +++ b/packages/orchestration/src/exos/local-orchestration-account.js @@ -53,12 +53,14 @@ const EVow$ = shape => M.or(Vow$(shape), M.promise(/* shape */)); */ /** + * @private * @typedef {{ * topicKit: RecorderKit; * packetTools: PacketTools; * account: LocalChainAccount; * address: ChainAddress; * }} State + * Internal to the LocalOrchestrationAccount exo */ const HolderI = M.interface('holder', { diff --git a/packages/orchestration/src/typeGuards.js b/packages/orchestration/src/typeGuards.js index 2b04cdaac51..3c3a64bd5d0 100644 --- a/packages/orchestration/src/typeGuards.js +++ b/packages/orchestration/src/typeGuards.js @@ -46,6 +46,7 @@ export const DelegationShape = harden({ shares: M.string(), // TODO: bigint? }); +/** @internal */ export const IBCTransferOptionsShape = M.splitRecord( {}, { @@ -58,7 +59,9 @@ export const IBCTransferOptionsShape = M.splitRecord( }, ); +/** @internal */ export const IBCChannelIDShape = M.string(); +/** @internal */ export const IBCChannelInfoShape = M.splitRecord({ portId: M.string(), channelId: IBCChannelIDShape, @@ -68,7 +71,9 @@ export const IBCChannelInfoShape = M.splitRecord({ state: M.scalar(), // XXX version: M.string(), }); +/** @internal */ export const IBCConnectionIDShape = M.string(); +/** @internal */ export const IBCConnectionInfoShape = M.splitRecord({ id: IBCConnectionIDShape, client_id: M.string(), @@ -148,7 +153,11 @@ export const chainFacadeMethods = harden({ */ export const TimestampProtoShape = { seconds: M.nat(), nanos: M.number() }; -/** see {@link TxBody} for more details */ +/** + * see {@link TxBody} for more details + * + * @internal + */ export const TxBodyOptsShape = M.splitRecord( {}, { From 5d3a614746595ff91cf38232bb21ea9147c071b4 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 12:12:05 -0700 Subject: [PATCH 20/25] docs: additional descriptions --- packages/orchestration/src/chain-info.js | 9 +++++++-- packages/orchestration/src/cosmos-api.ts | 4 ++-- packages/orchestration/src/exos/chain-hub.js | 2 ++ packages/orchestration/src/exos/local-chain-facade.js | 2 ++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/orchestration/src/chain-info.js b/packages/orchestration/src/chain-info.js index 4e826f6fc66..34c63a62409 100644 --- a/packages/orchestration/src/chain-info.js +++ b/packages/orchestration/src/chain-info.js @@ -13,7 +13,8 @@ import { CosmosAssetInfoShape, CosmosChainInfoShape } from './typeGuards.js'; /** @import {NameAdmin} from '@agoric/vats'; */ /** - * Info used to build a {@link Chain} object - naming, connections, etc. + * Info used to build a {@link Chain} object - channel, connection, and denom + * info. * * @typedef {CosmosChainInfo | EthChainInfo} ChainInfo */ @@ -78,12 +79,14 @@ const knownChains = /** @satisfies {Record} */ ( * @internal */ +// TODO(#9572): include this in registerChain /** - * TODO(#9572): include this in registerChain + * Register chain assets into agoricNames * * @param {ERef} agoricNamesAdmin * @param {string} name * @param {CosmosAssetInfo[]} assets + * @alpha */ export const registerChainAssets = async (agoricNamesAdmin, name, assets) => { mustMatch(assets, M.arrayOf(CosmosAssetInfoShape)); @@ -93,6 +96,8 @@ export const registerChainAssets = async (agoricNamesAdmin, name, assets) => { }; /** + * Register a chain into agoricNames + * * @param {ERef} agoricNamesAdmin * @param {string} name * @param {CosmosChainInfo} chainInfo diff --git a/packages/orchestration/src/cosmos-api.ts b/packages/orchestration/src/cosmos-api.ts index 7e48e30d89f..f30fd64432a 100644 --- a/packages/orchestration/src/cosmos-api.ts +++ b/packages/orchestration/src/cosmos-api.ts @@ -151,7 +151,7 @@ export interface StakingAccountQueries { /** * Transactions for doing staking operations on an individual account. * - * @see {@link https://docs.cosmos.network/main/build/modules/staking#messages x/staking messages} + * @see {@link https://docs.cosmos.network/main/build/modules/staking#messages x/staking messages} and * {@link https://cosmos.github.io/cosmjs/latest/stargate/interfaces/StakingExtension.html StakingExtension} in cosmjs */ export interface StakingAccountActions { @@ -291,7 +291,7 @@ export type IBCMsgTransferOptions = { * Cosmos-specific methods to extend `OrchestrationAccountI`, parameterized * by `CosmosChainInfo`. * - * In particular, if the chain info includes a staking token, `StakingAccountActions` + * In particular, if the chain info includes a staking token, {@link StakingAccountActions} * are available. * * @see {OrchestrationAccountI} diff --git a/packages/orchestration/src/exos/chain-hub.js b/packages/orchestration/src/exos/chain-hub.js index 6fbd8142e03..f938771a480 100644 --- a/packages/orchestration/src/exos/chain-hub.js +++ b/packages/orchestration/src/exos/chain-hub.js @@ -423,6 +423,8 @@ export const makeChainHub = (agoricNames, vowTools) => { /** @typedef {ReturnType} ChainHub */ /** + * Register assets with the given ChainHub so they are available for lookup + * * @param {ChainHub} chainHub * @param {string} name * @param {CosmosAssetInfo[]} assets diff --git a/packages/orchestration/src/exos/local-chain-facade.js b/packages/orchestration/src/exos/local-chain-facade.js index 63498c0fb96..7f4ace2d8b4 100644 --- a/packages/orchestration/src/exos/local-chain-facade.js +++ b/packages/orchestration/src/exos/local-chain-facade.js @@ -23,6 +23,8 @@ import { chainFacadeMethods, TypedJsonShape } from '../typeGuards.js'; */ /** + * Chain facade methods unique to the Agoric (local) chain. + * * @typedef {object} AgoricChainMethods * @property {() => Promise} getVBankAssetInfo Get asset info from * agoricNames.vbankAsset. From 98103e93675a211d37bb52b9eb2fc87fe0bb6fa3 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 12:12:29 -0700 Subject: [PATCH 21/25] docs: ICQMsgShape --- packages/orchestration/src/typeGuards.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/orchestration/src/typeGuards.js b/packages/orchestration/src/typeGuards.js index 3c3a64bd5d0..6088eb07fe9 100644 --- a/packages/orchestration/src/typeGuards.js +++ b/packages/orchestration/src/typeGuards.js @@ -133,6 +133,7 @@ export const DenomAmountShape = { denom: DenomShape, value: M.bigint() }; /** @type {TypedPattern} */ export const AmountArgShape = M.or(AmountShape, DenomAmountShape); +/** Approximately @see RequestQuery */ export const ICQMsgShape = M.splitRecord( { path: M.string(), data: M.string() }, { height: M.string(), prove: M.boolean() }, From e34bf5115deda32dde55de520415fe25545c6ec5 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 12:17:44 -0700 Subject: [PATCH 22/25] chore(type): use interfaces --- packages/orchestration/src/cosmos-api.ts | 22 +++++----- .../orchestration/src/orchestration-api.ts | 18 ++++++--- packages/orchestration/test/types.test-d.ts | 40 ++++++++++++++----- 3 files changed, 53 insertions(+), 27 deletions(-) diff --git a/packages/orchestration/src/cosmos-api.ts b/packages/orchestration/src/cosmos-api.ts index f30fd64432a..d44bd8c4307 100644 --- a/packages/orchestration/src/cosmos-api.ts +++ b/packages/orchestration/src/cosmos-api.ts @@ -36,7 +36,7 @@ export type CosmosValidatorAddress = ChainAddress & { }; /** Represents an IBC Connection between two chains, which can contain multiple Channels. */ -export type IBCConnectionInfo = { +export interface IBCConnectionInfo { id: IBCConnectionID; // e.g. connection-0 client_id: string; // '07-tendermint-0' state: IBCConnectionState; @@ -56,12 +56,12 @@ export type IBCConnectionInfo = { state: IBCChannelState; version: string; // e.eg. 'ics20-1' }; -}; +} /** * https://github.com/cosmos/chain-registry/blob/master/assetlist.schema.json */ -export type CosmosAssetInfo = { +export interface CosmosAssetInfo extends Record { base: Denom; name: string; display: string; @@ -79,7 +79,7 @@ export type CosmosAssetInfo = { path: string; }; }>; -} & Record; +} /** * Info for a Cosmos-based chain. @@ -254,11 +254,13 @@ export interface IcaAccount { getPort: () => Port; } -export type LiquidStakingMethods = { +/** Methods on chains that support Liquid Staking */ +export interface LiquidStakingMethods { liquidStake: (amount: AmountArg) => Promise; -}; +} -export type LocalAccountMethods = { +/** Methods supported only on Agoric chain accounts */ +export interface LocalAccountMethods { /** deposit payment (from zoe, for example) to the account */ deposit: (payment: Payment<'nat'>) => Promise; /** withdraw a Payment from the account */ @@ -274,18 +276,18 @@ export type LocalAccountMethods = { * @param tap */ monitorTransfers: (tap: TargetApp) => Promise; -}; +} /** * Options for {@link OrchestrationAccountI} `transfer` method. * * @see {@link https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures ICS 20 Data Structures} */ -export type IBCMsgTransferOptions = { +export interface IBCMsgTransferOptions { timeoutHeight?: MsgTransfer['timeoutHeight']; timeoutTimestamp?: MsgTransfer['timeoutTimestamp']; memo?: string; -}; +} /** * Cosmos-specific methods to extend `OrchestrationAccountI`, parameterized diff --git a/packages/orchestration/src/orchestration-api.ts b/packages/orchestration/src/orchestration-api.ts index 47873d7444c..b8ab3c03e6d 100644 --- a/packages/orchestration/src/orchestration-api.ts +++ b/packages/orchestration/src/orchestration-api.ts @@ -265,20 +265,26 @@ export interface OrchestrationFlow { * NOTE Expected to change, so consider an opaque structure. * @internal */ -export type TransferMsg = { +export interface TransferMsg { toAccount: ChainAddress; timeout?: Timestamp; next?: TransferMsg; data?: object; -}; +} /** @alpha */ -export type AfterAction = { destChain: string; destAddress: ChainAddress }; +export interface AfterAction { + destChain: string; + destAddress: ChainAddress; +} /** @alpha */ -export type SwapExact = { amountIn: Amount; amountOut: Amount }; +export interface SwapExact { + amountIn: Amount; + amountOut: Amount; +} /** @alpha */ -export type SwapMaxSlippage = { +export interface SwapMaxSlippage { amountIn: Amount; brandOut: Brand; slippage: number; -}; +} diff --git a/packages/orchestration/test/types.test-d.ts b/packages/orchestration/test/types.test-d.ts index 6a588bfe80b..84a6b69b5be 100644 --- a/packages/orchestration/test/types.test-d.ts +++ b/packages/orchestration/test/types.test-d.ts @@ -2,30 +2,32 @@ * @file pure types types, no runtime, ignored by Ava */ -import { expectNotType, expectType } from 'tsd'; +import type { HostInterface, HostOf } from '@agoric/async-flow'; import { JsonSafe, typedJson } from '@agoric/cosmic-proto'; -import type { MsgDelegateResponse } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js'; import type { QueryAllBalancesResponse, QueryBalanceResponse, } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/query.js'; +import type { MsgDelegateResponse } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js'; +import type { ResponseQuery } from '@agoric/cosmic-proto/tendermint/abci/types.js'; import type { Vow, VowTools } from '@agoric/vow'; -import type { GuestAsyncFunc, HostInterface, HostOf } from '@agoric/async-flow'; import type { ResolvedPublicTopic } from '@agoric/zoe/src/contractSupport/topics.js'; -import type { ResponseQuery } from '@agoric/cosmic-proto/tendermint/abci/types.js'; +import type { Passable } from '@endo/marshal'; +import { expectAssignable, expectNotType, expectType } from 'tsd'; +import { prepareCosmosOrchestrationAccount } from '../src/exos/cosmos-orchestration-account.js'; +import type { LocalOrchestrationAccountKit } from '../src/exos/local-orchestration-account.js'; +import type { OrchestrationFacade } from '../src/facade.js'; import type { + Chain, ChainAddress, + ChainInfo, + CosmosChainInfo, CosmosValidatorAddress, - StakingAccountActions, + DenomAmount, OrchestrationAccount, Orchestrator, - Chain, - ChainInfo, - CosmosChainInfo, + StakingAccountActions, } from '../src/types.js'; -import type { LocalOrchestrationAccountKit } from '../src/exos/local-orchestration-account.js'; -import { prepareCosmosOrchestrationAccount } from '../src/exos/cosmos-orchestration-account.js'; -import type { OrchestrationFacade } from '../src/facade.js'; import type { ResolvedContinuingOfferResult } from '../src/utils/zoe-tools.js'; const anyVal = null as any; @@ -249,3 +251,19 @@ expectNotType(chainAddr); }, ] as const); } + +{ + const addr = { + chainId: 'chainId', + encoding: 'bech32', + value: 'agoric1valoperfoo', + }; + expectAssignable(addr); + const denomAmount = { denom: 'bld', value: 10n }; + expectAssignable(denomAmount); + + // XXX when these types are interfaces this test fails. + // TODO https://github.com/Agoric/agoric-sdk/issues/9822 + expectAssignable(addr as CosmosValidatorAddress); + expectAssignable(denomAmount as DenomAmount); +} From cc4b382d5efdc17058394f95d19a1cd91e4e3fb3 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 12:41:52 -0700 Subject: [PATCH 23/25] chore: update type-coverage --- packages/orchestration/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/orchestration/package.json b/packages/orchestration/package.json index 24edc15ebfd..7c53a4a711e 100644 --- a/packages/orchestration/package.json +++ b/packages/orchestration/package.json @@ -92,6 +92,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 97.54 + "atLeast": 97.57 } } From 45fae2b9e50f09e9d28ccf8b7ddfd607c805dd2d Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 30 Jul 2024 16:04:54 -0400 Subject: [PATCH 24/25] feat: export withOrchestration --- packages/orchestration/index.js | 2 ++ packages/orchestration/src/utils/start-helper.js | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/orchestration/index.js b/packages/orchestration/index.js index 5ddb94512dd..af958a142b6 100644 --- a/packages/orchestration/index.js +++ b/packages/orchestration/index.js @@ -6,3 +6,5 @@ export * from './src/types.js'; export * from './src/exos/cosmos-interchain-service.js'; export * from './src/exos/chain-hub-admin.js'; export * from './src/typeGuards.js'; + +export { withOrchestration } from './src/utils/start-helper.js'; diff --git a/packages/orchestration/src/utils/start-helper.js b/packages/orchestration/src/utils/start-helper.js index b2706f3f04f..c281ecee4f5 100644 --- a/packages/orchestration/src/utils/start-helper.js +++ b/packages/orchestration/src/utils/start-helper.js @@ -42,6 +42,7 @@ import { makeZoeTools } from './zoe-tools.js'; * @param {Baggage} baggage * @param {OrchestrationPowers} remotePowers * @param {Marshaller} marshaller + * @internal */ export const provideOrchestration = ( zcf, From 220d4b21b8f59a1583396874bc678b613244d174 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 9 Sep 2024 14:00:10 -0700 Subject: [PATCH 25/25] refactor(types): import OrchestrationPowers --- .../src/examples/auto-stake-it.contract.js | 17 +---------------- .../src/examples/basic-flows.contract.js | 3 +-- .../src/examples/send-anywhere.contract.js | 18 +----------------- .../src/exos/cosmos-interchain-service.js | 1 - .../orchestration/src/utils/start-helper.js | 1 - 5 files changed, 3 insertions(+), 37 deletions(-) diff --git a/packages/orchestration/src/examples/auto-stake-it.contract.js b/packages/orchestration/src/examples/auto-stake-it.contract.js index 78e7b53db4b..d08781e47ff 100644 --- a/packages/orchestration/src/examples/auto-stake-it.contract.js +++ b/packages/orchestration/src/examples/auto-stake-it.contract.js @@ -10,23 +10,8 @@ import { prepareStakingTap } from './auto-stake-it-tap-kit.js'; import * as flows from './auto-stake-it.flows.js'; /** - * @import {TimerService} from '@agoric/time'; - * @import {LocalChain} from '@agoric/vats/src/localchain.js'; - * @import {NameHub} from '@agoric/vats'; - * @import {Remote} from '@agoric/vow'; * @import {Zone} from '@agoric/zone'; - * @import {CosmosInterchainService} from '@agoric/orchestration'; - * @import {OrchestrationTools} from '../utils/start-helper.js'; - */ - -/** - * @typedef {{ - * localchain: Remote; - * orchestrationService: Remote; - * storageNode: Remote; - * timerService: Remote; - * agoricNames: Remote; - * }} OrchestrationPowers + * @import {OrchestrationPowers, OrchestrationTools} from '../utils/start-helper.js'; */ /** diff --git a/packages/orchestration/src/examples/basic-flows.contract.js b/packages/orchestration/src/examples/basic-flows.contract.js index b1ff6b8613b..60f58cadd1f 100644 --- a/packages/orchestration/src/examples/basic-flows.contract.js +++ b/packages/orchestration/src/examples/basic-flows.contract.js @@ -10,8 +10,7 @@ import * as flows from './basic-flows.flows.js'; /** * @import {Zone} from '@agoric/zone'; - * @import {OrchestrationPowers} from '../utils/start-helper.js'; - * @import {OrchestrationTools} from '../utils/start-helper.js'; + * @import {OrchestrationPowers, OrchestrationTools} from '../utils/start-helper.js'; */ /** diff --git a/packages/orchestration/src/examples/send-anywhere.contract.js b/packages/orchestration/src/examples/send-anywhere.contract.js index 85a9b4f1c26..ebe77f1af7d 100644 --- a/packages/orchestration/src/examples/send-anywhere.contract.js +++ b/packages/orchestration/src/examples/send-anywhere.contract.js @@ -7,24 +7,8 @@ import * as flows from './send-anywhere.flows.js'; import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js'; /** - * @import {TimerService} from '@agoric/time'; - * @import {LocalChain} from '@agoric/vats/src/localchain.js'; - * @import {NameHub} from '@agoric/vats'; - * @import {Remote, Vow} from '@agoric/vow'; * @import {Zone} from '@agoric/zone'; - * @import {VBankAssetDetail} from '@agoric/vats/tools/board-utils.js'; - * @import {CosmosInterchainService} from '../exos/exo-interfaces.js'; - * @import {OrchestrationTools} from '../utils/start-helper.js'; - */ - -/** - * @typedef {{ - * localchain: Remote; - * orchestrationService: Remote; - * storageNode: Remote; - * timerService: Remote; - * agoricNames: Remote; - * }} OrchestrationPowers + * @import {OrchestrationPowers, OrchestrationTools} from '../utils/start-helper.js'; */ export const SingleAmountRecord = M.and( diff --git a/packages/orchestration/src/exos/cosmos-interchain-service.js b/packages/orchestration/src/exos/cosmos-interchain-service.js index 00e8389959c..5724cc9490a 100644 --- a/packages/orchestration/src/exos/cosmos-interchain-service.js +++ b/packages/orchestration/src/exos/cosmos-interchain-service.js @@ -21,7 +21,6 @@ import { prepareICQConnectionKit } from './icq-connection-kit.js'; * @import {Vow, VowTools} from '@agoric/vow'; * @import {ICQConnection, IcaAccount, ICQConnectionKit, IcaAccountKit} from '../types.js'; * @import {ICAChannelAddressOpts} from '../utils/address.js'; - * @import {CosmosInterchainService} from './exo-interfaces.js'; */ const { Vow$ } = NetworkShape; // TODO #9611 diff --git a/packages/orchestration/src/utils/start-helper.js b/packages/orchestration/src/utils/start-helper.js index c281ecee4f5..f11da8db32c 100644 --- a/packages/orchestration/src/utils/start-helper.js +++ b/packages/orchestration/src/utils/start-helper.js @@ -12,7 +12,6 @@ import { makeOrchestrationFacade } from '../facade.js'; import { makeZoeTools } from './zoe-tools.js'; /** - * @import {PromiseKit} from '@endo/promise-kit' * @import {LocalChain} from '@agoric/vats/src/localchain.js'; * @import {TimerService, TimerBrand} from '@agoric/time'; * @import {Baggage} from '@agoric/vat-data';