diff --git a/.pnp.cjs b/.pnp.cjs index 69393a9..92700aa 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -30,6 +30,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "name": "@protokol/nameservice-crypto", "reference": "workspace:packages/nameservice-crypto" }, + { + "name": "@protokol/nameservice-examples", + "reference": "workspace:packages/nameservice-examples" + }, { "name": "@protokol/nameservice-transactions", "reference": "workspace:packages/nameservice-transactions" @@ -41,6 +45,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@protokol/nameservice", ["workspace:."]], ["@protokol/nameservice-api", ["workspace:packages/nameservice-api"]], ["@protokol/nameservice-crypto", ["workspace:packages/nameservice-crypto"]], + ["@protokol/nameservice-examples", ["workspace:packages/nameservice-examples"]], ["@protokol/nameservice-transactions", ["workspace:packages/nameservice-transactions"]] ], "fallbackPool": [ @@ -90,6 +95,19 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["@arkecosystem/client", [ + ["npm:2.0.0", { + "packageLocation": "./.yarn/cache/@arkecosystem-client-npm-2.0.0-209fe4f724-90325d6928.zip/node_modules/@arkecosystem/client/", + "packageDependencies": [ + ["@arkecosystem/client", "npm:2.0.0"], + ["is-url-superb", "npm:4.0.0"], + ["ky", "npm:0.23.0"], + ["ky-universal", "virtual:209fe4f7240ea92f98b62f666c847769f96f763e7ceaa077035307eed7f53bcba5d7d5ec2691c5a964d9ee7695c2e1a618789616b75325aa53c104a184539d70#npm:0.8.2"], + ["node-dotify", "npm:1.1.0"] + ], + "linkType": "HARD", + }] + ]], ["@arkecosystem/core", [ ["npm:3.0.0-next.31", { "packageLocation": "./.yarn/unplugged/@arkecosystem-core-virtual-0d4e673657/node_modules/@arkecosystem/core/", @@ -2770,6 +2788,21 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["@protokol/client", [ + ["npm:1.0.0-beta.42", { + "packageLocation": "./.yarn/cache/@protokol-client-npm-1.0.0-beta.42-ee75437975-f18e49079e.zip/node_modules/@protokol/client/", + "packageDependencies": [ + ["@protokol/client", "npm:1.0.0-beta.42"], + ["@arkecosystem/client", "npm:2.0.0"], + ["is-url-superb", "npm:5.0.0"], + ["ky", "npm:0.25.1"], + ["ky-universal", "virtual:ee754379758a6c2ce6e6fde63d981748708f76d31bc7e9b7ce3e5054491e941f75fe3a8d159ee20b9f6c1243999a8afd402a3b0a8b8054f4dcc6528e899ff69b#npm:0.8.2"], + ["lodash.orderby", "npm:4.6.0"], + ["semver", "npm:7.3.5"] + ], + "linkType": "HARD", + }] + ]], ["@protokol/guardian-api", [ ["npm:1.0.0-beta.41", { "packageLocation": "./.yarn/cache/@protokol-guardian-api-npm-1.0.0-beta.41-0c66d0d5a8-c6ef1a5c5e.zip/node_modules/@protokol/guardian-api/", @@ -2924,6 +2957,23 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "SOFT", }] ]], + ["@protokol/nameservice-examples", [ + ["workspace:packages/nameservice-examples", { + "packageLocation": "./packages/nameservice-examples/", + "packageDependencies": [ + ["@protokol/nameservice-examples", "workspace:packages/nameservice-examples"], + ["@arkecosystem/crypto", "npm:3.0.0-next.31"], + ["@protokol/client", "npm:1.0.0-beta.42"], + ["@protokol/nameservice-crypto", "workspace:packages/nameservice-crypto"], + ["@types/node", "npm:14.17.6"], + ["@types/rimraf", "npm:3.0.1"], + ["rimraf", "npm:3.0.2"], + ["typedoc", "virtual:401f6ffa1ca2fd0b442bef62d2a858d6b2b252168bc6b42e34fd500f1542efe2251a39fb43f04c81240e1cb63ddd49a4b5ee9f7a36a95d5d7a08c347f5698987#npm:0.21.4"], + ["typescript", "patch:typescript@npm%3A4.3.5#~builtin::version=4.3.5&hash=d8b4e7"] + ], + "linkType": "SOFT", + }] + ]], ["@protokol/nameservice-transactions", [ ["workspace:packages/nameservice-transactions", { "packageLocation": "./packages/nameservice-transactions/", @@ -4028,6 +4078,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["abort-controller", [ + ["npm:3.0.0", { + "packageLocation": "./.yarn/cache/abort-controller-npm-3.0.0-2f3a9a2bcb-170bdba9b4.zip/node_modules/abort-controller/", + "packageDependencies": [ + ["abort-controller", "npm:3.0.0"], + ["event-target-shim", "npm:5.0.1"] + ], + "linkType": "HARD", + }] + ]], ["acorn", [ ["npm:7.4.1", { "packageLocation": "./.yarn/cache/acorn-npm-7.4.1-f450b4646c-1860f23c21.zip/node_modules/acorn/", @@ -5095,6 +5155,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["bson-objectid", [ + ["npm:1.3.1", { + "packageLocation": "./.yarn/cache/bson-objectid-npm-1.3.1-15c11421e3-fb31b7c715.zip/node_modules/bson-objectid/", + "packageDependencies": [ + ["bson-objectid", "npm:1.3.1"] + ], + "linkType": "HARD", + }] + ]], ["bstring", [ ["npm:0.3.9", { "packageLocation": "./.yarn/unplugged/bstring-npm-0.3.9-91054b6d6c/node_modules/bstring/", @@ -6064,6 +6133,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["data-uri-to-buffer", "npm:1.2.0"] ], "linkType": "HARD", + }], + ["npm:3.0.1", { + "packageLocation": "./.yarn/cache/data-uri-to-buffer-npm-3.0.1-830646f9ee-c59c300968.zip/node_modules/data-uri-to-buffer/", + "packageDependencies": [ + ["data-uri-to-buffer", "npm:3.0.1"] + ], + "linkType": "HARD", }] ]], ["data-urls", [ @@ -7274,6 +7350,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["event-target-shim", [ + ["npm:5.0.1", { + "packageLocation": "./.yarn/cache/event-target-shim-npm-5.0.1-cb48709025-1ffe3bb22a.zip/node_modules/event-target-shim/", + "packageDependencies": [ + ["event-target-shim", "npm:5.0.1"] + ], + "linkType": "HARD", + }] + ]], ["eventemitter2", [ ["npm:5.0.1", { "packageLocation": "./.yarn/cache/eventemitter2-npm-5.0.1-aa7b2f7474-61cb074b8a.zip/node_modules/eventemitter2/", @@ -7651,6 +7736,26 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["fetch-blob", [ + ["npm:2.1.2", { + "packageLocation": "./.yarn/cache/fetch-blob-npm-2.1.2-2056bf83c5-22d4487ce7.zip/node_modules/fetch-blob/", + "packageDependencies": [ + ["fetch-blob", "npm:2.1.2"] + ], + "linkType": "SOFT", + }], + ["virtual:6d113662d53f111ebc45d76894379672c4bef1024d442c9142fc052527e3a96d54235ec89724f5865223f87cc87cf23a111fa3aa71b23aae42bc577034ca5762#npm:2.1.2", { + "packageLocation": "./.yarn/__virtual__/fetch-blob-virtual-166ee5ce72/0/cache/fetch-blob-npm-2.1.2-2056bf83c5-22d4487ce7.zip/node_modules/fetch-blob/", + "packageDependencies": [ + ["fetch-blob", "virtual:6d113662d53f111ebc45d76894379672c4bef1024d442c9142fc052527e3a96d54235ec89724f5865223f87cc87cf23a111fa3aa71b23aae42bc577034ca5762#npm:2.1.2"], + ["domexception", "npm:2.0.1"] + ], + "packagePeers": [ + "domexception" + ], + "linkType": "HARD", + }] + ]], ["figgy-pudding", [ ["npm:3.5.2", { "packageLocation": "./.yarn/cache/figgy-pudding-npm-3.5.2-2f4e3e1305-4090bd6619.zip/node_modules/figgy-pudding/", @@ -9132,6 +9237,22 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["is-url-superb", [ + ["npm:4.0.0", { + "packageLocation": "./.yarn/cache/is-url-superb-npm-4.0.0-71f6df9bc1-fd55e91c96.zip/node_modules/is-url-superb/", + "packageDependencies": [ + ["is-url-superb", "npm:4.0.0"] + ], + "linkType": "HARD", + }], + ["npm:5.0.0", { + "packageLocation": "./.yarn/cache/is-url-superb-npm-5.0.0-b35332856b-dbd6f7da8a.zip/node_modules/is-url-superb/", + "packageDependencies": [ + ["is-url-superb", "npm:5.0.0"] + ], + "linkType": "HARD", + }] + ]], ["is-windows", [ ["npm:1.0.2", { "packageLocation": "./.yarn/cache/is-windows-npm-1.0.2-898cd6f3d7-438b7e5265.zip/node_modules/is-windows/", @@ -10265,6 +10386,69 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["ky", [ + ["npm:0.23.0", { + "packageLocation": "./.yarn/cache/ky-npm-0.23.0-6fb31c6f15-60d7d2ff55.zip/node_modules/ky/", + "packageDependencies": [ + ["ky", "npm:0.23.0"] + ], + "linkType": "HARD", + }], + ["npm:0.25.1", { + "packageLocation": "./.yarn/cache/ky-npm-0.25.1-40ea38970a-ae1b7bebb4.zip/node_modules/ky/", + "packageDependencies": [ + ["ky", "npm:0.25.1"] + ], + "linkType": "HARD", + }] + ]], + ["ky-universal", [ + ["npm:0.8.2", { + "packageLocation": "./.yarn/cache/ky-universal-npm-0.8.2-66bbf1e939-87ed38c5c5.zip/node_modules/ky-universal/", + "packageDependencies": [ + ["ky-universal", "npm:0.8.2"] + ], + "linkType": "SOFT", + }], + ["virtual:209fe4f7240ea92f98b62f666c847769f96f763e7ceaa077035307eed7f53bcba5d7d5ec2691c5a964d9ee7695c2e1a618789616b75325aa53c104a184539d70#npm:0.8.2", { + "packageLocation": "./.yarn/__virtual__/ky-universal-virtual-68bde43276/0/cache/ky-universal-npm-0.8.2-66bbf1e939-87ed38c5c5.zip/node_modules/ky-universal/", + "packageDependencies": [ + ["ky-universal", "virtual:209fe4f7240ea92f98b62f666c847769f96f763e7ceaa077035307eed7f53bcba5d7d5ec2691c5a964d9ee7695c2e1a618789616b75325aa53c104a184539d70#npm:0.8.2"], + ["@types/ky", null], + ["@types/web-streams-polyfill", null], + ["abort-controller", "npm:3.0.0"], + ["ky", "npm:0.23.0"], + ["node-fetch", "npm:3.0.0-beta.9"], + ["web-streams-polyfill", null] + ], + "packagePeers": [ + "@types/ky", + "@types/web-streams-polyfill", + "ky", + "web-streams-polyfill" + ], + "linkType": "HARD", + }], + ["virtual:ee754379758a6c2ce6e6fde63d981748708f76d31bc7e9b7ce3e5054491e941f75fe3a8d159ee20b9f6c1243999a8afd402a3b0a8b8054f4dcc6528e899ff69b#npm:0.8.2", { + "packageLocation": "./.yarn/__virtual__/ky-universal-virtual-c9b71f8143/0/cache/ky-universal-npm-0.8.2-66bbf1e939-87ed38c5c5.zip/node_modules/ky-universal/", + "packageDependencies": [ + ["ky-universal", "virtual:ee754379758a6c2ce6e6fde63d981748708f76d31bc7e9b7ce3e5054491e941f75fe3a8d159ee20b9f6c1243999a8afd402a3b0a8b8054f4dcc6528e899ff69b#npm:0.8.2"], + ["@types/ky", null], + ["@types/web-streams-polyfill", null], + ["abort-controller", "npm:3.0.0"], + ["ky", "npm:0.25.1"], + ["node-fetch", "npm:3.0.0-beta.9"], + ["web-streams-polyfill", null] + ], + "packagePeers": [ + "@types/ky", + "@types/web-streams-polyfill", + "ky", + "web-streams-polyfill" + ], + "linkType": "HARD", + }] + ]], ["latest-version", [ ["npm:5.1.0", { "packageLocation": "./.yarn/cache/latest-version-npm-5.1.0-ddb9b0eb39-fbc72b071e.zip/node_modules/latest-version/", @@ -10520,6 +10704,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["lodash.orderby", [ + ["npm:4.6.0", { + "packageLocation": "./.yarn/cache/lodash.orderby-npm-4.6.0-725bf1964d-2e0430b07e.zip/node_modules/lodash.orderby/", + "packageDependencies": [ + ["lodash.orderby", "npm:4.6.0"] + ], + "linkType": "HARD", + }] + ]], ["lodash.set", [ ["npm:4.3.2", { "packageLocation": "./.yarn/cache/lodash.set-npm-4.3.2-7586c942c2-a9122f49ee.zip/node_modules/lodash.set/", @@ -11312,7 +11505,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ]], ["ngrok", [ ["npm:3.4.1", { - "packageLocation": "./.yarn/cache/ngrok-npm-3.4.1-fed079aa1a-3d5bada2aa.zip/node_modules/ngrok/", + "packageLocation": "./.yarn/unplugged/ngrok-npm-3.4.1-fed079aa1a/node_modules/ngrok/", "packageDependencies": [ ["ngrok", "npm:3.4.1"], ["@types/node", "npm:8.10.66"], @@ -11372,6 +11565,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["node-dotify", [ + ["npm:1.1.0", { + "packageLocation": "./.yarn/cache/node-dotify-npm-1.1.0-221e3a797f-7ecf0849c8.zip/node_modules/node-dotify/", + "packageDependencies": [ + ["node-dotify", "npm:1.1.0"], + ["bson-objectid", "npm:1.3.1"] + ], + "linkType": "HARD", + }] + ]], ["node-fetch", [ ["npm:2.6.1", { "packageLocation": "./.yarn/cache/node-fetch-npm-2.6.1-46c670dbc1-91075bedd5.zip/node_modules/node-fetch/", @@ -11380,6 +11583,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["domexception", "npm:2.0.1"] ], "linkType": "HARD", + }], + ["npm:3.0.0-beta.9", { + "packageLocation": "./.yarn/cache/node-fetch-npm-3.0.0-beta.9-6d113662d5-586af09106.zip/node_modules/node-fetch/", + "packageDependencies": [ + ["node-fetch", "npm:3.0.0-beta.9"], + ["data-uri-to-buffer", "npm:3.0.1"], + ["domexception", "npm:2.0.1"], + ["fetch-blob", "virtual:6d113662d53f111ebc45d76894379672c4bef1024d442c9142fc052527e3a96d54235ec89724f5865223f87cc87cf23a111fa3aa71b23aae42bc577034ca5762#npm:2.1.2"] + ], + "linkType": "HARD", }] ]], ["node-forge", [ @@ -12826,7 +13039,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ]], ["protobufjs", [ ["npm:6.10.2", { - "packageLocation": "./.yarn/cache/protobufjs-npm-6.10.2-f0f2cab7fe-b48257c905.zip/node_modules/protobufjs/", + "packageLocation": "./.yarn/unplugged/protobufjs-npm-6.10.2-f0f2cab7fe/node_modules/protobufjs/", "packageDependencies": [ ["protobufjs", "npm:6.10.2"], ["@protobufjs/aspromise", "npm:1.1.2"], diff --git a/.yarn/cache/@arkecosystem-client-npm-2.0.0-209fe4f724-90325d6928.zip b/.yarn/cache/@arkecosystem-client-npm-2.0.0-209fe4f724-90325d6928.zip new file mode 100644 index 0000000..f4acd0d Binary files /dev/null and b/.yarn/cache/@arkecosystem-client-npm-2.0.0-209fe4f724-90325d6928.zip differ diff --git a/.yarn/cache/@protokol-client-npm-1.0.0-beta.42-ee75437975-f18e49079e.zip b/.yarn/cache/@protokol-client-npm-1.0.0-beta.42-ee75437975-f18e49079e.zip new file mode 100644 index 0000000..102aeae Binary files /dev/null and b/.yarn/cache/@protokol-client-npm-1.0.0-beta.42-ee75437975-f18e49079e.zip differ diff --git a/.yarn/cache/abort-controller-npm-3.0.0-2f3a9a2bcb-170bdba9b4.zip b/.yarn/cache/abort-controller-npm-3.0.0-2f3a9a2bcb-170bdba9b4.zip new file mode 100644 index 0000000..c9b0273 Binary files /dev/null and b/.yarn/cache/abort-controller-npm-3.0.0-2f3a9a2bcb-170bdba9b4.zip differ diff --git a/.yarn/cache/bson-objectid-npm-1.3.1-15c11421e3-fb31b7c715.zip b/.yarn/cache/bson-objectid-npm-1.3.1-15c11421e3-fb31b7c715.zip new file mode 100644 index 0000000..b73217f Binary files /dev/null and b/.yarn/cache/bson-objectid-npm-1.3.1-15c11421e3-fb31b7c715.zip differ diff --git a/.yarn/cache/data-uri-to-buffer-npm-3.0.1-830646f9ee-c59c300968.zip b/.yarn/cache/data-uri-to-buffer-npm-3.0.1-830646f9ee-c59c300968.zip new file mode 100644 index 0000000..7ce295f Binary files /dev/null and b/.yarn/cache/data-uri-to-buffer-npm-3.0.1-830646f9ee-c59c300968.zip differ diff --git a/.yarn/cache/event-target-shim-npm-5.0.1-cb48709025-1ffe3bb22a.zip b/.yarn/cache/event-target-shim-npm-5.0.1-cb48709025-1ffe3bb22a.zip new file mode 100644 index 0000000..565cdc6 Binary files /dev/null and b/.yarn/cache/event-target-shim-npm-5.0.1-cb48709025-1ffe3bb22a.zip differ diff --git a/.yarn/cache/fetch-blob-npm-2.1.2-2056bf83c5-22d4487ce7.zip b/.yarn/cache/fetch-blob-npm-2.1.2-2056bf83c5-22d4487ce7.zip new file mode 100644 index 0000000..023dac8 Binary files /dev/null and b/.yarn/cache/fetch-blob-npm-2.1.2-2056bf83c5-22d4487ce7.zip differ diff --git a/.yarn/cache/is-url-superb-npm-4.0.0-71f6df9bc1-fd55e91c96.zip b/.yarn/cache/is-url-superb-npm-4.0.0-71f6df9bc1-fd55e91c96.zip new file mode 100644 index 0000000..48941ef Binary files /dev/null and b/.yarn/cache/is-url-superb-npm-4.0.0-71f6df9bc1-fd55e91c96.zip differ diff --git a/.yarn/cache/is-url-superb-npm-5.0.0-b35332856b-dbd6f7da8a.zip b/.yarn/cache/is-url-superb-npm-5.0.0-b35332856b-dbd6f7da8a.zip new file mode 100644 index 0000000..a3b46ec Binary files /dev/null and b/.yarn/cache/is-url-superb-npm-5.0.0-b35332856b-dbd6f7da8a.zip differ diff --git a/.yarn/cache/ky-npm-0.23.0-6fb31c6f15-60d7d2ff55.zip b/.yarn/cache/ky-npm-0.23.0-6fb31c6f15-60d7d2ff55.zip new file mode 100644 index 0000000..5918a43 Binary files /dev/null and b/.yarn/cache/ky-npm-0.23.0-6fb31c6f15-60d7d2ff55.zip differ diff --git a/.yarn/cache/ky-npm-0.25.1-40ea38970a-ae1b7bebb4.zip b/.yarn/cache/ky-npm-0.25.1-40ea38970a-ae1b7bebb4.zip new file mode 100644 index 0000000..7bca876 Binary files /dev/null and b/.yarn/cache/ky-npm-0.25.1-40ea38970a-ae1b7bebb4.zip differ diff --git a/.yarn/cache/ky-universal-npm-0.8.2-66bbf1e939-87ed38c5c5.zip b/.yarn/cache/ky-universal-npm-0.8.2-66bbf1e939-87ed38c5c5.zip new file mode 100644 index 0000000..ccac138 Binary files /dev/null and b/.yarn/cache/ky-universal-npm-0.8.2-66bbf1e939-87ed38c5c5.zip differ diff --git a/.yarn/cache/lodash.orderby-npm-4.6.0-725bf1964d-2e0430b07e.zip b/.yarn/cache/lodash.orderby-npm-4.6.0-725bf1964d-2e0430b07e.zip new file mode 100644 index 0000000..650b93f Binary files /dev/null and b/.yarn/cache/lodash.orderby-npm-4.6.0-725bf1964d-2e0430b07e.zip differ diff --git a/.yarn/cache/node-dotify-npm-1.1.0-221e3a797f-7ecf0849c8.zip b/.yarn/cache/node-dotify-npm-1.1.0-221e3a797f-7ecf0849c8.zip new file mode 100644 index 0000000..f58f693 Binary files /dev/null and b/.yarn/cache/node-dotify-npm-1.1.0-221e3a797f-7ecf0849c8.zip differ diff --git a/.yarn/cache/node-fetch-npm-3.0.0-beta.9-6d113662d5-586af09106.zip b/.yarn/cache/node-fetch-npm-3.0.0-beta.9-6d113662d5-586af09106.zip new file mode 100644 index 0000000..5d4c3bf Binary files /dev/null and b/.yarn/cache/node-fetch-npm-3.0.0-beta.9-6d113662d5-586af09106.zip differ diff --git a/packages/nameservice-examples/LICENSE b/packages/nameservice-examples/LICENSE new file mode 100644 index 0000000..e9b698f --- /dev/null +++ b/packages/nameservice-examples/LICENSE @@ -0,0 +1,22 @@ +# License +=============== + +This work is licensed under [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/), under the following terms: + +Attribution +--------------- +You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. + +NonCommercial +--------------- +You may not use the material for commercial purposes. For commercial purposes please reach out to info@protokol.com. + +ShareAlike +--------------- +If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. + +Legal code +--------------- +Read the rest of the obligatory [license legal code](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). + +Copyright (c) Protokol.com 2021 diff --git a/packages/nameservice-examples/README.md b/packages/nameservice-examples/README.md new file mode 100644 index 0000000..0903dba --- /dev/null +++ b/packages/nameservice-examples/README.md @@ -0,0 +1,27 @@ +[![License: CC BY-NC-SA 4.0](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/) + +# NAMESERVICE-EXAMPLES + +# License + +[![License: CC BY-NC-SA 4.0](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/) + +This work is licensed under [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/), under the following terms: + +#### Attribution + +You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. + +#### NonCommercial + +You may not use the material for commercial purposes. For commercial purposes please reach out to info@protokol.com. + +#### ShareAlike + +If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. + +#### Legal code + +Read the rest of the obligatory [license legal code](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). + +Copyright (c) Protokol.com 2021 diff --git a/packages/nameservice-examples/package.json b/packages/nameservice-examples/package.json new file mode 100644 index 0000000..9b9fea6 --- /dev/null +++ b/packages/nameservice-examples/package.json @@ -0,0 +1,52 @@ +{ + "name": "@protokol/nameservice-examples", + "private": true, + "version": "1.0.0-beta.2", + "description": "Examples for Nameservice Transactions", + "license": "CC-BY-NC-SA-4.0", + "bugs": { + "url": "https://github.com/protokol/nameservice/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/protokol/nameservice.git" + }, + "keywords": [ + "protokol", + "ark", + "core", + "sdk", + "nameservice", + "blockchain", + "examples" + ], + "contributors": [ + "Žan Kovač ", + "Kristjan Košič " + ], + "files": [ + "dist" + ], + "main": "dist/index", + "types": "dist/index", + "scripts": { + "build": "yarn clean && tsc", + "build:watch": "yarn build -w", + "build:docs": "typedoc --out docs src", + "clean": "rimraf .coverage dist tmp", + "test": "jest" + }, + "dependencies": { + "@arkecosystem/crypto": "^3.0.0-next", + "@protokol/client": "^1.0.0-beta.39", + "@protokol/nameservice-crypto": "workspace:packages/nameservice-crypto" + }, + "devDependencies": { + "@types/node": "^14.14.31", + "@types/rimraf": "^3.0.0", + "rimraf": "^3.0.2", + "typedoc": "~0.21.0", + "typescript": "~4.3.2" + } +} diff --git a/packages/nameservice-examples/src/index.ts b/packages/nameservice-examples/src/index.ts new file mode 100644 index 0000000..cc9fc81 --- /dev/null +++ b/packages/nameservice-examples/src/index.ts @@ -0,0 +1,48 @@ +import { Identities, Managers, Transactions, Utils } from "@arkecosystem/crypto"; +import { ProtokolConnection } from "@protokol/client"; +import { Builders, Transactions as NameserviceTransactions } from "@protokol/nameservice-crypto"; + +export const Nameservice = async (): Promise => { + // Configure our API client + const client = new ProtokolConnection("http://localhost:4003/api"); + const passphrase = "clay harbor enemy utility margin pretty hub comic piece aerobic umbrella acquire"; + + // Configure manager and register transaction type + const configs = await client.api("node").crypto(); + const { + body: { + data: { + block: { height }, + }, + }, + } = await client.get("blockchain"); + + Managers.configManager.setConfig({ ...configs.body.data } as any); + Managers.configManager.setHeight(height); + Transactions.TransactionRegistry.registerTransactionType(NameserviceTransactions.NameserviceTransaction); + + // Step 1: Retrieve the nonce of the sender wallet + const senderWallet = await client.api("wallets").get(Identities.Address.fromPassphrase(passphrase)); + const senderNonce = Utils.BigNumber.make(senderWallet.body.data.nonce).plus(1); + + // Step 2: Create the transaction + const transaction = new Builders.NameserviceBuilder() + .Nameservice({ + name: "zan", + }) + .nonce(senderNonce.toFixed()) + .sign(passphrase); + + // Step 3: Broadcast the transaction + const broadcastResponse = await client.api("transactions").create({ transactions: [transaction.build().toJson()] }); + + // Step 4: Log the response + console.log(JSON.stringify(broadcastResponse.body, null, 4)); +}; + +Nameservice() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/packages/nameservice-examples/tsconfig.json b/packages/nameservice-examples/tsconfig.json new file mode 100644 index 0000000..0b089c5 --- /dev/null +++ b/packages/nameservice-examples/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist" + }, + "include": ["src/**/**.ts"] +} diff --git a/yarn.lock b/yarn.lock index 133d449..8310a28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14,6 +14,18 @@ __metadata: languageName: node linkType: hard +"@arkecosystem/client@npm:2.0.0": + version: 2.0.0 + resolution: "@arkecosystem/client@npm:2.0.0" + dependencies: + is-url-superb: ^4.0.0 + ky: ^0.23.0 + ky-universal: ^0.8.2 + node-dotify: ^1.0.2 + checksum: 90325d692888d43ad01c91eabab1352bbb1c8b071967bab01bafbaff1191df8bf0cb42ba19dcfbe86a82df50655fdca1222d1f2ec69e6b93187563ef40b48cde + languageName: node + linkType: hard + "@arkecosystem/core-api@npm:^3.0.0-next, @arkecosystem/core-api@npm:^3.0.0-next.31, @arkecosystem/core-api@npm:next": version: 3.0.0-next.31 resolution: "@arkecosystem/core-api@npm:3.0.0-next.31" @@ -2187,6 +2199,20 @@ __metadata: languageName: node linkType: hard +"@protokol/client@npm:^1.0.0-beta.39": + version: 1.0.0-beta.42 + resolution: "@protokol/client@npm:1.0.0-beta.42" + dependencies: + "@arkecosystem/client": 2.0.0 + is-url-superb: ^5.0.0 + ky: ^0.25.0 + ky-universal: ^0.8.2 + lodash.orderby: ^4.6.0 + semver: ^7.3.2 + checksum: f18e49079e799ef36f1eece5ab22a144d6d156255fb9f3e739ebbb6cbb99dbd4dfb0582689b5bfff27c6f5dc909d2f45fe21dcdc590bf0b49f5b46a83afea5ef + languageName: node + linkType: hard + "@protokol/guardian-api@npm:beta": version: 1.0.0-beta.41 resolution: "@protokol/guardian-api@npm:1.0.0-beta.41" @@ -2299,6 +2325,21 @@ __metadata: languageName: unknown linkType: soft +"@protokol/nameservice-examples@workspace:packages/nameservice-examples": + version: 0.0.0-use.local + resolution: "@protokol/nameservice-examples@workspace:packages/nameservice-examples" + dependencies: + "@arkecosystem/crypto": ^3.0.0-next + "@protokol/client": ^1.0.0-beta.39 + "@protokol/nameservice-crypto": "workspace:packages/nameservice-crypto" + "@types/node": ^14.14.31 + "@types/rimraf": ^3.0.0 + rimraf: ^3.0.2 + typedoc: ~0.21.0 + typescript: ~4.3.2 + languageName: unknown + linkType: soft + "@protokol/nameservice-transactions@workspace:packages/nameservice-transactions": version: 0.0.0-use.local resolution: "@protokol/nameservice-transactions@workspace:packages/nameservice-transactions" @@ -3233,6 +3274,15 @@ __metadata: languageName: node linkType: hard +"abort-controller@npm:^3.0.0": + version: 3.0.0 + resolution: "abort-controller@npm:3.0.0" + dependencies: + event-target-shim: ^5.0.0 + checksum: 170bdba9b47b7e65906a28c8ce4f38a7a369d78e2271706f020849c1bfe0ee2067d4261df8bbb66eb84f79208fd5b710df759d64191db58cfba7ce8ef9c54b75 + languageName: node + linkType: hard + "acorn-globals@npm:^6.0.0": version: 6.0.0 resolution: "acorn-globals@npm:6.0.0" @@ -4113,6 +4163,13 @@ __metadata: languageName: node linkType: hard +"bson-objectid@npm:^1.3.1": + version: 1.3.1 + resolution: "bson-objectid@npm:1.3.1" + checksum: fb31b7c715fafd7ba4370f667fbdc3cf9226d8b9d115ac86d584053fe9350f73d24e0b6ddac388b3c408d91481f52a8ab7a8c103c4b8dbc659139c710689a7c0 + languageName: node + linkType: hard + "bstring@npm:^0.3.9": version: 0.3.9 resolution: "bstring@npm:0.3.9" @@ -4985,6 +5042,13 @@ __metadata: languageName: node linkType: hard +"data-uri-to-buffer@npm:^3.0.1": + version: 3.0.1 + resolution: "data-uri-to-buffer@npm:3.0.1" + checksum: c59c3009686a78c071806b72f4810856ec28222f0f4e252aa495ec027ed9732298ceea99c50328cf59b151dd34cbc3ad6150bbb43e41fc56fa19f48c99e9fc30 + languageName: node + linkType: hard + "data-urls@npm:^2.0.0": version: 2.0.0 resolution: "data-urls@npm:2.0.0" @@ -5910,6 +5974,13 @@ __metadata: languageName: node linkType: hard +"event-target-shim@npm:^5.0.0": + version: 5.0.1 + resolution: "event-target-shim@npm:5.0.1" + checksum: 1ffe3bb22a6d51bdeb6bf6f7cf97d2ff4a74b017ad12284cc9e6a279e727dc30a5de6bb613e5596ff4dc3e517841339ad09a7eec44266eccb1aa201a30448166 + languageName: node + linkType: hard + "eventemitter2@npm:^5.0.1": version: 5.0.1 resolution: "eventemitter2@npm:5.0.1" @@ -6246,6 +6317,16 @@ __metadata: languageName: node linkType: hard +"fetch-blob@npm:^2.1.1": + version: 2.1.2 + resolution: "fetch-blob@npm:2.1.2" + peerDependenciesMeta: + domexception: + optional: true + checksum: 22d4487ce78ea4e52b432b0057d8d42922d5d93c0374b0bc2692cebdcb11bf8fac4f6d141b31f1633db1e9212effd38385adbd765a2c7412a621307058499214 + languageName: node + linkType: hard + "figgy-pudding@npm:^3.5.1": version: 3.5.2 resolution: "figgy-pudding@npm:3.5.2" @@ -7580,6 +7661,20 @@ fsevents@~2.1.2: languageName: node linkType: hard +"is-url-superb@npm:^4.0.0": + version: 4.0.0 + resolution: "is-url-superb@npm:4.0.0" + checksum: fd55e91c96349acb0d688f95fcb1ac67450e5db934976e3a8ff13ef446841e779a6f4d18b15f02331f05a3429c8fdaba2382ac1ab444059e86e9ffcde1ec8db0 + languageName: node + linkType: hard + +"is-url-superb@npm:^5.0.0": + version: 5.0.0 + resolution: "is-url-superb@npm:5.0.0" + checksum: dbd6f7da8ac7eb95582d9534db43cdee60f9a2cf8b9eac5f14a20e7c13bc08681a1061b0ee03cf63a0811bb464f64389c49474263860011a41d32b398f7905a5 + languageName: node + linkType: hard + "is-windows@npm:^1.0.2": version: 1.0.2 resolution: "is-windows@npm:1.0.2" @@ -8616,6 +8711,36 @@ fsevents@~2.1.2: languageName: node linkType: hard +"ky-universal@npm:^0.8.2": + version: 0.8.2 + resolution: "ky-universal@npm:0.8.2" + dependencies: + abort-controller: ^3.0.0 + node-fetch: 3.0.0-beta.9 + peerDependencies: + ky: ">=0.17.0" + web-streams-polyfill: ">=2.0.0" + peerDependenciesMeta: + web-streams-polyfill: + optional: true + checksum: 87ed38c5c5a5b4448502fd5a64b68f30db69d366e148e5321cd9c0cb57d616519578ff0ae50146ff92ad037ef5cd77fbc40d893675459eead0d3f13101374570 + languageName: node + linkType: hard + +"ky@npm:^0.23.0": + version: 0.23.0 + resolution: "ky@npm:0.23.0" + checksum: 60d7d2ff554b3eb8e1520d77f25f19b073bdac2f42fa5d6f2c6ee1d3798eaa9641fff25ce10f35db8181f816f2a456ed195edaadc8ce8e4841487f319ab515ea + languageName: node + linkType: hard + +"ky@npm:^0.25.0": + version: 0.25.1 + resolution: "ky@npm:0.25.1" + checksum: ae1b7bebb48001d00d53e386e077939eeef7398a36b4fb45660f988ddb17d583d077290f2adb9706b4761f9d3b74918eb8d9f45ce799760143e104e1053b33ef + languageName: node + linkType: hard + "latest-version@npm:^5.1.0": version: 5.1.0 resolution: "latest-version@npm:5.1.0" @@ -8824,6 +8949,13 @@ fsevents@~2.1.2: languageName: node linkType: hard +"lodash.orderby@npm:^4.6.0": + version: 4.6.0 + resolution: "lodash.orderby@npm:4.6.0" + checksum: 2e0430b07eb575e9cef9c0a8937db82857bb741d0680baf58f99d4731092c11b103f95cbeeb9cdd207514701bd925b5c71eb81044df97b7e36a3735a3484fb8f + languageName: node + linkType: hard + "lodash.set@npm:^4.3.2": version: 4.3.2 resolution: "lodash.set@npm:4.3.2" @@ -9603,6 +9735,25 @@ fsevents@~2.1.2: languageName: node linkType: hard +"node-dotify@npm:^1.0.2": + version: 1.1.0 + resolution: "node-dotify@npm:1.1.0" + dependencies: + bson-objectid: ^1.3.1 + checksum: 7ecf0849c8990a6cd1a5e2c852012b93102c8a14ef97fcfa92a6a15f9ee6f50e24f907549cb815a0b60dde6f888681ea3d9d42424d3deb92cd7ce5e8d05cd3b0 + languageName: node + linkType: hard + +"node-fetch@npm:3.0.0-beta.9": + version: 3.0.0-beta.9 + resolution: "node-fetch@npm:3.0.0-beta.9" + dependencies: + data-uri-to-buffer: ^3.0.1 + fetch-blob: ^2.1.1 + checksum: 586af0910649cb62f1c044ddac41e71c0b0f48133fba406ad5e0fab51baff18f22cd187ea65ef690ceed7386a71910e904348105dc8eae55f907fa94df7e76ca + languageName: node + linkType: hard + "node-fetch@npm:^2.6.1": version: 2.6.1 resolution: "node-fetch@npm:2.6.1"