repoName
stringlengths
7
77
tree
stringlengths
0
2.85M
readme
stringlengths
0
4.9M
near-examples_cross-contract-hello-js
.github workflows tests.yml .gitpod.yml README.md contract README.md build.sh deploy.sh package.json src contract.ts tsconfig.json integration-tests package.json src main.ava.ts package.json
# 📞 Cross-Contract Hello [![](https://img.shields.io/badge/⋈%20Examples-Basics-green)](https://docs.near.org/tutorials/welcome) [![](https://img.shields.io/badge/Gitpod-Ready-orange)](https://gitpod.io/#/https://github.com/near-examples/xcc-js) [![](https://img.shields.io/badge/Contract-js-yellow)](https://docs.near.org/develop/contracts/anatomy) [![](https://img.shields.io/badge/Frontend-none-inactive)](#) [![](https://img.shields.io/badge/Testing-passing-green)](https://docs.near.org/develop/integrate/frontend) The smart contract implements the simplest form of cross-contract calls: it calls the [Hello NEAR example](https://docs.near.org/tutorials/examples/hello-near) to get and set a greeting. ![](https://docs.near.org/assets/images/hello-near-banner-af016d03e81a65653c9230b95a05fe4a.png) # What This Example Shows 1. How to query information from an external contract. 2. How to interact with an external contract. <br /> # Quickstart Clone this repository locally or [**open it in gitpod**](https://gitpod.io/#/https://github.com/near-examples/xcc-js). Then follow these steps: ### 1. Install Dependencies ```bash npm install ``` ### 2. Test the Contract Deploy your contract in a sandbox and simulate interactions from users. ```bash npm test ``` ### 3. Deploy the Contract Build the contract and deploy it in a testnet account ```bash npm run deploy ``` ### 4. Interact With the Contract Ask the contract to perform a cross-contract call to query or change the greeting in Hello NEAR. ```bash # Use near-cli to ask the contract to query te greeting near call <dev-account> query_greeting --accountId <dev-account> # Use near-cli to set increment the counter near call <dev-account> change_greeting '{"new_greeting":"XCC Hi"}' --accountId <dev-account> ``` --- # Learn More 1. Learn more about the contract through its [README](./contract/README.md). 2. Check [**our documentation**](https://docs.near.org/develop/welcome). # Cross-Contract Hello Contract The smart contract implements the simplest form of cross-contract calls: it calls the [Hello NEAR example](https://docs.near.org/tutorials/examples/hello-near) to get and set a greeting. ```ts @call query_greeting() { const call = near.promiseBatchCreate(this.hello_account); near.promiseBatchActionFunctionCall(call, "get_greeting", bytes(JSON.stringify({})), 0, 5 * TGAS); const then = near.promiseThen(call, near.currentAccountId(), "query_greeting_callback", bytes(JSON.stringify({})), 0, 5 * TGAS); return near.promiseReturn(then); } @call query_greeting_callback() { assert(near.currentAccountId() === near.predecessorAccountId(), "This is a private method"); const greeting = near.promiseResult(0) as String; return greeting.substring(1, greeting.length-1); } @call change_greeting({ new_greeting }: { new_greeting: string }) { const call = near.promiseBatchCreate(this.hello_account); near.promiseBatchActionFunctionCall(call, "set_greeting", bytes(JSON.stringify({ greeting: new_greeting })), 0, 5 * TGAS); const then = near.promiseThen(call, near.currentAccountId(), "change_greeting_callback", bytes(JSON.stringify({})), 0, 5 * TGAS); return near.promiseReturn(then); } @call change_greeting_callback() { assert(near.currentAccountId() === near.predecessorAccountId(), "This is a private method"); if (near.promiseResultsCount() == BigInt(1)) { near.log("Promise was successful!") return true } else { near.log("Promise failed...") return false } } ``` <br /> # Quickstart 1. Make sure you have installed [node.js](https://nodejs.org/en/download/package-manager/) >= 16. 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash npm run deploy ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # dev-1659899566943-21539992274727 ``` <br /> ## 2. Get the Greeting `query_greeting` performs a cross-contract call, calling the `get_greeting()` method from `hello-nearverse.testnet`. `Call` methods can only be invoked using a NEAR account, since the account needs to pay GAS for the transaction. ```bash # Use near-cli to ask the contract to query the greeting near call <dev-account> query_greeting --accountId <dev-account> ``` <br /> ## 3. Set a New Greeting `change_greeting` performs a cross-contract call, calling the `set_greeting({greeting:String})` method from `hello-nearverse.testnet`. `Call` methods can only be invoked using a NEAR account, since the account needs to pay GAS for the transaction. ```bash # Use near-cli to change the greeting near call <dev-account> change_greeting '{"new_greeting":"XCC Hi"}' --accountId <dev-account> ``` **Tip:** If you would like to call `change_greeting` or `query_greeting` using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`.
kquan99dk_challenge2-mintnft
.gitpod.yml README.md babel.config.js contract Cargo.toml README.md compile.js src approval.rs enumeration.rs internal.rs lib.rs metadata.rs mint.rs nft_core.rs royalty.rs target .rustc_info.json debug .fingerprint Inflector-9e3c62115074b9cf lib-inflector.json Inflector-c436f7f0ac4cac71 lib-inflector.json ahash-1967cc04c22c18c6 lib-ahash.json aho-corasick-dfd7d94436316217 lib-aho_corasick.json autocfg-9256c11c5a94315c lib-autocfg.json autocfg-cd255646c4ed3339 lib-autocfg.json base64-71c90ac137df990d lib-base64.json block-buffer-7cdf9178091a7da1 lib-block-buffer.json block-buffer-fecb4b6366e32b09 lib-block-buffer.json block-padding-62081e46e84fb085 lib-block-padding.json borsh-455d723f2e7eb382 lib-borsh.json borsh-derive-4ceaabc5dd04bd8c lib-borsh-derive.json borsh-derive-5ae16aa117c7f399 lib-borsh-derive.json borsh-derive-internal-a4b50dd4391e6a8d lib-borsh-derive-internal.json borsh-derive-internal-d0a21fc13ecc1b98 lib-borsh-derive-internal.json borsh-schema-derive-internal-ab395ab8b11e5be3 lib-borsh-schema-derive-internal.json borsh-schema-derive-internal-f225755753cda604 lib-borsh-schema-derive-internal.json bs58-69a66f084a652b72 lib-bs58.json byte-tools-1d047ab32bad91f7 lib-byte-tools.json byteorder-390f4de49b33fbe5 build-script-build-script-build.json byteorder-d171a414cbddb916 lib-byteorder.json byteorder-d77aa010d83d8b2e run-build-script-build-script-build.json byteorder-f262064c186a8c75 build-script-build-script-build.json cfg-if-3cd7bda968e519ae lib-cfg-if.json cfg-if-d11314982639f912 lib-cfg-if.json convert_case-6aefe2f3d987d223 lib-convert_case.json convert_case-95e284bc56c12eb5 lib-convert_case.json cpuid-bool-2e91630d513571a1 lib-cpuid-bool.json derive_more-5255bfa3b62e923e lib-derive_more.json derive_more-69cde6e327ff0a85 lib-derive_more.json digest-004be3906fa4cc02 lib-digest.json digest-7c0db2823bd46ffa lib-digest.json generic-array-092d57466d24febe build-script-build-script-build.json generic-array-2ca012656fd96d03 lib-generic_array.json generic-array-2ca68d944663b98e build-script-build-script-build.json generic-array-581aa29a40d86c87 lib-generic_array.json generic-array-edaf070b8515c940 run-build-script-build-script-build.json greeter-ca56de37fb9aeb98 test-lib-greeter.json greeter-d872d1ed9224c2e4 lib-greeter.json hashbrown-23b6f330e2a36dbb run-build-script-build-script-build.json hashbrown-376c4e72037f389f run-build-script-build-script-build.json hashbrown-62d2794599d0b3a5 lib-hashbrown.json hashbrown-a3aee600bf90c851 build-script-build-script-build.json hashbrown-a8671ea72407354d lib-hashbrown.json hashbrown-b14545ff43de8045 lib-hashbrown.json hashbrown-cdcf863ec2cdd3e4 build-script-build-script-build.json hashbrown-d487e72206b07264 lib-hashbrown.json hex-b14a6cc6710b1be9 lib-hex.json indexmap-1e685d288818a816 lib-indexmap.json indexmap-8c9f9453652d0887 run-build-script-build-script-build.json indexmap-a39c0fe53f69676f lib-indexmap.json indexmap-b5b2936f08563f02 run-build-script-build-script-build.json indexmap-c3ac49ead90ef7d0 build-script-build-script-build.json indexmap-d783966786b01c6b build-script-build-script-build.json indexmap-f66d4c008314b4ba lib-indexmap.json itoa-334a999bacc48d3a lib-itoa.json itoa-b06d4cff304254a3 lib-itoa.json itoa-b43a70e1308d4059 lib-itoa.json keccak-9486c3b3fabd92f5 lib-keccak.json lazy_static-c4fa5978e157842d lib-lazy_static.json libc-776832e16d6fe779 run-build-script-build-script-build.json libc-ab145babf30c9e9f build-script-build-script-build.json libc-bb09fb4e126f2d8a lib-libc.json memchr-035c4269a6233099 build-script-build-script-build.json memchr-18021bf2e0504af3 build-script-build-script-build.json memchr-88cbb3a1f07aeacc run-build-script-build-script-build.json memchr-c4478d63a1e0bded lib-memchr.json memory_units-7cdfc6b494713aeb lib-memory_units.json near-primitives-core-1a9927e20e4cca2f lib-near-primitives-core.json near-rpc-error-core-b63ef2006bff2a54 lib-near-rpc-error-core.json near-rpc-error-core-d66a3bd0b42b0618 lib-near-rpc-error-core.json near-rpc-error-macro-379a6a754086af95 lib-near-rpc-error-macro.json near-rpc-error-macro-438c4d8046055ab7 lib-near-rpc-error-macro.json near-runtime-utils-cfaecdd6308100c9 lib-near-runtime-utils.json near-sdk-75db23ee92788818 lib-near-sdk.json near-sdk-core-05f819364f7a560b lib-near-sdk-core.json near-sdk-core-f46d7222a619c60b lib-near-sdk-core.json near-sdk-macros-67a465e716adb526 lib-near-sdk-macros.json near-sdk-macros-c527437a538e59b5 lib-near-sdk-macros.json near-vm-errors-6c4e1c3aa31b46a6 lib-near-vm-errors.json near-vm-logic-7b9cae9ded7ffed2 lib-near-vm-logic.json num-bigint-24878def5e0a4e95 run-build-script-build-script-build.json num-bigint-2ecc5aa16ac5fa11 build-script-build-script-build.json num-bigint-d69df36f763339d9 build-script-build-script-build.json num-bigint-e6063b2824ca7f78 lib-num-bigint.json num-integer-0dc92eae980549ce build-script-build-script-build.json num-integer-733a54d88eb397d7 build-script-build-script-build.json num-integer-857b4d0c0fb1ebb2 lib-num-integer.json num-integer-bfcb27fa88a06435 run-build-script-build-script-build.json num-rational-53d8c28e51e4edeb lib-num-rational.json num-rational-5cee69414ba13397 build-script-build-script-build.json num-rational-ae7f1682837cfa6a build-script-build-script-build.json num-rational-e41c1ae7c12fd05a run-build-script-build-script-build.json num-traits-148ddaa8ac8aed3d build-script-build-script-build.json num-traits-4b4399d154f5b10c build-script-build-script-build.json num-traits-8ada646017a565de lib-num-traits.json num-traits-e9e69ac574c21b5e run-build-script-build-script-build.json opaque-debug-40ef33ab5d5455d5 lib-opaque-debug.json opaque-debug-9f33558de634ada2 lib-opaque-debug.json proc-macro-crate-12334d71f27edc5f lib-proc-macro-crate.json proc-macro-crate-f8a29538f3d5d264 lib-proc-macro-crate.json proc-macro2-199e7d79ea890f98 build-script-build-script-build.json proc-macro2-3fad645d9b421e8e run-build-script-build-script-build.json proc-macro2-5fcfb2a46c5df79c build-script-build-script-build.json proc-macro2-666f73db07a53a8d lib-proc-macro2.json proc-macro2-bd2c37d8933f4808 run-build-script-build-script-build.json proc-macro2-c9e8a8bd316f311f lib-proc-macro2.json quote-577c40b40ecd60bd lib-quote.json quote-9bda4ac1e186b791 lib-quote.json regex-2da0ebf3876e69eb lib-regex.json regex-syntax-4674515918c0a7b3 lib-regex-syntax.json ryu-05927dde86fed045 run-build-script-build-script-build.json ryu-218129458e3751da run-build-script-build-script-build.json ryu-71b733cfce4d5fb9 build-script-build-script-build.json ryu-78844ca83f6bd916 lib-ryu.json ryu-9d8a66d1893ee378 lib-ryu.json ryu-a617547c15767d1a build-script-build-script-build.json ryu-b54e014f019506d7 lib-ryu.json serde-04ff27b5376387bd lib-serde.json serde-283b18786897374f lib-serde.json serde-4e5700cebad65fe6 run-build-script-build-script-build.json serde-552ea552149e1a4d build-script-build-script-build.json serde-61b3756bc6d1e581 lib-serde.json serde-b99429f97a9b8ecc run-build-script-build-script-build.json serde-ce79dbda8006d582 build-script-build-script-build.json serde_derive-0735097b743a1fb7 build-script-build-script-build.json serde_derive-3fa5b2f0604dda9d lib-serde_derive.json serde_derive-4f31ad7a0e5ec105 build-script-build-script-build.json serde_derive-9dbff8f6028e8a2c run-build-script-build-script-build.json serde_derive-a081d5fd2c137a9a run-build-script-build-script-build.json serde_derive-ea52ca527bcbc75e lib-serde_derive.json serde_json-17657cb37f02500a lib-serde_json.json serde_json-5c67599c92665964 lib-serde_json.json serde_json-8d57a558bc719086 run-build-script-build-script-build.json serde_json-bf5b0064d1b45776 run-build-script-build-script-build.json serde_json-c83f8bc67b0f9037 lib-serde_json.json serde_json-e672e5dc6dad8890 build-script-build-script-build.json serde_json-e9017e2e6ab453c7 build-script-build-script-build.json sha2-ce147e528dceb8c1 lib-sha2.json sha3-69ffdc009f5fc5f1 lib-sha3.json syn-0359a400ed92222f build-script-build-script-build.json syn-5d4f461e709da010 lib-syn.json syn-60a21e1eff858db6 lib-syn.json syn-84879f3141fd595e run-build-script-build-script-build.json syn-a2e6dc1d550d999e run-build-script-build-script-build.json syn-c998c8ac30099f7a build-script-build-script-build.json toml-d192d9fbebd5cb61 lib-toml.json toml-dc98d37f2aab96c5 lib-toml.json typenum-70d0c98cc58168b3 lib-typenum.json typenum-92573e41ef1e85e1 run-build-script-build-script-main.json typenum-9fdca179d12f05c5 build-script-build-script-main.json typenum-b487004bf7bc9a32 build-script-build-script-main.json unicode-xid-1ccf9a8622388d0a lib-unicode-xid.json unicode-xid-a53958b7612b2e15 lib-unicode-xid.json version_check-45c9caec9b6617f4 lib-version_check.json version_check-c02be86861b3fab0 lib-version_check.json wee_alloc-4c1d5fc69208e232 build-script-build-script-build.json wee_alloc-8104e1550ed45c97 lib-wee_alloc.json wee_alloc-b724ac321ae537f6 build-script-build-script-build.json wee_alloc-e2cb34bd00ad2611 run-build-script-build-script-build.json build num-bigint-24878def5e0a4e95 out radix_bases.rs typenum-92573e41ef1e85e1 out consts.rs op.rs tests.rs wee_alloc-e2cb34bd00ad2611 out wee_alloc_static_array_backend_size_bytes.txt release .fingerprint Inflector-2da74efad54ec4e9 lib-inflector.json autocfg-36d1143bb15fdaf7 lib-autocfg.json borsh-derive-d3309b1c2945f4b4 lib-borsh-derive.json borsh-derive-internal-4fd70805e36c12ee lib-borsh-derive-internal.json borsh-schema-derive-internal-6c3198d8384c335b lib-borsh-schema-derive-internal.json byteorder-34b699f45df0469a build-script-build-script-build.json convert_case-e7b041cf96916609 lib-convert_case.json derive_more-95bf4ed2bff31aa5 lib-derive_more.json generic-array-03d434b88d3350aa build-script-build-script-build.json hashbrown-66fbbd79aeb96263 run-build-script-build-script-build.json hashbrown-767ac6df210d85c3 build-script-build-script-build.json hashbrown-b314f4e750fcb629 lib-hashbrown.json indexmap-5641e382683c2348 build-script-build-script-build.json indexmap-621c0771e4d53689 lib-indexmap.json indexmap-da6bbc563e54eefc run-build-script-build-script-build.json itoa-883ba7f8c78c7fb0 lib-itoa.json memchr-571d6af0e3027553 build-script-build-script-build.json near-rpc-error-core-3e0ebc8152da9b66 lib-near-rpc-error-core.json near-rpc-error-macro-97041912661dd741 lib-near-rpc-error-macro.json near-sdk-core-b9805aa4019f82e3 lib-near-sdk-core.json near-sdk-macros-1e6184e96df0d59b lib-near-sdk-macros.json num-bigint-30c840a9e7063b4d build-script-build-script-build.json num-integer-ec839767373b3743 build-script-build-script-build.json num-rational-f2a56683457495dd build-script-build-script-build.json num-traits-1d6dd1c6b98fdf86 build-script-build-script-build.json proc-macro-crate-f4485160eb4f02d3 lib-proc-macro-crate.json proc-macro2-3de109d2561ac664 run-build-script-build-script-build.json proc-macro2-4094ae938d816092 lib-proc-macro2.json proc-macro2-4d4508a2f12da927 build-script-build-script-build.json quote-9a82d9e11303b9eb lib-quote.json ryu-6b9dc0114a855fde lib-ryu.json ryu-ef3de59efab1d079 build-script-build-script-build.json ryu-f100889b314cbd00 run-build-script-build-script-build.json serde-7f9925e932b711c9 run-build-script-build-script-build.json serde-9d93eacc5f8ff8ae lib-serde.json serde-e4468589e8222045 build-script-build-script-build.json serde_derive-7f877e1a14c4c4bf build-script-build-script-build.json serde_derive-8d327c44951ba679 lib-serde_derive.json serde_derive-92ba21b400705006 run-build-script-build-script-build.json serde_json-47f7bb457d89d314 run-build-script-build-script-build.json serde_json-89f09557b69ff7b1 lib-serde_json.json serde_json-a896ebe1f93935d3 build-script-build-script-build.json syn-1d236f2ec0494c3d build-script-build-script-build.json syn-6746bc1fd932cafb run-build-script-build-script-build.json syn-d1a686908e03bd0b lib-syn.json toml-9c7331cb48354fa5 lib-toml.json typenum-cede2f005662170f build-script-build-script-main.json unicode-xid-d6cea238fb245afb lib-unicode-xid.json version_check-ce742f3a694dc905 lib-version_check.json wee_alloc-0c0fa5accfc438b3 build-script-build-script-build.json rls .rustc_info.json debug .fingerprint Inflector-c436f7f0ac4cac71 lib-inflector.json ahash-1967cc04c22c18c6 lib-ahash.json aho-corasick-dfd7d94436316217 lib-aho_corasick.json autocfg-9256c11c5a94315c lib-autocfg.json base64-71c90ac137df990d lib-base64.json block-buffer-7cdf9178091a7da1 lib-block-buffer.json block-buffer-fecb4b6366e32b09 lib-block-buffer.json block-padding-62081e46e84fb085 lib-block-padding.json borsh-455d723f2e7eb382 lib-borsh.json borsh-derive-4ceaabc5dd04bd8c lib-borsh-derive.json borsh-derive-internal-a4b50dd4391e6a8d lib-borsh-derive-internal.json borsh-schema-derive-internal-f225755753cda604 lib-borsh-schema-derive-internal.json bs58-69a66f084a652b72 lib-bs58.json byte-tools-1d047ab32bad91f7 lib-byte-tools.json byteorder-390f4de49b33fbe5 build-script-build-script-build.json byteorder-d171a414cbddb916 lib-byteorder.json byteorder-d77aa010d83d8b2e run-build-script-build-script-build.json cfg-if-3cd7bda968e519ae lib-cfg-if.json cfg-if-d11314982639f912 lib-cfg-if.json convert_case-6aefe2f3d987d223 lib-convert_case.json cpuid-bool-2e91630d513571a1 lib-cpuid-bool.json derive_more-5255bfa3b62e923e lib-derive_more.json digest-004be3906fa4cc02 lib-digest.json digest-7c0db2823bd46ffa lib-digest.json generic-array-2ca012656fd96d03 lib-generic_array.json generic-array-2ca68d944663b98e build-script-build-script-build.json generic-array-581aa29a40d86c87 lib-generic_array.json generic-array-edaf070b8515c940 run-build-script-build-script-build.json greeter-ca56de37fb9aeb98 test-lib-greeter.json greeter-d872d1ed9224c2e4 lib-greeter.json hashbrown-376c4e72037f389f run-build-script-build-script-build.json hashbrown-62d2794599d0b3a5 lib-hashbrown.json hashbrown-a3aee600bf90c851 build-script-build-script-build.json hashbrown-a8671ea72407354d lib-hashbrown.json hashbrown-b14545ff43de8045 lib-hashbrown.json hex-b14a6cc6710b1be9 lib-hex.json indexmap-a39c0fe53f69676f lib-indexmap.json indexmap-b5b2936f08563f02 run-build-script-build-script-build.json indexmap-d783966786b01c6b build-script-build-script-build.json indexmap-f66d4c008314b4ba lib-indexmap.json itoa-334a999bacc48d3a lib-itoa.json itoa-b43a70e1308d4059 lib-itoa.json keccak-9486c3b3fabd92f5 lib-keccak.json lazy_static-c4fa5978e157842d lib-lazy_static.json libc-776832e16d6fe779 run-build-script-build-script-build.json libc-ab145babf30c9e9f build-script-build-script-build.json libc-bb09fb4e126f2d8a lib-libc.json memchr-18021bf2e0504af3 build-script-build-script-build.json memchr-88cbb3a1f07aeacc run-build-script-build-script-build.json memchr-c4478d63a1e0bded lib-memchr.json memory_units-7cdfc6b494713aeb lib-memory_units.json near-primitives-core-1a9927e20e4cca2f lib-near-primitives-core.json near-rpc-error-core-d66a3bd0b42b0618 lib-near-rpc-error-core.json near-rpc-error-macro-438c4d8046055ab7 lib-near-rpc-error-macro.json near-runtime-utils-cfaecdd6308100c9 lib-near-runtime-utils.json near-sdk-75db23ee92788818 lib-near-sdk.json near-sdk-core-05f819364f7a560b lib-near-sdk-core.json near-sdk-macros-c527437a538e59b5 lib-near-sdk-macros.json near-vm-errors-6c4e1c3aa31b46a6 lib-near-vm-errors.json near-vm-logic-7b9cae9ded7ffed2 lib-near-vm-logic.json num-bigint-24878def5e0a4e95 run-build-script-build-script-build.json num-bigint-2ecc5aa16ac5fa11 build-script-build-script-build.json num-bigint-e6063b2824ca7f78 lib-num-bigint.json num-integer-0dc92eae980549ce build-script-build-script-build.json num-integer-857b4d0c0fb1ebb2 lib-num-integer.json num-integer-bfcb27fa88a06435 run-build-script-build-script-build.json num-rational-53d8c28e51e4edeb lib-num-rational.json num-rational-5cee69414ba13397 build-script-build-script-build.json num-rational-e41c1ae7c12fd05a run-build-script-build-script-build.json num-traits-148ddaa8ac8aed3d build-script-build-script-build.json num-traits-8ada646017a565de lib-num-traits.json num-traits-e9e69ac574c21b5e run-build-script-build-script-build.json opaque-debug-40ef33ab5d5455d5 lib-opaque-debug.json opaque-debug-9f33558de634ada2 lib-opaque-debug.json proc-macro-crate-f8a29538f3d5d264 lib-proc-macro-crate.json proc-macro2-199e7d79ea890f98 build-script-build-script-build.json proc-macro2-666f73db07a53a8d lib-proc-macro2.json proc-macro2-bd2c37d8933f4808 run-build-script-build-script-build.json quote-9bda4ac1e186b791 lib-quote.json regex-2da0ebf3876e69eb lib-regex.json regex-syntax-4674515918c0a7b3 lib-regex-syntax.json ryu-05927dde86fed045 run-build-script-build-script-build.json ryu-71b733cfce4d5fb9 build-script-build-script-build.json ryu-78844ca83f6bd916 lib-ryu.json ryu-9d8a66d1893ee378 lib-ryu.json serde-04ff27b5376387bd lib-serde.json serde-4e5700cebad65fe6 run-build-script-build-script-build.json serde-61b3756bc6d1e581 lib-serde.json serde-ce79dbda8006d582 build-script-build-script-build.json serde_derive-0735097b743a1fb7 build-script-build-script-build.json serde_derive-3fa5b2f0604dda9d lib-serde_derive.json serde_derive-a081d5fd2c137a9a run-build-script-build-script-build.json serde_json-17657cb37f02500a lib-serde_json.json serde_json-5c67599c92665964 lib-serde_json.json serde_json-8d57a558bc719086 run-build-script-build-script-build.json serde_json-e672e5dc6dad8890 build-script-build-script-build.json sha2-ce147e528dceb8c1 lib-sha2.json sha3-69ffdc009f5fc5f1 lib-sha3.json syn-5d4f461e709da010 lib-syn.json syn-a2e6dc1d550d999e run-build-script-build-script-build.json syn-c998c8ac30099f7a build-script-build-script-build.json toml-d192d9fbebd5cb61 lib-toml.json typenum-70d0c98cc58168b3 lib-typenum.json typenum-92573e41ef1e85e1 run-build-script-build-script-main.json typenum-9fdca179d12f05c5 build-script-build-script-main.json unicode-xid-a53958b7612b2e15 lib-unicode-xid.json version_check-45c9caec9b6617f4 lib-version_check.json wee_alloc-8104e1550ed45c97 lib-wee_alloc.json wee_alloc-b724ac321ae537f6 build-script-build-script-build.json wee_alloc-e2cb34bd00ad2611 run-build-script-build-script-build.json build byteorder-390f4de49b33fbe5 save-analysis build_script_build-390f4de49b33fbe5.json generic-array-2ca68d944663b98e save-analysis build_script_build-2ca68d944663b98e.json hashbrown-a3aee600bf90c851 save-analysis build_script_build-a3aee600bf90c851.json indexmap-d783966786b01c6b save-analysis build_script_build-d783966786b01c6b.json libc-ab145babf30c9e9f save-analysis build_script_build-ab145babf30c9e9f.json memchr-18021bf2e0504af3 save-analysis build_script_build-18021bf2e0504af3.json num-bigint-24878def5e0a4e95 out radix_bases.rs num-bigint-2ecc5aa16ac5fa11 save-analysis build_script_build-2ecc5aa16ac5fa11.json num-integer-0dc92eae980549ce save-analysis build_script_build-0dc92eae980549ce.json num-rational-5cee69414ba13397 save-analysis build_script_build-5cee69414ba13397.json num-traits-148ddaa8ac8aed3d save-analysis build_script_build-148ddaa8ac8aed3d.json proc-macro2-199e7d79ea890f98 save-analysis build_script_build-199e7d79ea890f98.json ryu-71b733cfce4d5fb9 save-analysis build_script_build-71b733cfce4d5fb9.json serde-ce79dbda8006d582 save-analysis build_script_build-ce79dbda8006d582.json serde_derive-0735097b743a1fb7 save-analysis build_script_build-0735097b743a1fb7.json serde_json-e672e5dc6dad8890 save-analysis build_script_build-e672e5dc6dad8890.json syn-c998c8ac30099f7a save-analysis build_script_build-c998c8ac30099f7a.json typenum-92573e41ef1e85e1 out consts.rs op.rs tests.rs typenum-9fdca179d12f05c5 save-analysis build_script_main-9fdca179d12f05c5.json wee_alloc-b724ac321ae537f6 save-analysis build_script_build-b724ac321ae537f6.json wee_alloc-e2cb34bd00ad2611 out wee_alloc_static_array_backend_size_bytes.txt deps save-analysis greeter-ca56de37fb9aeb98.json libahash-1967cc04c22c18c6.json libaho_corasick-dfd7d94436316217.json libautocfg-9256c11c5a94315c.json libbase64-71c90ac137df990d.json libblock_buffer-fecb4b6366e32b09.json libblock_padding-62081e46e84fb085.json libborsh-455d723f2e7eb382.json libbs58-69a66f084a652b72.json libbyte_tools-1d047ab32bad91f7.json libbyteorder-d171a414cbddb916.json libderive_more-5255bfa3b62e923e.json libdigest-004be3906fa4cc02.json libgeneric_array-2ca012656fd96d03.json libgreeter-d872d1ed9224c2e4.json libhashbrown-a8671ea72407354d.json libhashbrown-b14545ff43de8045.json libhex-b14a6cc6710b1be9.json libindexmap-a39c0fe53f69676f.json libindexmap-f66d4c008314b4ba.json libinflector-c436f7f0ac4cac71.json libitoa-b43a70e1308d4059.json libkeccak-9486c3b3fabd92f5.json liblazy_static-c4fa5978e157842d.json libmemchr-c4478d63a1e0bded.json libmemory_units-7cdfc6b494713aeb.json libnear_primitives_core-1a9927e20e4cca2f.json libnear_rpc_error_core-d66a3bd0b42b0618.json libnear_rpc_error_macro-438c4d8046055ab7.json libnear_runtime_utils-cfaecdd6308100c9.json libnear_sdk-75db23ee92788818.json libnear_vm_errors-6c4e1c3aa31b46a6.json libnear_vm_logic-7b9cae9ded7ffed2.json libnum_bigint-e6063b2824ca7f78.json libnum_integer-857b4d0c0fb1ebb2.json libnum_rational-53d8c28e51e4edeb.json libnum_traits-8ada646017a565de.json libopaque_debug-40ef33ab5d5455d5.json libproc_macro2-666f73db07a53a8d.json libproc_macro_crate-f8a29538f3d5d264.json libquote-9bda4ac1e186b791.json libregex-2da0ebf3876e69eb.json libryu-78844ca83f6bd916.json libsha2-ce147e528dceb8c1.json libsha3-69ffdc009f5fc5f1.json libtoml-d192d9fbebd5cb61.json libunicode_xid-a53958b7612b2e15.json libversion_check-45c9caec9b6617f4.json libwee_alloc-8104e1550ed45c97.json wasm32-unknown-unknown debug .fingerprint ahash-1e4f7001357845d9 lib-ahash.json ahash-31500eed5b448aad lib-ahash.json aho-corasick-4e2f89079b9e00e0 lib-aho_corasick.json aho-corasick-b89132b0381c749e lib-aho_corasick.json base64-24b7b79876c360ef lib-base64.json base64-646109cef868d84f lib-base64.json block-buffer-37003fcc48ccf01d lib-block-buffer.json block-buffer-5f9d9d8b55f1d3b1 lib-block-buffer.json block-buffer-a4f1735d27d7a03f lib-block-buffer.json block-buffer-bc99728b4d693dcc lib-block-buffer.json block-padding-13821e343f46f753 lib-block-padding.json block-padding-338643242f2dae2c lib-block-padding.json borsh-6fb510f42155d666 lib-borsh.json borsh-dc5eef91f25dddab lib-borsh.json bs58-7212f4faed67cdbf lib-bs58.json bs58-c1405f3d470899a9 lib-bs58.json byte-tools-135d698576218f7f lib-byte-tools.json byte-tools-a6cd60c7ea46575a lib-byte-tools.json byteorder-08f29ea8d461900c run-build-script-build-script-build.json byteorder-425eab9cce122222 lib-byteorder.json byteorder-b1278529b57a037f run-build-script-build-script-build.json byteorder-dd42706ea898e564 lib-byteorder.json cfg-if-53998aee5392ec20 lib-cfg-if.json cfg-if-8cd778ce3477266f lib-cfg-if.json cfg-if-f1de31271fe8376a lib-cfg-if.json cfg-if-f786cbb548399339 lib-cfg-if.json digest-02b66ce3a4c78c1c lib-digest.json digest-19541f9b7e0c7774 lib-digest.json digest-5bb936ed42c05efb lib-digest.json digest-735ab6181239f6d2 lib-digest.json generic-array-25c6d4dda83f7be7 run-build-script-build-script-build.json generic-array-30cd0a03156a9b87 lib-generic_array.json generic-array-6802468a8a36c271 run-build-script-build-script-build.json generic-array-845551d223c666ba lib-generic_array.json generic-array-d996d3171b5da4ba lib-generic_array.json generic-array-fa1caae96ee63780 lib-generic_array.json greeter-98ace302c5fafa12 lib-greeter.json hashbrown-483ac2a52167ff2a lib-hashbrown.json hashbrown-51d3921aceef5ebb run-build-script-build-script-build.json hashbrown-9e21cf3d1d28819b lib-hashbrown.json hashbrown-b3cfd744f48b3b6e lib-hashbrown.json hashbrown-e4a4c2f7e2717426 lib-hashbrown.json hashbrown-f3541e9aee499733 run-build-script-build-script-build.json hex-261cfc3fcecaa4ef lib-hex.json hex-c604b67ad129b15c lib-hex.json indexmap-003f41db7a36cd3b run-build-script-build-script-build.json indexmap-33441b070f70d190 run-build-script-build-script-build.json indexmap-549d81fd1b4aaa1a lib-indexmap.json indexmap-b8bfbab8f475b75f lib-indexmap.json itoa-4c06a779eef25af4 lib-itoa.json itoa-e60cf4857d9d2913 lib-itoa.json keccak-b0c9ccd044944503 lib-keccak.json keccak-d4c6e65621b821f6 lib-keccak.json lazy_static-15a36e6855247c67 lib-lazy_static.json lazy_static-b79bf709c5f09987 lib-lazy_static.json memchr-29e30936df02ad7c run-build-script-build-script-build.json memchr-8974d6d0eea4ab03 lib-memchr.json memchr-d3aaac5f8308eb58 lib-memchr.json memchr-f922bd3de584c24c run-build-script-build-script-build.json memory_units-3804df6a88cda429 lib-memory_units.json memory_units-90906d142a260054 lib-memory_units.json near-primitives-core-22512a59771af8d0 lib-near-primitives-core.json near-primitives-core-8eab4af63289cca4 lib-near-primitives-core.json near-runtime-utils-305f43dd617f4a70 lib-near-runtime-utils.json near-runtime-utils-3357838d53825c1b lib-near-runtime-utils.json near-sdk-b965d2f0da3bed34 lib-near-sdk.json near-sdk-f66bacd755fc9d77 lib-near-sdk.json near-vm-errors-20e6f8caa2eb3f21 lib-near-vm-errors.json near-vm-errors-e5fbb2c274b4a5ef lib-near-vm-errors.json near-vm-logic-26e22134f5e27306 lib-near-vm-logic.json near-vm-logic-afd430776e895057 lib-near-vm-logic.json num-bigint-5fedcba82e247578 lib-num-bigint.json num-bigint-692978290ad6ac51 run-build-script-build-script-build.json num-bigint-7e7d1d90c83f30cc lib-num-bigint.json num-bigint-a699a4a251dccc5e run-build-script-build-script-build.json num-integer-6bdbe1733947e393 run-build-script-build-script-build.json num-integer-72c4894d57403887 lib-num-integer.json num-integer-8d01ee791cd20c62 lib-num-integer.json num-integer-e00df3a90a9271c0 run-build-script-build-script-build.json num-rational-abf9bfbe7cbd8dd6 lib-num-rational.json num-rational-c333a4fa265eb85d run-build-script-build-script-build.json num-rational-e5b980680ebaaecb run-build-script-build-script-build.json num-rational-f4f592a6b0c04ec3 lib-num-rational.json num-traits-28f28195512e15b0 lib-num-traits.json num-traits-838e9f4f81aae4f8 run-build-script-build-script-build.json num-traits-c1660e0226ce670c run-build-script-build-script-build.json num-traits-e0f409119940623e lib-num-traits.json opaque-debug-19d0f9d6d6732dda lib-opaque-debug.json opaque-debug-20397d3162c70a7a lib-opaque-debug.json opaque-debug-67e11037907b0a62 lib-opaque-debug.json opaque-debug-d4218c184d36d52a lib-opaque-debug.json regex-348a33fe5c87c03d lib-regex.json regex-e489d254d1e7e12d lib-regex.json regex-syntax-bcaa825332c5ba50 lib-regex-syntax.json regex-syntax-cd626ce4deb5f357 lib-regex-syntax.json ryu-1c89b4c0977fa398 lib-ryu.json ryu-52a388757c15c1a6 run-build-script-build-script-build.json ryu-618a27724935a027 run-build-script-build-script-build.json ryu-a7a81e23b9bcb06b lib-ryu.json serde-6d59abfee35ae43b run-build-script-build-script-build.json serde-c480407a95773cc0 lib-serde.json serde-ebe94b1241f5047e lib-serde.json serde-f83c67a06a5b12c5 run-build-script-build-script-build.json serde_json-1da7a0c73c632567 lib-serde_json.json serde_json-2effd68d351abc28 lib-serde_json.json serde_json-6c28b4927146d49d run-build-script-build-script-build.json serde_json-c3b71e6248b2b8a1 run-build-script-build-script-build.json sha2-0f67ed3ef159a91a lib-sha2.json sha2-bdebeba22d9faa70 lib-sha2.json sha3-2517d071adfa8028 lib-sha3.json sha3-4cf15448deb657a1 lib-sha3.json typenum-4976863587ad7c9e run-build-script-build-script-main.json typenum-765fe82de63af7f0 run-build-script-build-script-main.json typenum-b3f9023e815d815e lib-typenum.json typenum-eee99a2ed0f1494e lib-typenum.json wee_alloc-1aec1ccd611d0139 run-build-script-build-script-build.json wee_alloc-6b415af9b59e77f3 lib-wee_alloc.json wee_alloc-70e83ed96f4a461b lib-wee_alloc.json wee_alloc-96614ccff1c83e60 run-build-script-build-script-build.json build num-bigint-692978290ad6ac51 out radix_bases.rs num-bigint-a699a4a251dccc5e out radix_bases.rs typenum-4976863587ad7c9e out consts.rs op.rs tests.rs typenum-765fe82de63af7f0 out consts.rs op.rs tests.rs wee_alloc-1aec1ccd611d0139 out wee_alloc_static_array_backend_size_bytes.txt wee_alloc-96614ccff1c83e60 out wee_alloc_static_array_backend_size_bytes.txt release .fingerprint ahash-c39a1557b0cb64fd lib-ahash.json aho-corasick-cddd1d2769bbc24c lib-aho_corasick.json base64-0b7ec90a02269293 lib-base64.json block-buffer-3adf35a631626521 lib-block-buffer.json block-buffer-7667b3843146785f lib-block-buffer.json block-padding-add315c1a10297ab lib-block-padding.json borsh-20f80cee6bb6ec9c lib-borsh.json bs58-7c9614b1e7bf825e lib-bs58.json byte-tools-78a50f0bb79f4220 lib-byte-tools.json byteorder-49b8d6e679c1e64e run-build-script-build-script-build.json byteorder-87dc9d029147e43c lib-byteorder.json cfg-if-1c5136e600ed0421 lib-cfg-if.json cfg-if-a1f5f75da1d819bb lib-cfg-if.json digest-26443559f0b8ab0c lib-digest.json digest-47255a1a287092ff lib-digest.json generic-array-8a6609a86a263663 run-build-script-build-script-build.json generic-array-aeaec4f020f3d126 lib-generic_array.json generic-array-f75a4be0bb981076 lib-generic_array.json greeter-98ace302c5fafa12 lib-greeter.json hashbrown-030c6a3a4817b33d lib-hashbrown.json hashbrown-323acde7cb1b3303 lib-hashbrown.json hashbrown-726d24c31ecf2221 run-build-script-build-script-build.json hex-d8ef8d74602b7b40 lib-hex.json indexmap-26aa6e17137aa197 lib-indexmap.json indexmap-c9d688ec2b5e6183 run-build-script-build-script-build.json itoa-f08dc1fc9126aefd lib-itoa.json keccak-71984737368ee5c0 lib-keccak.json lazy_static-bd10a22929086909 lib-lazy_static.json memchr-975969f7a5c8ad0e lib-memchr.json memchr-a9fc1d76fb65bb32 run-build-script-build-script-build.json memory_units-b90fcde6ee21ae92 lib-memory_units.json near-primitives-core-0d072222326a6e39 lib-near-primitives-core.json near-runtime-utils-0dcaf8cff4281f50 lib-near-runtime-utils.json near-sdk-729cdab4924d53a0 lib-near-sdk.json near-vm-errors-639978f6ebdf5530 lib-near-vm-errors.json near-vm-logic-8f4e35fe57a69f32 lib-near-vm-logic.json num-bigint-00a18bfc5e6bcf5d lib-num-bigint.json num-bigint-dd2b12ef358ad150 run-build-script-build-script-build.json num-integer-20fc3c5b6715fc29 lib-num-integer.json num-integer-7bbca57a59f2c64d run-build-script-build-script-build.json num-rational-75a878223dda610e lib-num-rational.json num-rational-e245fb60ae5d228f run-build-script-build-script-build.json num-traits-fc3edba68694a94a lib-num-traits.json num-traits-fceda933139e35d0 run-build-script-build-script-build.json opaque-debug-b2242681a00bd93a lib-opaque-debug.json opaque-debug-ddcd1b07edf68a37 lib-opaque-debug.json regex-4f0c6a2bc6131dcf lib-regex.json regex-syntax-9455a93df8c78607 lib-regex-syntax.json ryu-05a79e24ef72bed6 run-build-script-build-script-build.json ryu-ce46002e78d0049e lib-ryu.json serde-5e009a63aa5e09e9 run-build-script-build-script-build.json serde-82b8b5f0a44b45e0 lib-serde.json serde_json-3a1344f733a9e713 run-build-script-build-script-build.json serde_json-6e0448f6309c187f lib-serde_json.json sha2-9b68277cd7b2095b lib-sha2.json sha3-555bfa621f506fdc lib-sha3.json typenum-306e31ff236dbc19 lib-typenum.json typenum-39cdaa6935864a49 run-build-script-build-script-main.json wee_alloc-73a4a3d36eaed7a5 lib-wee_alloc.json wee_alloc-eee7ea5cef997a34 run-build-script-build-script-build.json build num-bigint-dd2b12ef358ad150 out radix_bases.rs typenum-39cdaa6935864a49 out consts.rs op.rs tests.rs wee_alloc-eee7ea5cef997a34 out wee_alloc_static_array_backend_size_bytes.txt | |","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1038,"byte_end":1133,"line_start":22,"line_end":22,"column_start":1,"column_end":96}},{"value":" | `encode` | Returns a new `String` | Always |","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1134,"byte_end":1229,"line_start":23,"line_end":23,"column_start":1,"column_end":96}},{"value":" | `encode_config` | Returns a new `String` | Always |","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1230,"byte_end":1325,"line_start":24,"line_end":24,"column_start":1,"column_end":96}},{"value":" | `encode_config_buf` | Appends to provided `String` | Only if `String` needs to grow |","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1326,"byte_end":1421,"line_start":25,"line_end":25,"column_start":1,"column_end":96}},{"value":" | `encode_config_slice` | Writes to provided `&[u8]` | Never |","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1422,"byte_end":1517,"line_start":26,"line_end":26,"column_start":1,"column_end":96}},{"value":" ","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1518,"byte_end":1521,"line_start":27,"line_end":27,"column_start":1,"column_end":4}},{"value":" All of the encoding functions that take a `Config` will pad as per the config.","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1522,"byte_end":1604,"line_start":28,"line_end":28,"column_start":1,"column_end":83}},{"value":" ","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1605,"byte_end":1608,"line_start":29,"line_end":29,"column_start":1,"column_end":4}},{"value":" # Decoding","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1609,"byte_end":1623,"line_start":30,"line_end":30,"column_start":1,"column_end":15}},{"value":" ","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1624,"byte_end":1627,"line_start":31,"line_end":31,"column_start":1,"column_end":4}},{"value":" Just as for encoding, there are different decoding functions available.","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1628,"byte_end":1703,"line_start":32,"line_end":32,"column_start":1,"column_end":76}},{"value":" ","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1704,"byte_end":1707,"line_start":33,"line_end":33,"column_start":1,"column_end":4}},{"value":" | Function | Output | Allocates |","span":{"file_name":" Users iliashuianov .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1708,"byte_end":1804,"line_start":34,"line_end":34,"column_start":1,"column_end":97}},{"value":" | package.json src App.js Components MintingTool.js login.js __mocks__ fileMock.js assets logo-black.svg logo-white.svg config.js global.css index.html index.js jest.init.js main.test.js utils.js wallet login index.html
my-nft ================== This [React] app was initialized with [create-near-app] Quick Start =========== To run this project locally: 1. Prerequisites: Make sure you've installed [Node.js] ≥ 12 2. Install dependencies: `yarn install` 3. Run the local development server: `yarn dev` (see `package.json` for a full list of `scripts` you can run with `yarn`) Now you'll have a local development environment backed by the NEAR TestNet! Go ahead and play with the app and the code. As you make code changes, the app will automatically reload. Exploring The Code ================== 1. The "backend" code lives in the `/contract` folder. See the README there for more info. 2. The frontend code lives in the `/src` folder. `/src/index.html` is a great place to start exploring. Note that it loads in `/src/index.js`, where you can learn how the frontend connects to the NEAR blockchain. 3. Tests: there are different kinds of tests for the frontend and the smart contract. See `contract/README` for info about how it's tested. The frontend code gets tested with [jest]. You can run both of these at once with `yarn run test`. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `yarn dev`, your smart contract gets deployed to the live NEAR TestNet with a throwaway account. When you're ready to make it permanent, here's how. Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `yarn install`, but for best ergonomics you may want to install it globally: yarn install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `my-nft.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `my-nft.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account my-nft.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: set contract name in code --------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'my-nft.YOUR-NAME.testnet' Step 3: deploy! --------------- One command: yarn deploy As you can see in `package.json`, this does two things: 1. builds & deploys smart contract to NEAR TestNet 2. builds & deploys frontend code to GitHub using [gh-pages]. This will only work if the project already has a repository set up on GitHub. Feel free to modify the `deploy` script in `package.json` to deploy elsewhere. Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [React]: https://reactjs.org/ [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/docs/concepts/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli [gh-pages]: https://github.com/tschaub/gh-pages my-nft Smart Contract ================== A [smart contract] written in [Rust] for an app initialized with [create-near-app] Quick Start =========== Before you compile this code, you will need to install Rust with [correct target] Exploring The Code ================== 1. The main smart contract code lives in `src/lib.rs`. You can compile it with the `./compile` script. 2. Tests: You can run smart contract tests with the `./test` script. This runs standard Rust tests using [cargo] with a `--nocapture` flag so that you can see any debug info you print to the console. [smart contract]: https://docs.near.org/docs/develop/contracts/overview [Rust]: https://www.rust-lang.org/ [create-near-app]: https://github.com/near/create-near-app [correct target]: https://github.com/near/near-sdk-rs#pre-requisites [cargo]: https://doc.rust-lang.org/book/ch01-03-hello-cargo.html
Kikimora-Labs_gonear-name
.github workflows main.yml README.md economics rewards.py escrow_contract Cargo.toml build.sh compile_and_test.sh expensive.sh src action.rs lib.rs proposal.rs tests general.rs frontend README.md package.json public browserconfig.xml index.html robots.txt safari-pinned-tab.svg src assets fonts Poppins OFL.txt images light.svg helpers api.ts config.ts hooks.ts mappers.ts media.ts near.ts routes.ts walletConnection.ts react-app-env.d.ts tsconfig.json lock_unlock_account_contract Cargo.toml LIST_OF_HASHES.md build.sh src lib.rs marketplace_contract Cargo.toml build.sh compile_and_test.sh expensive.sh src action.rs bid.rs lib.rs profile.rs tests general.rs
# TBD # NEAR Protocol Accounts Marketplace dApp ## Quick start To run this locally: 1. Config envs: `cp .env.example .env` 2. Install dependencies via `yarn install` 3. Start the development server using `yarn start` 4. Open up http://localhost:8080 ## Running tests There are no any tests :–(. ## Deployment Project deploys on Github Pages via Github Actions. Look through `.github/workflows` to learn more about our CI/CD. ## Links TBD. test
ippishio_near-cat-nft
README.md browserconfig.xml index.html main.js near.js nft-contract Cargo.toml README.md build.sh src approval.rs enumeration.rs internal.rs lib.rs metadata.rs mint.rs nft_core.rs royalty.rs target .rustc_info.json release .fingerprint Inflector-960a11a1bb9b0b12 lib-inflector.json borsh-derive-9716af4d796c49fb lib-borsh-derive.json borsh-derive-internal-1a2124d8de9961f4 lib-borsh-derive-internal.json borsh-schema-derive-internal-8155710b558af6ce lib-borsh-schema-derive-internal.json near-sdk-macros-ee696373e39c2f5e lib-near-sdk-macros.json proc-macro-crate-d70091033d4a0551 lib-proc-macro-crate.json proc-macro2-1ebdcc67ef8f8deb run-build-script-build-script-build.json proc-macro2-4c32726517dc6db4 build-script-build-script-build.json proc-macro2-ac14bfa0bcfd21ea lib-proc-macro2.json quote-c9c79feb515f4b78 lib-quote.json ryu-bd573eab492ed36b build-script-build-script-build.json serde-3bc4bb0098066134 run-build-script-build-script-build.json serde-7c3951e5294c5be9 build-script-build-script-build.json serde-d3f3fd5e30d75da3 build-script-build-script-build.json serde-d66fcce83c310ecb lib-serde.json serde_derive-4de387af8789c500 lib-serde_derive.json serde_derive-77a3bddd2c8f6568 build-script-build-script-build.json serde_derive-a3933a103b38c66b run-build-script-build-script-build.json serde_json-bab05d69821c8adc build-script-build-script-build.json syn-179f7a3f2c7c4f73 run-build-script-build-script-build.json syn-3e6e20baa85c8b7b build-script-build-script-build.json syn-ace682f0d4ac75cf lib-syn.json toml-4976a4381be275b5 lib-toml.json unicode-xid-4500716f7413df0f lib-unicode-xid.json wee_alloc-3059e8679fcf3f87 build-script-build-script-build.json rls .rustc_info.json debug .fingerprint Inflector-d7846ac18fccc54a lib-inflector.json ahash-ea756eae10ed06fa lib-ahash.json aho-corasick-605c2fc4423212b9 lib-aho_corasick.json autocfg-054c764b6e2dde70 lib-autocfg.json base64-67ca47b261bc1218 lib-base64.json block-buffer-8f18644fac76287b lib-block-buffer.json block-padding-bb70e0ce09c7c18a lib-block-padding.json borsh-d578fda74c1f5fe4 lib-borsh.json borsh-derive-a56b11869ff4a914 lib-borsh-derive.json borsh-derive-internal-0a7c8d2a61e46c67 lib-borsh-derive-internal.json borsh-schema-derive-internal-179fd76cd65f9ba1 lib-borsh-schema-derive-internal.json bs58-a876b3bfe7fdfbb2 lib-bs58.json byteorder-2290de94bb3170df lib-byteorder.json cfg-if-7d42709f3d54d907 lib-cfg-if.json cfg-if-946e885e71060f52 lib-cfg-if.json cpuid-bool-7870d413d03df8e6 lib-cpuid-bool.json derive_more-48d160c843093db6 lib-derive_more.json digest-db8488b404d5a67e lib-digest.json generic-array-9d0faf177ca55a7f lib-generic_array.json generic-array-d45e25a518da2990 run-build-script-build-script-build.json generic-array-e34cb9c8696f9dd7 build-script-build-script-build.json hashbrown-b246c2681abb2a40 lib-hashbrown.json hashbrown-bab87b5fa9ee644c lib-hashbrown.json hex-e3ef3d0deba940d2 lib-hex.json indexmap-13e3ac522ca1a795 build-script-build-script-build.json indexmap-2a5577ad4e88c4e6 lib-indexmap.json indexmap-ebd6102278340f3f run-build-script-build-script-build.json itoa-8f44d7ad2d7fc6ec lib-itoa.json itoa-cfd94be669bf17b8 lib-itoa.json keccak-c714784b3a2b37d2 lib-keccak.json lazy_static-6a4f05fd7715fb09 lib-lazy_static.json libc-5021878a9336ac06 run-build-script-build-script-build.json libc-94349327ca7f1ff9 build-script-build-script-build.json libc-ed0346412ab912bf lib-libc.json memchr-6f6b27353c2ae857 run-build-script-build-script-build.json memchr-a0a2d74a7d35cda0 lib-memchr.json memchr-df2fece483f5c21d build-script-build-script-build.json memory_units-93b980468bca74ec lib-memory_units.json near-primitives-core-18fe7722a1075959 lib-near-primitives-core.json near-rpc-error-core-0514b8d6a412afe8 lib-near-rpc-error-core.json near-rpc-error-macro-6e39ba1c97441183 lib-near-rpc-error-macro.json near-runtime-utils-d518c65a7267d6b3 lib-near-runtime-utils.json near-sdk-8fe05f5a4832ad5e lib-near-sdk.json near-sdk-macros-f4d31ded00ed54cf lib-near-sdk-macros.json near-sys-8890c0c8561d9125 lib-near-sys.json near-vm-errors-ad553f3b28b1e2f5 lib-near-vm-errors.json near-vm-logic-b6e43dc9518f7571 lib-near-vm-logic.json nft_simple-9b113c1c51dabbc1 lib-nft_simple.json nft_simple-9f32599b2aa4cf30 test-lib-nft_simple.json num-bigint-50c4d06a651a7285 run-build-script-build-script-build.json num-bigint-5633504c86cfd51e build-script-build-script-build.json num-bigint-9583ee0d762e97c6 lib-num-bigint.json num-integer-4e58a38361f03b55 run-build-script-build-script-build.json num-integer-8df6aff2d36bf732 build-script-build-script-build.json num-integer-f72b388cd8eac043 lib-num-integer.json num-rational-118ccdc387676ecc lib-num-rational.json num-rational-55ada24dca21e189 build-script-build-script-build.json num-rational-a77ec9ea1dcae64f run-build-script-build-script-build.json num-traits-571a5f9a58b358d1 lib-num-traits.json num-traits-5a950220f325e130 run-build-script-build-script-build.json num-traits-e15f1c4fdc5627ae build-script-build-script-build.json once_cell-8eda0f4467fe6074 lib-once_cell.json opaque-debug-e0b9da328b624eef lib-opaque-debug.json proc-macro-crate-b5597a1d444622d7 lib-proc-macro-crate.json proc-macro2-20eea9ee85e1b29b run-build-script-build-script-build.json proc-macro2-852747da0a4bfd54 build-script-build-script-build.json proc-macro2-c95b77c8edde12a1 lib-proc-macro2.json quote-fcd22b39084cd4b0 lib-quote.json regex-7d239c115e61eebd lib-regex.json regex-syntax-05bd8cbfa4902ce2 lib-regex-syntax.json ryu-10101ea116e40bdd lib-ryu.json ryu-25c40b8833883533 build-script-build-script-build.json ryu-fe0a48ad916f6cd5 lib-ryu.json ryu-fe763814b6e2cf9e run-build-script-build-script-build.json serde-23ca0e3c5b712315 lib-serde.json serde-c6dd786dd855770b lib-serde.json serde-ca378e34f3a56144 run-build-script-build-script-build.json serde-d45fdeca565d1a22 build-script-build-script-build.json serde_derive-413d1b37a8706aa8 build-script-build-script-build.json serde_derive-9f2676edab5163dc lib-serde_derive.json serde_derive-c15848797502099e run-build-script-build-script-build.json serde_json-32b53a992d738e61 run-build-script-build-script-build.json serde_json-59856343dde6bf0a build-script-build-script-build.json serde_json-5e8a697724fba638 run-build-script-build-script-build.json serde_json-86a16eb1e2401541 lib-serde_json.json serde_json-dc7bcd09c921189c lib-serde_json.json serde_json-fc38e8ee01abca4c build-script-build-script-build.json sha2-c8413ea0721b16f1 lib-sha2.json sha3-19bd4fcc2db00535 lib-sha3.json syn-3f74edf56d8a81a0 lib-syn.json syn-515545dd0ddad3b3 run-build-script-build-script-build.json syn-64c38b1ea456d05a build-script-build-script-build.json thread_local-6c59f363c8c67451 lib-thread_local.json toml-b9132b21fa720de4 lib-toml.json typenum-1948c84d5636f8ed run-build-script-build-script-main.json typenum-e9e5a6fdbddcdf4e lib-typenum.json typenum-f99a0afb39bbe014 build-script-build-script-main.json unicode-xid-40a58482a0cdcda6 lib-unicode-xid.json version_check-21c0f9acc8eafaf4 lib-version_check.json wee_alloc-79bb5db00e84c17e run-build-script-build-script-build.json wee_alloc-9fb56260a1c682d5 build-script-build-script-build.json wee_alloc-e96b7d7a567a76bf lib-wee_alloc.json build generic-array-e34cb9c8696f9dd7 save-analysis build_script_build-e34cb9c8696f9dd7.json indexmap-13e3ac522ca1a795 save-analysis build_script_build-13e3ac522ca1a795.json libc-94349327ca7f1ff9 save-analysis build_script_build-94349327ca7f1ff9.json memchr-df2fece483f5c21d save-analysis build_script_build-df2fece483f5c21d.json num-bigint-50c4d06a651a7285 out radix_bases.rs num-bigint-5633504c86cfd51e save-analysis build_script_build-5633504c86cfd51e.json num-integer-8df6aff2d36bf732 save-analysis build_script_build-8df6aff2d36bf732.json num-rational-55ada24dca21e189 save-analysis build_script_build-55ada24dca21e189.json num-traits-e15f1c4fdc5627ae save-analysis build_script_build-e15f1c4fdc5627ae.json proc-macro2-852747da0a4bfd54 save-analysis build_script_build-852747da0a4bfd54.json ryu-25c40b8833883533 save-analysis build_script_build-25c40b8833883533.json serde-d45fdeca565d1a22 save-analysis build_script_build-d45fdeca565d1a22.json serde_derive-413d1b37a8706aa8 save-analysis build_script_build-413d1b37a8706aa8.json serde_json-59856343dde6bf0a save-analysis build_script_build-59856343dde6bf0a.json serde_json-fc38e8ee01abca4c save-analysis build_script_build-fc38e8ee01abca4c.json syn-64c38b1ea456d05a save-analysis build_script_build-64c38b1ea456d05a.json typenum-1948c84d5636f8ed out consts.rs op.rs tests.rs typenum-f99a0afb39bbe014 save-analysis build_script_main-f99a0afb39bbe014.json wee_alloc-79bb5db00e84c17e out wee_alloc_static_array_backend_size_bytes.txt wee_alloc-9fb56260a1c682d5 save-analysis build_script_build-9fb56260a1c682d5.json deps save-analysis libahash-ea756eae10ed06fa.json libaho_corasick-605c2fc4423212b9.json libautocfg-054c764b6e2dde70.json libbase64-67ca47b261bc1218.json libblock_buffer-8f18644fac76287b.json libblock_padding-bb70e0ce09c7c18a.json libborsh-d578fda74c1f5fe4.json libbs58-a876b3bfe7fdfbb2.json libbyteorder-2290de94bb3170df.json libderive_more-48d160c843093db6.json libdigest-db8488b404d5a67e.json libgeneric_array-9d0faf177ca55a7f.json libhashbrown-b246c2681abb2a40.json libhex-e3ef3d0deba940d2.json libindexmap-2a5577ad4e88c4e6.json libinflector-d7846ac18fccc54a.json libitoa-cfd94be669bf17b8.json libkeccak-c714784b3a2b37d2.json liblazy_static-6a4f05fd7715fb09.json libmemchr-a0a2d74a7d35cda0.json libmemory_units-93b980468bca74ec.json libnear_primitives_core-18fe7722a1075959.json libnear_rpc_error_core-0514b8d6a412afe8.json libnear_rpc_error_macro-6e39ba1c97441183.json libnear_runtime_utils-d518c65a7267d6b3.json libnear_sdk-8fe05f5a4832ad5e.json libnear_sys-8890c0c8561d9125.json libnear_vm_errors-ad553f3b28b1e2f5.json libnear_vm_logic-b6e43dc9518f7571.json libnft_simple-9b113c1c51dabbc1.json libnum_bigint-9583ee0d762e97c6.json libnum_integer-f72b388cd8eac043.json libnum_rational-118ccdc387676ecc.json libnum_traits-571a5f9a58b358d1.json libonce_cell-8eda0f4467fe6074.json libopaque_debug-e0b9da328b624eef.json libproc_macro2-c95b77c8edde12a1.json libproc_macro_crate-b5597a1d444622d7.json libquote-fcd22b39084cd4b0.json libregex-7d239c115e61eebd.json libryu-10101ea116e40bdd.json libryu-fe0a48ad916f6cd5.json libsha2-c8413ea0721b16f1.json libsha3-19bd4fcc2db00535.json libthread_local-6c59f363c8c67451.json libtoml-b9132b21fa720de4.json libunicode_xid-40a58482a0cdcda6.json libversion_check-21c0f9acc8eafaf4.json libwee_alloc-e96b7d7a567a76bf.json nft_simple-9f32599b2aa4cf30.json wasm32-unknown-unknown release .fingerprint ahash-399a40215a5a6369 lib-ahash.json base64-54eec6bc3a2e281a lib-base64.json borsh-e2cbfb1aadddee61 lib-borsh.json bs58-4f2061a8295f0e79 lib-bs58.json cfg-if-b4aa0ed23f0cba7d lib-cfg-if.json hashbrown-ed40e67e8b1ddc4e lib-hashbrown.json itoa-6fd5b19c7fa6477b lib-itoa.json memory_units-2825d28615e564a4 lib-memory_units.json near-sdk-d2ccc76f4eda272d lib-near-sdk.json near-sys-b1e388795f25b4fc lib-near-sys.json nft_simple-322841616f66c026 lib-nft_simple.json ryu-7238508d6fbfb755 lib-ryu.json ryu-c14cb36d8f13b8d3 run-build-script-build-script-build.json serde-bdac925e69dd0523 lib-serde.json serde-fbb9d892d3ad2866 run-build-script-build-script-build.json serde_json-cdc2354079746d8e run-build-script-build-script-build.json serde_json-faad7932bab30118 lib-serde_json.json wee_alloc-1e0d214c0b3fb3e8 lib-wee_alloc.json wee_alloc-a931c3171d428f84 run-build-script-build-script-build.json build wee_alloc-a931c3171d428f84 out wee_alloc_static_array_backend_size_bytes.txt | |","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1038,"byte_end":1133,"line_start":22,"line_end":22,"column_start":1,"column_end":96}},{"value":" | `encode` | Returns a new `String` | Always |","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1134,"byte_end":1229,"line_start":23,"line_end":23,"column_start":1,"column_end":96}},{"value":" | `encode_config` | Returns a new `String` | Always |","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1230,"byte_end":1325,"line_start":24,"line_end":24,"column_start":1,"column_end":96}},{"value":" | `encode_config_buf` | Appends to provided `String` | Only if `String` needs to grow |","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1326,"byte_end":1421,"line_start":25,"line_end":25,"column_start":1,"column_end":96}},{"value":" | `encode_config_slice` | Writes to provided `&[u8]` | Never |","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1422,"byte_end":1517,"line_start":26,"line_end":26,"column_start":1,"column_end":96}},{"value":" ","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1518,"byte_end":1521,"line_start":27,"line_end":27,"column_start":1,"column_end":4}},{"value":" All of the encoding functions that take a `Config` will pad as per the config.","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1522,"byte_end":1604,"line_start":28,"line_end":28,"column_start":1,"column_end":83}},{"value":" ","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1605,"byte_end":1608,"line_start":29,"line_end":29,"column_start":1,"column_end":4}},{"value":" # Decoding","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1609,"byte_end":1623,"line_start":30,"line_end":30,"column_start":1,"column_end":15}},{"value":" ","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1624,"byte_end":1627,"line_start":31,"line_end":31,"column_start":1,"column_end":4}},{"value":" Just as for encoding, there are different decoding functions available.","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1628,"byte_end":1703,"line_start":32,"line_end":32,"column_start":1,"column_end":76}},{"value":" ","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1704,"byte_end":1707,"line_start":33,"line_end":33,"column_start":1,"column_end":4}},{"value":" | Function | Output | Allocates |","span":{"file_name":" home ippishio .cargo registry src github.com-1ecc6299db9ec823 base64-0.13.0 src lib.rs","byte_start":1708,"byte_end":1804,"line_start":34,"line_end":34,"column_start":1,"column_end":97}},{"value":" | nft-uploader package-lock.json package.json package-lock.json package.json safari-pinned-tab.svg style.css
# near-cat-nft Challenge #3 #### NEAR CATS NFT Collection contains 50 images of cats, personally drawn by my hand :) #### Because this isn't real NFT collection, you can mint tokens as many as you want. ## Project structure Repository contains two folders: - nft-uploader - nft-contract #### nft-uploader Contains script, that is used to upload all 50 images to nft.storage using API. #### nft-contract Contains smart contract source code, which was builded and deployed to nft.ippishio.testnet #### nft-frontend(located in root) Contains all logic behind frontend page using THREE.js and near-api-js libraries. Near.js contains all blokchain integration logic, and Main.js for all other. When mint button is pressed, Near.js generates randID(used for pick random nft from collection), and passes it to the nft_mint() contract method. After approving transaction, there is transactionHash in URL args, which contains response from mint_nft() with the same randID, that was passed. After this, randID is used to render NFT image in THREE.js # TBD
Peersyst_xrp-evm-safe-client-gateway
.github ISSUE_TEMPLATE bug_report.md feature_request.md action-rs grcov.yml dependabot.yml landing_page index.html pull_request_template.md workflows cla.yml rust.yml Cargo.toml README.md add_rustfmt_git_hook.sh docker-compose.yml rust-toolchain.toml rustfmt.toml scripts autodeploy.sh deploy_docker.sh generate_test_tx.sh src cache cache_op_executors.rs cache_operations.rs inner_cache.rs manager.rs mod.rs redis.rs tests cache_inner.rs cache_op_executors.rs cache_operations.rs mod.rs common converters data_decoded.rs mod.rs page_metadata.rs tests balances.rs balances_v2.rs data_decoded.rs get_address_ex_from_any_source.rs get_transfer_direction.rs mod.rs page_metadata.rs safe_app.rs transfer_erc20.rs transfer_erc721.rs transfer_ether.rs transfers.rs transfers.rs mod.rs models addresses.rs backend about.rs balances.rs balances_v2.rs chains.rs hooks.rs mod.rs notifications.rs safe_apps.rs safes.rs transactions.rs transfers.rs data_decoded.rs mod.rs page.rs routes authorization.rs mod.rs tests common.rs mod.rs config mod.rs tests mod.rs macros.rs main.rs monitoring mod.rs performance.rs tests mod.rs path_patterns.rs providers address_info.rs ext.rs fiat.rs info.rs mod.rs tests fiat.rs info.rs mod.rs routes about handlers.rs mod.rs models.rs routes.rs tests mod.rs routes.rs balances converters.rs converters_v2.rs handlers.rs handlers_v2.rs mod.rs models.rs routes.rs chains converters.rs handlers.rs mod.rs models.rs routes.rs tests chains.rs json backend_chains_info_page.json expected_chains_info_page.json mod.rs routes.rs collectibles handlers.rs mod.rs models.rs routes.rs tests mod.rs routes.rs contracts handlers.rs mod.rs models.rs routes.rs tests mod.rs routes.rs delegates handlers.rs mod.rs models.rs routes.rs tests json backend_create_delegate.json backend_delete_delegate.json backend_delete_delegate_safe.json backend_list_delegates_of_safe.json expected_list_delegates_of_safe.json mod.rs routes.rs health mod.rs routes.rs tests mod.rs routes.rs hooks handlers.rs mod.rs routes.rs tests invalidate_caches.rs mod.rs routes.rs safes.rs messages backend_models.rs create_message.rs frontend_models.rs get_message.rs get_messages.rs message_mapper.rs mod.rs update_message.rs mod.rs notifications handlers.rs mod.rs models.rs routes.rs tests mod.rs routes.rs safe_apps converters.rs handlers.rs mod.rs models.rs routes.rs tests json response_safe_apps.json response_safe_apps_url_query.json response_safe_apps_with_tags.json mod.rs routes.rs safes converters.rs handlers estimations.rs mod.rs safes.rs mod.rs models.rs routes.rs tests json last_collectible_transfer.json last_history_tx.json last_queued_tx.json safe_state.json mod.rs routes.rs transactions converters details.rs mod.rs safe_app_info.rs summary.rs tests check_sender_or_receiver.rs data_size_calculation.rs details.rs is_cancellation.rs map_status.rs missing_signers.rs mod.rs safe_app_info.rs summary.rs transaction_id.rs transaction_types.rs transfer_type_checks.rs transaction_id.rs filters mod.rs module.rs multisig.rs tests mod.rs transfer.rs handlers commons.rs details.rs history.rs mod.rs module.rs multisig.rs preview.rs proposal.rs queued.rs tests mod.rs parse_id.rs transactions_history.rs transactions_queued.rs transfers.rs transfers.rs mod.rs models details.rs mod.rs requests.rs summary.rs routes.rs tests json chain_response.json contract_info_BID.json contracts_response.json multisig_tx_details.json post_confirmation_result.json preview_response.json preview_response_data_decoded_error.json mod.rs preview.rs routes.rs tests backend_url.rs json balances balance_compound_ether.json balance_ether.json chains polygon.json rinkeby.json rinkeby_disabled_wallets.json rinkeby_enabled_features.json rinkeby_fixed_gas_price.json rinkeby_multiple_gas_price.json rinkeby_no_gas_price.json rinkeby_rpc_auth_unknown.json rinkeby_rpc_no_auth.json rinkeby_unknown_gas_price.json collectibles collectibles_page.json collectibles_paginated_empty_cgw.json collectibles_paginated_empty_txs.json collectibles_paginated_page_1_cgw.json collectibles_paginated_page_1_txs.json collectibles_paginated_page_2_cgw.json collectibles_paginated_page_2_txs.json commons DOCTORED_data_decoded_multi_send_nested_delegate.json DOCTORED_data_decoded_nested_multi_sends.json data_decoded_add_owner_with_threshold.json data_decoded_approve.json data_decoded_change_master_copy.json data_decoded_change_threshold.json data_decoded_delete_guard.json data_decoded_disable_module.json data_decoded_enable_module.json data_decoded_exec_transaction_from_module.json data_decoded_multi_send.json data_decoded_multi_send_single_inner_transaction.json data_decoded_nested_safe_interaction.json data_decoded_remove_owner.json data_decoded_set_fallback_handler.json data_decoded_set_guard.json data_decoded_swap_array_values.json data_decoded_swap_owner.json empty_page.json contracts contract_info_BID.json exchange currency_rates.json master_copies polygon_master_copies.json mod.rs results tx_details_with_origin.json safe_apps polygon_safe_app_url_query.json polygon_safe_apps.json polygon_safe_apps_with_tags.json safes with_guard_safe_v130_l2.json with_module_transactions.json with_modules.json with_modules_and_high_nonce.json with_threshold_two.json tokens bat.json crypto_kitties.json dai.json pv_memorial_token.json usdt.json transactions backend_history_transaction_list_page.json backend_multisig_transfer_tx.json backend_queued_transaction_list_page_conflicts_393.json backend_queued_transaction_list_page_conflicts_394.json backend_queued_transaction_list_page_no_conflicts.json creation_transaction.json ethereum_inconsistent_token_types.json module_addOwnerWithThreshold_settings_change.json module_erc20_transfer.json module_erc721_transfer.json module_ether_transfer.json module_newAndDifferentAddOwnerWithThreshold_settings_change.json module_transaction.json module_transaction_failed.json multisig_addOwnerWithThreshold_settings_change.json multisig_approve_custom.json multisig_awaiting_confirmations.json multisig_awaiting_confirmations_empty.json multisig_awaiting_confirmations_null.json multisig_awaiting_confirmations_required_null.json multisig_awaiting_execution.json multisig_cancellation_transaction.json multisig_confirmations_null.json multisig_erc20_transfer.json multisig_erc20_transfer_delegate.json multisig_erc20_transfer_invalid_to_and_from.json multisig_erc20_transfer_with_value.json multisig_erc721_transfer.json multisig_erc721_transfer_cancelled.json multisig_erc721_transfer_invalid_to_and_from.json multisig_ether_transfer.json multisig_failed_transfer.json multisig_newAndDifferentAddOwnerWithThreshold_settings_change.json multisig_with_origin.json transfers erc20_transfer_with_erc721_token_info.json erc_20_transfer_unexpected_param_names.json erc_20_transfer_with_token_info_incoming.json erc_20_transfer_with_token_info_outgoing.json erc_20_transfer_without_token_info.json erc_721_transfer_with_token_info_incoming.json erc_721_transfer_with_token_info_outgoing.json erc_721_transfer_without_token_info.json ether_transfer_incoming.json ether_transfer_outgoing.json main.rs mod.rs utils context.rs cors.rs errors.rs http_client.rs json.rs mod.rs tests data_decoded_utils.rs errors.rs json.rs macros.rs method_names.rs mod.rs transactions.rs transactions.rs urls.rs
# Safe Client Gateway [![Actions Status](https://github.com/safe-global/safe-client-gateway/workflows/safe-client-gateway/badge.svg?branch=main)](https://github.com/safe-global/safe-client-gateway/actions) [![Coverage Status](https://coveralls.io/repos/github/safe-global/safe-client-gateway/badge.svg)](https://coveralls.io/github/safe-global/safe-client-gateway) ## Motivation This project is a gateway between the Safe clients ([Android](https://github.com/safe-global/safe-android)/ [iOS](https://github.com/safe-global/safe-ios)/ [web](https://github.com/safe-global/safe-react)) and the Safe backend services ([transaction service](https://github.com/safe-global/safe-transaction-service) and Ethereum nodes). It is providing a more UI-oriented mapping and multi-sourced data structures for ease of integration and rendering. ## Documentation - [Client Gateway Docs](https://safe.global/safe-client-gateway/) - [Swagger](https://safe-client.safe.global/index.html) - [Safe developer documentation](https://docs.gnosis-safe.io/) ## Quickstart This project requires `rustup` and `redis` ```bash git clone https://github.com/safe-global/safe-client-gateway.git cd safe-client-gateway cp .env.sample .env redis-server cargo run ./add_rustfmt_git_hook.sh # It installs a git precommit hook that will autoformat the code on every commit ``` After doing any change code must be formatted using [Rustfmt](https://github.com/rust-lang/rustfmt) - `cargo +nightly fmt --all` Auto formatting can also [be configured in the most common code editors](https://github.com/rust-lang/rustfmt#running-rustfmt-from-your-editor) ## Configuration Rocket specific configurations (including databases) can be configured via the `Rocket.toml` for local development (see https://rocket.rs/v0.4/guide/configuration/#rockettoml). For configurations specific to this service the `.env` file can be used. See next section. ## Environment Place a `.env` file in the root of the project containing URL pointing to the environment in which you want the gateway to run. The contents of the file should be the following (see `.env.sample` for an example) ## Tests In order to run the test suite of the project: 1. Have an instance of Redis running (as some of them test the integration with Redis). ```bash redis-server ``` 2. Make sure that the required environment variables are set (the following example assumes that Redis is runnning on the default port `6379`): ```bash export REDIS_URI=redis://localhost:6379 export REDIS_URI_MAINNET=redis://localhost:6379 ``` 3. Run the tests ```bash cargo test -- --test-threads 1 ``` By default, `cargo test` will execute the tests in the test suite in parallel. Because some of the tests update some shared local state (eg.: environment variables) the tests should be executed on a single thread – thus `--test-threads 1`.
mustafabalci_near-smart-contract-practice-1
README.md as-pect.config.js asconfig.json package.json scripts 1.dev-deploy.sh 2.use-contract.sh 3.cleanup.sh README.md src as_types.d.ts simple __tests__ as-pect.d.ts index.unit.spec.ts asconfig.json assembly index.ts singleton __tests__ as-pect.d.ts index.unit.spec.ts asconfig.json assembly index.ts tsconfig.json utils.ts
# `near-sdk-as` Starter Kit This is a good project to use as a starting point for your AssemblyScript project. ## Samples This repository includes a complete project structure for AssemblyScript contracts targeting the NEAR platform. The example here is very basic. It's a simple contract demonstrating the following concepts: - a single contract - the difference between `view` vs. `change` methods - basic contract storage There are 2 AssemblyScript contracts in this project, each in their own folder: - **simple** in the `src/simple` folder - **singleton** in the `src/singleton` folder ### Simple We say that an AssemblyScript contract is written in the "simple style" when the `index.ts` file (the contract entry point) includes a series of exported functions. In this case, all exported functions become public contract methods. ```ts // return the string 'hello world' export function helloWorld(): string {} // read the given key from account (contract) storage export function read(key: string): string {} // write the given value at the given key to account (contract) storage export function write(key: string, value: string): string {} // private helper method used by read() and write() above private storageReport(): string {} ``` ### Singleton We say that an AssemblyScript contract is written in the "singleton style" when the `index.ts` file (the contract entry point) has a single exported class (the name of the class doesn't matter) that is decorated with `@nearBindgen`. In this case, all methods on the class become public contract methods unless marked `private`. Also, all instance variables are stored as a serialized instance of the class under a special storage key named `STATE`. AssemblyScript uses JSON for storage serialization (as opposed to Rust contracts which use a custom binary serialization format called borsh). ```ts @nearBindgen export class Contract { // return the string 'hello world' helloWorld(): string {} // read the given key from account (contract) storage read(key: string): string {} // write the given value at the given key to account (contract) storage @mutateState() write(key: string, value: string): string {} // private helper method used by read() and write() above private storageReport(): string {} } ``` ## Usage ### Getting started (see below for video recordings of each of the following steps) INSTALL `NEAR CLI` first like this: `npm i -g near-cli` 1. clone this repo to a local folder 2. run `yarn` 3. run `./scripts/1.dev-deploy.sh` 3. run `./scripts/2.use-contract.sh` 4. run `./scripts/2.use-contract.sh` (yes, run it to see changes) 5. run `./scripts/3.cleanup.sh` ### Videos **`1.dev-deploy.sh`** This video shows the build and deployment of the contract. [![asciicast](https://asciinema.org/a/409575.svg)](https://asciinema.org/a/409575) **`2.use-contract.sh`** This video shows contract methods being called. You should run the script twice to see the effect it has on contract state. [![asciicast](https://asciinema.org/a/409577.svg)](https://asciinema.org/a/409577) **`3.cleanup.sh`** This video shows the cleanup script running. Make sure you add the `BENEFICIARY` environment variable. The script will remind you if you forget. ```sh export BENEFICIARY=<your-account-here> # this account receives contract account balance ``` [![asciicast](https://asciinema.org/a/409580.svg)](https://asciinema.org/a/409580) ### Other documentation - See `./scripts/README.md` for documentation about the scripts - Watch this video where Willem Wyndham walks us through refactoring a simple example of a NEAR smart contract written in AssemblyScript https://youtu.be/QP7aveSqRPo ``` There are 2 "styles" of implementing AssemblyScript NEAR contracts: - the contract interface can either be a collection of exported functions - or the contract interface can be the methods of a an exported class We call the second style "Singleton" because there is only one instance of the class which is serialized to the blockchain storage. Rust contracts written for NEAR do this by default with the contract struct. 0:00 noise (to cut) 0:10 Welcome 0:59 Create project starting with "npm init" 2:20 Customize the project for AssemblyScript development 9:25 Import the Counter example and get unit tests passing 18:30 Adapt the Counter example to a Singleton style contract 21:49 Refactoring unit tests to access the new methods 24:45 Review and summary ``` ## The file system ```sh ├── README.md # this file ├── as-pect.config.js # configuration for as-pect (AssemblyScript unit testing) ├── asconfig.json # configuration for AssemblyScript compiler (supports multiple contracts) ├── package.json # NodeJS project manifest ├── scripts │   ├── 1.dev-deploy.sh # helper: build and deploy contracts │   ├── 2.use-contract.sh # helper: call methods on ContractPromise │   ├── 3.cleanup.sh # helper: delete build and deploy artifacts │   └── README.md # documentation for helper scripts ├── src │   ├── as_types.d.ts # AssemblyScript headers for type hints │   ├── simple # Contract 1: "Simple example" │   │   ├── __tests__ │   │   │   ├── as-pect.d.ts # as-pect unit testing headers for type hints │   │   │   └── index.unit.spec.ts # unit tests for contract 1 │   │   ├── asconfig.json # configuration for AssemblyScript compiler (one per contract) │   │   └── assembly │   │   └── index.ts # contract code for contract 1 │   ├── singleton # Contract 2: "Singleton-style example" │   │   ├── __tests__ │   │   │   ├── as-pect.d.ts # as-pect unit testing headers for type hints │   │   │   └── index.unit.spec.ts # unit tests for contract 2 │   │   ├── asconfig.json # configuration for AssemblyScript compiler (one per contract) │   │   └── assembly │   │   └── index.ts # contract code for contract 2 │   ├── tsconfig.json # Typescript configuration │   └── utils.ts # common contract utility functions └── yarn.lock # project manifest version lock ``` You may clone this repo to get started OR create everything from scratch. Please note that, in order to create the AssemblyScript and tests folder structure, you may use the command `asp --init` which will create the following folders and files: ``` ./assembly/ ./assembly/tests/ ./assembly/tests/example.spec.ts ./assembly/tests/as-pect.d.ts ``` ## Setting up your terminal The scripts in this folder are designed to help you demonstrate the behavior of the contract(s) in this project. It uses the following setup: ```sh # set your terminal up to have 2 windows, A and B like this: ┌─────────────────────────────────┬─────────────────────────────────┐ │ │ │ │ │ │ │ A │ B │ │ │ │ │ │ │ └─────────────────────────────────┴─────────────────────────────────┘ ``` ### Terminal **A** *This window is used to compile, deploy and control the contract* - Environment ```sh export CONTRACT= # depends on deployment export OWNER= # any account you control # for example # export CONTRACT=dev-1615190770786-2702449 # export OWNER=sherif.testnet ``` - Commands _helper scripts_ ```sh 1.dev-deploy.sh # helper: build and deploy contracts 2.use-contract.sh # helper: call methods on ContractPromise 3.cleanup.sh # helper: delete build and deploy artifacts ``` ### Terminal **B** *This window is used to render the contract account storage* - Environment ```sh export CONTRACT= # depends on deployment # for example # export CONTRACT=dev-1615190770786-2702449 ``` - Commands ```sh # monitor contract storage using near-account-utils # https://github.com/near-examples/near-account-utils watch -d -n 1 yarn storage $CONTRACT ``` --- ## OS Support ### Linux - The `watch` command is supported natively on Linux - To learn more about any of these shell commands take a look at [explainshell.com](https://explainshell.com) ### MacOS - Consider `brew info visionmedia-watch` (or `brew install watch`) ### Windows - Consider this article: [What is the Windows analog of the Linux watch command?](https://superuser.com/questions/191063/what-is-the-windows-analog-of-the-linuo-watch-command#191068)
manognaaaa_blockyourvote
.gitpod.yml README.md contract README.md babel.config.json build.sh build builder.c code.h hello_near.js methods.h deploy.sh neardev dev-account.env package-lock.json package.json src contract.ts tsconfig.json frontend App.js Components AdminLogin.js Comingsoon.js Home.js NewPoll.js NewVoter.js PollingStation.js ShowResult.js UserLogin.js assets global.css logo-black.svg logo-white.svg dist index.ab0485ab.css index.html index.html index.js near-wallet.js package-lock.json package.json start.sh ui-components.js integration-tests package-lock.json package.json src main.ava.ts package-lock.json package.json
# BlockYourVote # Hello NEAR Contract The smart contract exposes two methods to enable storing and retrieving a greeting in the NEAR network. ```ts @NearBindgen({}) class HelloNear { greeting: string = "Hello"; @view // This method is read-only and can be called for free get_greeting(): string { return this.greeting; } @call // This method changes the state, for which it cost gas set_greeting({ greeting }: { greeting: string }): void { // Record a log permanently to the blockchain! near.log(`Saving greeting ${greeting}`); this.greeting = greeting; } } ``` <br /> # Quickstart 1. Make sure you have installed [node.js](https://nodejs.org/en/download/package-manager/) >= 16. 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash npm run deploy ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # e.g. dev-1659899566943-21539992274727 ``` <br /> ## 2. Retrieve the Greeting `get_greeting` is a read-only method (aka `view` method). `View` methods can be called for **free** by anyone, even people **without a NEAR account**! ```bash # Use near-cli to get the greeting near view <dev-account> get_greeting ``` <br /> ## 3. Store a New Greeting `set_greeting` changes the contract's state, for which it is a `call` method. `Call` methods can only be invoked using a NEAR account, since the account needs to pay GAS for the transaction. ```bash # Use near-cli to set a new greeting near call <dev-account> set_greeting '{"greeting":"howdy"}' --accountId <dev-account> ``` **Tip:** If you would like to call `set_greeting` using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`.
EvmosGov_tracker
.eslintrc.json .github ISSUE_TEMPLATE config.yml new_issue.yml README.md jest.config.js next-env.d.ts next.config.js package.json postcss.config.js public js mobile.js vercel.svg src config.ts features api-routes api github __tests__ utils.test.ts index.ts types.ts utils.ts handlers bounties index.ts issues index.ts utils.ts types.ts bounties api.ts hooks useAddBountyMutation.ts types.ts common constants.ts hooks useGuildQueries.ts useWalletQueries.ts types.ts evmos api.ts issues api.ts constants.ts hooks useIssuesQueries.ts types.ts near api.ts types.ts tokens hooks useTokensQueries.ts types.ts pages api bounties index.ts comment addComment.ts getVoteCount.ts hello.ts issues [issueNumber].ts index.ts styles fonts.css globals.css utils helpers.js tailwind.config.js test mocks github.ts tsconfig.json
# Evmos Govnernance Issue Tracker ## Dev Checkout the repo and set the required environmental variables by copying `./.env.example` into `./.env.local`. Next, install the dependencies: ```bash npm install # or yarn install ``` Run the development server: ```bash npm run dev # or yarn dev ```
NEAR-Hispano_Artemis-Elearning
.history README_20220518134301.md README_20220518134317.md README_20220518134353.md README_20220518134426.md README_20220601130356.md README_20220601130813.md README_20220601130825.md README_20220601130829.md README_20220601130832.md README_20220601130834.md README_20220601130841.md README_20220601130843.md README_20220601130845.md README_20220601130852.md README_20220601130854.md README_20220601130901.md Artemis-Contract Cargo.toml README.md build.sh src lib.rs Artemis-ContractNTF Cargo.toml src event.rs lib.rs Artemis-Front CHANGELOG.md README.md babel.config.js certificado-artemis index.html package-lock.json package.json public index.html themes dark theme.css light theme.css src Routes.js components Layout i18n.js config.js main.js plugins i18n.js vuetify.js store index.js vue.config.js Artemis-Ipfs README.md app controllers admin.js helpers utils.js routes admin.js index.js gulpfile.js package-lock.json package.json server.bundle.js server.js webpack.config.js Artemis_Back_Django mysite backend __init__.py admin.py apps.py migrations 0001_initial.py 0002_answer_profile_question_test_delete_user_and_more.py 0003_alter_answer_question_alter_question_test.py 0004_alter_answer_question_alter_question_test.py 0005_alter_question_pregunta.py 0006_alter_answer_respuesta.py 0007_profile_firma.py 0008_alter_profile_firma.py 0009_alter_profile_firma.py 0010_alter_profile_firma.py 0011_alter_profile_firma.py __init__.py models.py serializers.py tests.py urls.py views.py manage.py mysite __init__.py asgi.py settings.py settings2.py urls.py wsgi.py requirements.txt README.md
# ARTEMIS ## Artemis - Elearning Es una Dapp descentralizada para la realización de estudios mediante cursos en línea, utilizando como contrato inteligente el protocolo de near para el proceso de pago de los cursos en la wallet de near. Por cada curso aprobado, los estudiante tendran la opcion de transformar su certificado en NFT en su wallet Near. # Objetivos 1. Inicio de sesión integrado en el protocolo Wallet NEAR. 2. Certificados NFT. 3. Distribución de pagos de instructores mediante NEAR Protocol. 4. Pagos de estudiantes con Wallet NEAR Protocol ## Desarrollo Plataforma que integra VUE.js como Frontend y Backend con Rust, es una dapp amigable y sencilla para los usuarios, que permite incorporar la seguridad que proporciona el Blockchain para la generación de confianza del publico. # Autores - Maria Alejandra Gutierrez - Jorge Luis Cuauro - Juan Jose Ochando # Ambiente de Pruebas > https://www.artemis-edu.com/#/
nearvndev_uit-ecommerce-contract-tests
Cargo.toml README.md src tests.rs
# uit-ecommerce-contract-tests Run test command ``` cargo run --example integration-test ```
makerst_Learn-Near
as-pect.config.js asconfig.json assembly __tests__ as-pect.d.ts example.spec.ts as_types.d.ts index.ts tsconfig.json package-lock.json package.json
esaminu123_console-boilerplate-template-rs-local-copy-8
.eslintrc.yml .github ISSUE_TEMPLATE 01_BUG_REPORT.md 02_FEATURE_REQUEST.md 03_CODEBASE_IMPROVEMENT.md 04_SUPPORT_QUESTION.md config.yml PULL_REQUEST_TEMPLATE.md labels.yml workflows codeql.yml deploy-to-console.yml labels.yml lock.yml pr-labels.yml stale.yml .gitpod.yml README.md contract Cargo.toml README.md build.sh deploy.sh src lib.rs docs CODE_OF_CONDUCT.md CONTRIBUTING.md SECURITY.md frontend App.js assets global.css logo-black.svg logo-white.svg index.html index.js near-interface.js near-wallet.js package.json start.sh ui-components.js integration-tests Cargo.toml src tests.rs package.json
# Hello NEAR Contract The smart contract exposes two methods to enable storing and retrieving a greeting in the NEAR network. ```rust const DEFAULT_GREETING: &str = "Hello"; #[near_bindgen] #[derive(BorshDeserialize, BorshSerialize)] pub struct Contract { greeting: String, } impl Default for Contract { fn default() -> Self { Self{greeting: DEFAULT_GREETING.to_string()} } } #[near_bindgen] impl Contract { // Public: Returns the stored greeting, defaulting to 'Hello' pub fn get_greeting(&self) -> String { return self.greeting.clone(); } // Public: Takes a greeting, such as 'howdy', and records it pub fn set_greeting(&mut self, greeting: String) { // Record a log permanently to the blockchain! log!("Saving greeting {}", greeting); self.greeting = greeting; } } ``` <br /> # Quickstart 1. Make sure you have installed [rust](https://rust.org/). 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash ./deploy.sh ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # e.g. dev-1659899566943-21539992274727 ``` <br /> ## 2. Retrieve the Greeting `get_greeting` is a read-only method (aka `view` method). `View` methods can be called for **free** by anyone, even people **without a NEAR account**! ```bash # Use near-cli to get the greeting near view <dev-account> get_greeting ``` <br /> ## 3. Store a New Greeting `set_greeting` changes the contract's state, for which it is a `change` method. `Change` methods can only be invoked using a NEAR account, since the account needs to pay GAS for the transaction. ```bash # Use near-cli to set a new greeting near call <dev-account> set_greeting '{"message":"howdy"}' --accountId <dev-account> ``` **Tip:** If you would like to call `set_greeting` using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`. <h1 align="center"> <a href="https://github.com/near/boilerplate-template-rs"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/near/boilerplate-template-rs/main/docs/images/pagoda_logo_light.png"> <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/near/boilerplate-template-rs/main/docs/images/pagoda_logo_dark.png"> <img alt="" src="https://raw.githubusercontent.com/near/boilerplate-template-rs/main/docs/images/pagoda_logo_dark.png"> </picture> </a> </h1> <div align="center"> Rust Boilerplate Template <br /> <br /> <a href="https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=bug&template=01_BUG_REPORT.md&title=bug%3A+">Report a Bug</a> · <a href="https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=enhancement&template=02_FEATURE_REQUEST.md&title=feat%3A+">Request a Feature</a> . <a href="https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=question&template=04_SUPPORT_QUESTION.md&title=support%3A+">Ask a Question</a> </div> <div align="center"> <br /> [![Pull Requests welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg?style=flat-square)](https://github.com/near/boilerplate-template-rs/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) [![code with love by near](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-near-ff1414.svg?style=flat-square)](https://github.com/near) </div> <details open="open"> <summary>Table of Contents</summary> - [About](#about) - [Built With](#built-with) - [Getting Started](#getting-started) - [Prerequisites](#prerequisites) - [Installation](#installation) - [Usage](#usage) - [Roadmap](#roadmap) - [Support](#support) - [Project assistance](#project-assistance) - [Contributing](#contributing) - [Authors & contributors](#authors--contributors) - [Security](#security) </details> --- ## About This project is created for easy-to-start as a React + Rust skeleton template in the Pagoda Gallery. It was initialized with [create-near-app]. Clone it and start to build your own gallery project! ### Built With [create-near-app], [amazing-github-template](https://github.com/dec0dOS/amazing-github-template) Getting Started ================== ### Prerequisites Make sure you have a [current version of Node.js](https://nodejs.org/en/about/releases/) installed – we are targeting versions `16+`. Read about other [prerequisites](https://docs.near.org/develop/prerequisites) in our docs. ### Installation Install all dependencies: npm install Build your contract: npm run build Deploy your contract to TestNet with a temporary dev account: npm run deploy Usage ===== Test your contract: npm test Start your frontend: npm start Exploring The Code ================== 1. The smart-contract code lives in the `/contract` folder. See the README there for more info. In blockchain apps the smart contract is the "backend" of your app. 2. The frontend code lives in the `/frontend` folder. `/frontend/index.html` is a great place to start exploring. Note that it loads in `/frontend/index.js`, this is your entrypoint to learn how the frontend connects to the NEAR blockchain. 3. Test your contract: `npm test`, this will run the tests in `integration-tests` directory. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `npm run deploy`, your smart contract gets deployed to the live NEAR TestNet with a temporary dev account. When you're ready to make it permanent, here's how: Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `npm install`, but for best ergonomics you may want to install it globally: npm install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `near-blank-project.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `near-blank-project.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account near-blank-project.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: deploy the contract --------------------------- Use the CLI to deploy the contract to TestNet with your account ID. Replace `PATH_TO_WASM_FILE` with the `wasm` that was generated in `contract` build directory. near deploy --accountId near-blank-project.YOUR-NAME.testnet --wasmFile PATH_TO_WASM_FILE Step 3: set contract name in your frontend code ----------------------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'near-blank-project.YOUR-NAME.testnet' Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/concepts/basics/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli [gh-pages]: https://github.com/tschaub/gh-pages ## Roadmap See the [open issues](https://github.com/near/boilerplate-template-rs/issues) for a list of proposed features (and known issues). - [Top Feature Requests](https://github.com/near/boilerplate-template-rs/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc) (Add your votes using the 👍 reaction) - [Top Bugs](https://github.com/near/boilerplate-template-rs/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc) (Add your votes using the 👍 reaction) - [Newest Bugs](https://github.com/near/boilerplate-template-rs/issues?q=is%3Aopen+is%3Aissue+label%3Abug) ## Support Reach out to the maintainer: - [GitHub issues](https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=question&template=04_SUPPORT_QUESTION.md&title=support%3A+) ## Project assistance If you want to say **thank you** or/and support active development of Rust Boilerplate Template: - Add a [GitHub Star](https://github.com/near/boilerplate-template-rs) to the project. - Tweet about the Rust Boilerplate Template. - Write interesting articles about the project on [Dev.to](https://dev.to/), [Medium](https://medium.com/) or your personal blog. Together, we can make Rust Boilerplate Template **better**! ## Contributing First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are **greatly appreciated**. Please read [our contribution guidelines](docs/CONTRIBUTING.md), and thank you for being involved! ## Authors & contributors The original setup of this repository is by [Dmitriy Sheleg](https://github.com/shelegdmitriy). For a full list of all authors and contributors, see [the contributors page](https://github.com/near/boilerplate-template-rs/contributors). ## Security Rust Boilerplate Template follows good practices of security, but 100% security cannot be assured. Rust Boilerplate Template is provided **"as is"** without any **warranty**. Use at your own risk. _For more information and to report security issues, please refer to our [security documentation](docs/SECURITY.md)._
near_data-platform
.github ISSUE_TEMPLATE BOUNTY.yml bug-report.md epic-template-.md feature-request.md secondary-focus-area-.md README.md
# This is a space of Data Platform team's issues Near.org Data Platform Initiatives and Epics: Recommendations, Search, Analaytics ## How to use GitHub - Roadmap: https://github.com/orgs/near/projects/80/views/3?sliceBy%5Bvalue%5D=Data+Platform - QueryAPI tickets in queryapi repo - General Data platform epics and tickets are data-platform repo ## Data Platform Initiatives - Should have clear title that could be understood by anyone in the ecosystem - Should have Data Platform team assigned - Should have a description with high-level functionality, without technical details - Should have at least one epic in the relevant team’s repository that implements it - Should have defined Priority and Impact ## Data Platform Epics - Should be used to group issues into user-facing functionality that is publicly announced. - Should take at most one quarter to complete. - Should have the title that describes the end-user value. If this is not possible (i.e. the epic is about refactoring),consider moving sub-issues to other epics that have appropriate title. - Should be connected to a Pagoda Initiative in the [Pagoda Public Roadmap](https://github.com/orgs/near/projects/80/views/3?sliceBy%5Bvalue%5D=Data+Platform) - Ideally have a milestone assigned. The milestone is some public announcement, conference, a sunset of a functionality or some other important external event. ## Creating GitHub issues - Should be included in the Data Platform project (now automated) - Should be connected to a relevant Epic - Should be linked to an issue that blocks it, or if it is blocking another issue. - Should not have an assigned person if it is unclear who will work on this issue. - Ideally have an appropriate label: `bug`, `indexer` ## Issues lifecycle - Todo - Selected - In Progress - In Review - Released to Staging (through GitHub Actions) - Issue is 'Done' when it is released to production (through GitHub Actions) ## Working on GitHub issues - Ensure the state is 'In Progress' - If issue involves writing code, start a draft PR as soon as possible, so that the team can see the progress - Connect it to a relevant Pull Request. If PR-linking functionality doesn’t work, drop PR link to a comment ## Communication - All ticket-related communication should be in issues: questions about functionality - If the communication happens in slack, the decision should be pasted in the description of the issue or in a comment
phamvankhang_near-nft-back-to-code-challenge
.gitpod.yml README.md babel.config.js contract Cargo.toml README.md compile.js src approval.rs box.rs burn.rs collection.rs enumeration.rs events.rs internal.rs lib.rs metadata.rs mint.rs nft_core.rs royalty.rs schema.rs template.rs package.json src App.js __mocks__ fileMock.js assets logo-black.svg logo-white.svg config.js global.css index.html index.js jest.init.js main.test.js utils.js wallet login index.html
ezbox Smart Contract ================== A [smart contract] written in [Rust] for an app initialized with [create-near-app] Quick Start =========== Before you compile this code, you will need to install Rust with [correct target] Exploring The Code ================== 1. The main smart contract code lives in `src/lib.rs`. You can compile it with the `./compile` script. 2. Tests: You can run smart contract tests with the `./test` script. This runs standard Rust tests using [cargo] with a `--nocapture` flag so that you can see any debug info you print to the console. [smart contract]: https://docs.near.org/docs/develop/contracts/overview [Rust]: https://www.rust-lang.org/ [create-near-app]: https://github.com/near/create-near-app [correct target]: https://github.com/near/near-sdk-rs#pre-requisites [cargo]: https://doc.rust-lang.org/book/ch01-03-hello-cargo.html # near-nft-back-to-code-challenge this repo for my own back to code challenge and join minihackathon event ## Idea Game industry have many gambling items like `treasure chest`, `lucky box`, etc... I want to move the item to near blockchain ## Core value Transparent Lucky rate Only one unbox experience for all games Same time for game developers, They should focus on game ## refer repo I use in project https://github.com/near-examples/nft-tutorial https://github.com/ParasHQ/paras-nft-contract.git ## Contact My name is Khang, You can also call me Phillip. Email: [email protected] Discord: Phillip#4915
evstigneeff_near-stakewars-data
package-lock.json package.json src api_requests.js connect.js index.js
near-everything_bos-events
README.md package.json
# bos-events
near-examples_nft-tutorial-frontend
README.md contract Cargo.toml README.md build.sh src approval.rs enumeration.rs events.rs internal.rs lib.rs metadata.rs mint.rs nft_core.rs royalty.rs package.json src App.js Components InfoBubble.js MintingTool.js __mocks__ fileMock.js assets logo-black.svg logo-white.svg near_icon.svg near_logo_wht.svg config.js global.css index.html index.js jest.init.js main.test.js utils.js wallet login index.html
nft-mint-frontend ================== This [React] app was initialized with [create-near-app] Quick Start =========== To run this project locally: 1. Prerequisites: Make sure you've installed [Node.js] ≥ 12 2. Install dependencies: `yarn install` 3. Run the local development server: `yarn dev` (see `package.json` for a full list of `scripts` you can run with `yarn`) Now you'll have a local development environment backed by the NEAR TestNet! Go ahead and play with the app and the code. As you make code changes, the app will automatically reload. Exploring The Code ================== 1. The "backend" code lives in the `/contract` folder. See the README there for more info. 2. The frontend code lives in the `/src` folder. `/src/index.html` is a great place to start exploring. Note that it loads in `/src/index.js`, where you can learn how the frontend connects to the NEAR blockchain. 3. Tests: there are different kinds of tests for the frontend and the smart contract. See `contract/README` for info about how it's tested. The frontend code gets tested with [jest]. You can run both of these at once with `yarn run test`. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `yarn dev`, your smart contract gets deployed to the live NEAR TestNet with a throwaway account. When you're ready to make it permanent, here's how. Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `yarn install`, but for best ergonomics you may want to install it globally: yarn install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `nft-mint-frontend.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `nft-mint-frontend.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account nft-mint-frontend.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: set contract name in code --------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'nft-mint-frontend.YOUR-NAME.testnet' Step 3: deploy! --------------- One command: yarn deploy As you can see in `package.json`, this does two things: 1. builds & deploys smart contract to NEAR TestNet 2. builds & deploys frontend code to GitHub using [gh-pages]. This will only work if the project already has a repository set up on GitHub. Feel free to modify the `deploy` script in `package.json` to deploy elsewhere. Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [React]: https://reactjs.org/ [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/docs/concepts/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli [gh-pages]: https://github.com/tschaub/gh-pages nft-mint-frontend Smart Contract ================== A [smart contract] written in [Rust] for an app initialized with [create-near-app] Quick Start =========== Before you compile this code, you will need to install Rust with [correct target] Exploring The Code ================== 1. The main smart contract code lives in `src/lib.rs`. You can compile it with the `./compile` script. 2. Tests: You can run smart contract tests with the `./test` script. This runs standard Rust tests using [cargo] with a `--nocapture` flag so that you can see any debug info you print to the console. [smart contract]: https://docs.near.org/develop/welcome [Rust]: https://www.rust-lang.org/ [create-near-app]: https://github.com/near/create-near-app [correct target]: https://github.com/near/near-sdk-rs#pre-requisites [cargo]: https://doc.rust-lang.org/book/ch01-03-hello-cargo.html
juno-labs_mars-minter-contract
.cargo config.toml .github workflows tests.yml .vscode settings.json Cargo.toml README.md __test__ marketplace.ava.ts marsMinter.ava.ts marsMinterUtils.ts payouts.ava.ts whitelist.ava.ts contracts mars_minter Cargo.toml src lib.rs payout.rs raffle.rs package.json scripts cli.ts example-whitelist-addresses.json tsconfig.json
# Mars Minter Contract # Setup ```sh # Install dependencies yarn # Run tests yarn test ```
Made-For-Gamers_NEAR-Unity-WebGL-API
Assets Scripts Auth WalletAuthenticate.cs JS API Near_API.cs NFT GetArweaveNFTMeta.cs GetMFGNFTMeta.cs GetNFTImage.cs NFT Data ArweaveNFTMeta.cs MFGNFTMeta.cs NearNFTMeta.cs UnityAsyncOperationAwaiter.cs RPC API Near_RPC.cs Post Data Post_ViewAccount.cs Return Data ViewAccount.cs TextMesh Pro Fonts LiberationSans - OFL.txt Resources LineBreaking Following Characters.txt LineBreaking Leading Characters.txt Sprites EmojiOne Attribution.txt EmojiOne.json WebGLSupport WebGLInput Detail RebuildChecker.cs Mobile WebGLInputMobile.cs WebGLInput.cs Wrapper IInputField.cs WrappedInputField.cs WrappedTMPInputField.cs WebGLWindow WebGLWindow.cs WebGLTemplates NEAR TemplateData style.css index.html Packages manifest.json packages-lock.json ProjectSettings BurstAotSettings_StandaloneWindows.json BurstAotSettings_WebGL.json CommonBurstAotSettings.json ProjectVersion.txt SceneTemplateSettings.json README.md
# NEAR-Unity-WebGL-API WebGL JSLIB intergration with the Near Javascript API (near-api-js) <p>&nbsp;</p> ## Features 1) Example scene for near-api-js function calls 2) Login to Near wallet 3) Check login status 4) Check account ID 5) Check account balance 6) Call a contract method 7) Return a testnet Mintbase NFT 8) Return a testnet MFG NFT 9) Example scene for calling account info via a Near RPC API call <p>&nbsp;</p> ## Unity Project Ø Unity version: 2021.3.21f1 Ø Make sure you install 2 Unity Editor modules - WebGL Build Support & Windows Build Support (IL2CPP) Ø Build platform: WebGL Ø Newtonsoft.JSON Ø New Input sytem Ø Render Pipeline: URP <p>&nbsp;</p> ## Installation 1) Register a Near wallet on Testnet and/or Mainnet 2) Fork this repo to your local machine, make sure LFS is also installed 3) Open local repo folder from Unity Hub 4) Unity will report that their are compile errors, click Ignore (step 5 will resolve this) 5) File / Build Settings - Set platform to WebGL 6) 7) File / Build And Run - set your own build directory 8) When the WebGL application opens in your browser you will see a screen with the login button. 9) Select the relevant Near network testnet/mainnet from the dropdown and click the Login button 10) Sign in using your relevant Near wallet. 11) Use the interface to test various Near API calls, including calling a contract method and passing an argument. <p>&nbsp;</p> ## Classes ### Near_API class Class with a Near namespace that contains static methods that calls near-api-js funtions in the JSLIB file (Plugin). The Index.html file holds the reference to the near-api-js API and connection configuration for each network. This class also contains static variables that stores the user account ID and login status. <p>&nbsp;</p> ### WalletAuthenticate MonoBehavior Class Used by the WalletLogin scene to calls the Near_API methods. <p>&nbsp;</p> ### Near_RPC MonoBehavior Class Example of posting json to the Near RPC API and returning a user's account details. Uses 2 other classes to handle the JSON fields. 1) Post_ViewAccount class - JSON post fields 2) ViewAccount class - Returned JSON fields <p>&nbsp;</p> ## Scenes ### WalletLogin scene Default scene with the following functions. 1) Login 2) Logout 3) Check login status 4) Get account ID 5) Get account balance 6) Navigate to the RPC scene 7) Call a method on a contract passing in a JSON argument (Examples of retrieving a Mintbase NFT and the MFG NFT) ### RPC scene Displays the user account details called from the RPC API. <p>&nbsp;</p> ## Other Resources ### NEAR > Near JavaScript API documentation - https://docs.near.org/tools/near-api-js/quick-reference > Near testnet wallet - https://wallet.testnet.near.org/ > Near testnet explorer - https://explorer.testnet.near.org/ > Near Fungible Tokens docs - https://docs.near.org/tutorials/fts/simple-fts > Near GitHub - https://github.com/orgs/near/repositories?type=all > Near Client for Unity (Android / 3 year old repo) - https://github.com/near/near-api-unity
NEARBuilders_NEARSletter
JAN2023.md | Q12023.md README.md
The NEAR developer = ecosystem updates # Table of contents * [JAN2023](README.md) * [Q12023] (Q12023.md) * [README](README.md)
nikbhintade_cf-sm-rust
Cargo.toml src lib.rs
noandrea_revocation-lists-2020-contracts
README.md casper .travis.yml client main.go contract .cargo config.toml Cargo.toml src main.rs model.rs tests Cargo.toml src integration_tests.rs fantom README.md hardhat.config.js package-lock.json package.json test RevocationLists.test.js near contract Cargo.toml README.md build.sh src lib.rs models.rs utils.rs package-lock.json package.json
# Ye ## References - https://oliverjumpertz.com/how-to-set-up-a-solidity-project-and-create-your-first-smart-contract/ # Rust Smart Contracts for WebAssembly (WASM) This repository contains implementations for WebAssembly (WASM) smart contracts written in Rust for different blockchain platforms. The primary goal of this project is to compare the ergonomics and other aspects of developing smart contracts in Rust on different blockchain platforms. ## Supported Blockchains The following blockchain platforms are currently supported: - NEAR Protocol ## RevocationList2020 Specification All smart contracts in this repository implement the RevocationList2020 specification. The RevocationList2020 specification provides a way to revoke the credentials issued by a specific issuer. This can be useful in scenarios where an issuer needs to revoke a credential due to various reasons, such as a user's account being compromised or the credential being no longer valid. The RevocationList2020 specification provides a standard format for revocation lists and defines how these lists can be used to revoke credentials issued by an issuer. All smart contracts in this repository adhere to this specification, which ensures that the revocation process is interoperable across different blockchain platforms. By implementing the RevocationList2020 specification, these smart contracts provide an additional layer of security and flexibility, making them suitable for various use cases. ## Getting Started To get started with this project, you'll need to have Rust and the toolchains for the respective blockchain platforms installed on your machine. 1. Clone the repository: ```sh git clone https://github.com/noandrea/revocation-lists-2020-contracts.git ``` 2. Change into the project directory: ```sh Copy code cd revocation-lists-2020-contracts ``` 3. Change into the directory for the blockchain platform you want to work with: ```sh cd near ``` 4. Build the smart contract: ```sh make build ``` 4. Deploy the smart contract to the blockchain platform: For Solana, you can use `solana deploy`. For NEAR Protocol, you can use `near deploy`. ## Contract structure The contract has the following method signatures: - `register_list(string)` - register a new list using the input string for the list id - `get_encoded_lsit(string)` - retrieve the encoded revocation list identified by `string` - `is_revoked(string, int)` - return whenver a credential at index `int` has been revoked - `revoke(string, int)` - revoke a single credential - `reset(string, int)` - - `update(string, []int, []int)` - atomically update a revocation list - `replace_list(string, string)` - replace the list ## Contributing We welcome contributions from anyone. If you'd like to contribute to this project, please fork the repository and create a pull request. ## License This project is licensed under the MIT License - see the LICENSE file for details. # A revocation lists contract ### Before you start Install rust, npx, and npm. ## How to deploy > Create contract account ```sh near create-account revocation-lists.metadid.testnet --masterAccount metadid.testnet ``` ``` Saving key to '$HOME/.near-credentials/testnet/revocation-lists.metadid.testnet.json' Account revocation-lists.metadid.testnet for network "testnet" was created. ``` > Build contract ```sh cd contract ``` ```sh make build RUSTFLAGS='-C link-arg=-s' cargo build --target wasm32-unknown-unknown --release ``` ``` Compiling contract v0.1.0 (...) Finished release [optimized] target(s) in 2.12s ``` > Deploy ```sh ./near deploy --accountId revocation-lists.metadid.testnet --wasmFile target/wasm32-unknown-unknown/release/contract.wasm ``` ``` Starting deployment. Account id: revocation-lists.metadid.testnet, node: https://rpc.testnet.near.org, helper: https://helper.testnet.near.org, file: target/wasm32-unknown-unknown/release/contract.wasm Transaction Id 6QaSDXgDBqzw55CP9m5FxkHFzDAgeYvUoHBy3x4eH5qV To see the transaction in the transaction explorer, please open this url in your browser https://explorer.testnet.near.org/transactions/6QaSDXgDBqzw55CP9m5FxkHFzDAgeYvUoHBy3x4eH5qV Done deploying to revocation-lists.metadid.testnet ``` > Init the contract ``` near call revocation-lists.metadid.testnet new '{"owner": "metadid.testnet"}' --accountId metadid.testnet ``` ``` Scheduling a call: revocation-lists.metadid.testnet.new({"owner": "metadid.testnet"}) Doing account.functionCall() Transaction Id DWrvvzt2u8gb3k6NGpyPqTuc3QvuCVr948UdNthX9Ktq To see the transaction in the transaction explorer, please open this url in your browser https://explorer.testnet.near.org/transactions/DWrvvzt2u8gb3k6NGpyPqTuc3QvuCVr948UdNthX9Ktq '' ``` > Init revocation lists ``` near call revocation-lists.metadid.testnet add_list '{"id": "metadid.testnet/rl/1"}' --accountId metadid.testnet ``` ``` Scheduling a call: revocation-lists.metadid.testnet.add_list({"id": "metadid.testnet/rl/1"}) Doing account.functionCall() Receipt: 4xPa5Nua7fbk3nH2rAuWgwPv1WM7ftDxg4edtyaYXE1F Log [revocation-lists.metadid.testnet]: Added a new revocation list Transaction Id AUS3nE3usr2k9nsCatxcvjGfqYwvuAdUCNBB6qhjhu91 To see the transaction in the transaction explorer, please open this url in your browser https://explorer.testnet.near.org/transactions/AUS3nE3usr2k9nsCatxcvjGfqYwvuAdUCNBB6qhjhu91 ``` > Revoke an item ``` ./near call revocation-lists.metadid.testnet revoke '{"id": "metadid.testnet/rl/1", "idx": 134}' --accountId metadid.testnet ``` ``` Scheduling a call: revocation-lists.metadid.testnet.revoke({"id": "metadid.testnet/rl/1", "idx": 134}) Doing account.functionCall() Receipt: AYpzRPyFXJme4BZdQBpgmUV4mmekPmQk5CSj16pZyqpU Log [revocation-lists.metadid.testnet]: credential updated Transaction Id 29UGZbFCeJ345QytqQztavV3BN91wJiqRSung2MSu8Sx To see the transaction in the transaction explorer, please open this url in your browser https://explorer.testnet.near.org/transactions/29UGZbFCeJ345QytqQztavV3BN91wJiqRSung2MSu8Sx ``` > check revocation ``` ./near call revocation-lists.metadid.testnet is_revoked '{"id": "metadid.testnet/rl/1", "idx": 134}' --accountId metadid.testnet ``` ``` Scheduling a call: revocation-lists.metadid.testnet.is_revoked({"id": "metadid.testnet/rl/1", "idx": 134}) Doing account.functionCall() Transaction Id HDKTX95hfznazekuR1d8KPUvEsh4QviaHuiuhDH2CzAp To see the transaction in the transaction explorer, please open this url in your browser https://explorer.testnet.near.org/transactions/HDKTX95hfznazekuR1d8KPUvEsh4QviaHuiuhDH2CzAp true ``` ## Notes - what about the init method, and what is the role of the owner - add logic to change the owner
near-explorer_near-explorer.github.io
Notes.md README.md library contracts aurora.json interfaces nep141.json transactions deploy_bridge_token.json ft_transfer_call.json wnear.deposit.json package.json public index.html manifest.json robots.txt scripts make_bundle.py src actions TxsAction.ts api Txs.ts assets App.css index.css components Api index.ts library-tools ast.ts bundle.json loader.ts parser.ts types.ts near-api near.ts types.ts storage contract.ts store.ts utils format.ts reportWebVitals.ts tsconfig.json
# NEAR Mini Explorer Serverless explorer for [NEAR](https://near.org/). ## Roadmap - [ ] Host service using web4.near.page - [ ] Save downloaded data using [IndexedDB](https://developer.mozilla.org/es/docs/Web/API/IndexedDB_API) This will help to avoid downloading the same data multiple times. For each account select what was the last block downloaded and only start from there. Save common data from react components like FT metadata (etc...) - [ ] Add FAQ section (How does it work! How to contribute (to the code && to the parsed data)!) - [ ] Add search / filter functionality - [ ] Add support for multiple networks (mainnet,testnet) - [ ] Support fetching transactions descriptions from NEAR Blockchain (need to create a contract for this) - [ ] Add page to interact easily with contracts (view methods / state queries / change methods) - [ ] Make better invasive download policy (make only 100?? requests at a time) - [ ] Prioritize most recent transactions first - [ ] Update the progress bar depending on the percent of the prefix completed
near_hashbrown
.github ISSUE_TEMPLATE BOUNTY.yml .travis.yml CHANGELOG.md Cargo.toml README.md benches bench.rs bors.toml ci miri.sh run.sh tools.sh clippy.toml src external_trait_impls mod.rs rayon helpers.rs map.rs mod.rs raw.rs set.rs serde.rs lib.rs macros.rs map.rs raw alloc.rs bitmask.rs generic.rs mod.rs sse2.rs rustc_entry.rs scopeguard.rs set.rs tests hasher.rs rayon.rs serde.rs set.rs
hashbrown ========= [![Build Status](https://travis-ci.com/rust-lang/hashbrown.svg?branch=master)](https://travis-ci.com/rust-lang/hashbrown) [![Crates.io](https://img.shields.io/crates/v/hashbrown.svg)](https://crates.io/crates/hashbrown) [![Documentation](https://docs.rs/hashbrown/badge.svg)](https://docs.rs/hashbrown) [![Rust](https://img.shields.io/badge/rust-1.49.0%2B-blue.svg?maxAge=3600)](https://github.com/rust-lang/hashbrown) This crate is a Rust port of Google's high-performance [SwissTable] hash map, adapted to make it a drop-in replacement for Rust's standard `HashMap` and `HashSet` types. The original C++ version of SwissTable can be found [here], and this [CppCon talk] gives an overview of how the algorithm works. Since Rust 1.36, this is now the `HashMap` implementation for the Rust standard library. However you may still want to use this crate instead since it works in environments without `std`, such as embedded systems and kernels. [SwissTable]: https://abseil.io/blog/20180927-swisstables [here]: https://github.com/abseil/abseil-cpp/blob/master/absl/container/internal/raw_hash_set.h [CppCon talk]: https://www.youtube.com/watch?v=ncHmEUmJZf4 ## [Change log](CHANGELOG.md) ## Features - Drop-in replacement for the standard library `HashMap` and `HashSet` types. - Uses [AHash](https://github.com/tkaitchuck/aHash) as the default hasher, which is much faster than SipHash. However, AHash does *not provide the same level of HashDoS resistance* as SipHash, so if that is important to you, you might want to consider using a different hasher. - Around 2x faster than the previous standard library `HashMap`. - Lower memory usage: only 1 byte of overhead per entry instead of 8. - Compatible with `#[no_std]` (but requires a global allocator with the `alloc` crate). - Empty hash maps do not allocate any memory. - SIMD lookups to scan multiple hash entries in parallel. ## Performance Compared to the previous implementation of `std::collections::HashMap` (Rust 1.35). With the hashbrown default AHash hasher: | name | oldstdhash ns/iter | hashbrown ns/iter | diff ns/iter | diff % | speedup | |:------------------------|:-------------------:|------------------:|:------------:|---------:|---------| | insert_ahash_highbits | 18,865 | 8,020 | -10,845 | -57.49% | x 2.35 | | insert_ahash_random | 19,711 | 8,019 | -11,692 | -59.32% | x 2.46 | | insert_ahash_serial | 19,365 | 6,463 | -12,902 | -66.63% | x 3.00 | | insert_erase_ahash_highbits | 51,136 | 17,916 | -33,220 | -64.96% | x 2.85 | | insert_erase_ahash_random | 51,157 | 17,688 | -33,469 | -65.42% | x 2.89 | | insert_erase_ahash_serial | 45,479 | 14,895 | -30,584 | -67.25% | x 3.05 | | iter_ahash_highbits | 1,399 | 1,092 | -307 | -21.94% | x 1.28 | | iter_ahash_random | 1,586 | 1,059 | -527 | -33.23% | x 1.50 | | iter_ahash_serial | 3,168 | 1,079 | -2,089 | -65.94% | x 2.94 | | lookup_ahash_highbits | 32,351 | 4,792 | -27,559 | -85.19% | x 6.75 | | lookup_ahash_random | 17,419 | 4,817 | -12,602 | -72.35% | x 3.62 | | lookup_ahash_serial | 15,254 | 3,606 | -11,648 | -76.36% | x 4.23 | | lookup_fail_ahash_highbits | 21,187 | 4,369 | -16,818 | -79.38% | x 4.85 | | lookup_fail_ahash_random | 21,550 | 4,395 | -17,155 | -79.61% | x 4.90 | | lookup_fail_ahash_serial | 19,450 | 3,176 | -16,274 | -83.67% | x 6.12 | With the libstd default SipHash hasher: |name | oldstdhash ns/iter | hashbrown ns/iter | diff ns/iter | diff % | speedup | |:------------------------|:-------------------:|------------------:|:------------:|---------:|---------| |insert_std_highbits |19,216 |16,885 | -2,331 | -12.13% | x 1.14 | |insert_std_random |19,179 |17,034 | -2,145 | -11.18% | x 1.13 | |insert_std_serial |19,462 |17,493 | -1,969 | -10.12% | x 1.11 | |insert_erase_std_highbits |50,825 |35,847 | -14,978 | -29.47% | x 1.42 | |insert_erase_std_random |51,448 |35,392 | -16,056 | -31.21% | x 1.45 | |insert_erase_std_serial |87,711 |38,091 | -49,620 | -56.57% | x 2.30 | |iter_std_highbits |1,378 |1,159 | -219 | -15.89% | x 1.19 | |iter_std_random |1,395 |1,132 | -263 | -18.85% | x 1.23 | |iter_std_serial |1,704 |1,105 | -599 | -35.15% | x 1.54 | |lookup_std_highbits |17,195 |13,642 | -3,553 | -20.66% | x 1.26 | |lookup_std_random |17,181 |13,773 | -3,408 | -19.84% | x 1.25 | |lookup_std_serial |15,483 |13,651 | -1,832 | -11.83% | x 1.13 | |lookup_fail_std_highbits |20,926 |13,474 | -7,452 | -35.61% | x 1.55 | |lookup_fail_std_random |21,766 |13,505 | -8,261 | -37.95% | x 1.61 | |lookup_fail_std_serial |19,336 |13,519 | -5,817 | -30.08% | x 1.43 | ## Usage Add this to your `Cargo.toml`: ```toml [dependencies] hashbrown = "0.10" ``` Then: ```rust use hashbrown::HashMap; let mut map = HashMap::new(); map.insert(1, "one"); ``` ## Flags This crate has the following Cargo features: - `nightly`: Enables nightly-only features including: `#[may_dangle]`. - `serde`: Enables serde serialization support. - `rayon`: Enables rayon parallel iterator support. - `raw`: Enables access to the experimental and unsafe `RawTable` API. - `inline-more`: Adds inline hints to most functions, improving run-time performance at the cost of compilation time. (enabled by default) - `bumpalo`: Provides a `BumpWrapper` type which allows `bumpalo` to be used for memory allocation. - `ahash`: Compiles with ahash as default hasher. (enabled by default) - `ahash-compile-time-rng`: Activates the `compile-time-rng` feature of ahash. For targets with no random number generator this pre-generates seeds at compile time and embeds them as constants. See [aHash's documentation](https://github.com/tkaitchuck/aHash#flags) (disabled by default) ## License Licensed under either of: * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. ### Contribution Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Learn-NEAR_NCD--creature-catcher
README.md as-pect.config.js asconfig.json package.json scripts 1.init.sh 2.run.sh README.md src as-pect.d.ts as_types.d.ts sample README.md __tests__ README.md index.unit.spec.ts asconfig.json assembly index.ts models.ts tsconfig.json utils.ts
![image](https://user-images.githubusercontent.com/5507707/113234800-cf700580-9256-11eb-95e3-29923e5c0d86.png) # Sample This repository includes a complete project structure for AssemblyScript contracts targeting the NEAR platform. The example here is very basic. It's a simple contract demonstrating the following concepts: - a single contract - the difference between `view` vs. `change` methods - basic contract storage The goal of this repository is to make it as easy as possible to get started writing unit and simulation tests for AssemblyScript contracts built to work with NEAR Protocol. ## Usage ### Getting started 1. clone this repo to a local folder 2. run `yarn` 3. run `yarn test` ### Top-level `yarn` commands - run `yarn test` to run all tests - (!) be sure to run `yarn build:release` at least once before: - run `yarn test:unit` to run only unit tests - run `yarn test:simulate` to run only simulation tests - run `yarn build` to quickly verify build status - run `yarn clean` to clean up build folder ### Other documentation - Sample contract and test documentation - see `/src/sample/README` for contract interface - see `/src/sample/__tests__/README` for Sample unit testing details - Sample contract simulation tests - see `/simulation/README` for simulation testing ## The file system Please note that boilerplate project configuration files have been ommitted from the following lists for simplicity. ### Contracts and Unit Tests ```txt src ├── sample <-- sample contract │   ├── README.md │   ├── __tests__ │   │   ├── README.md │   │   └── index.unit.spec.ts │   └── assembly │   └── index.ts └── utils.ts <-- shared contract code ``` ### Helper Scripts ```txt scripts ├── 1.init.sh ├── 2.run.sh └── README.md <-- instructions ``` ## Unit tests Unit tests can be run from the top level folder using the following command: ``` yarn test:unit ``` ### Tests for Contract in `index.unit.spec.ts` ``` [Describe]: Greeting [Success]: ✔ should respond to showYouKnow() [Success]: ✔ should respond to showYouKnow2() [Success]: ✔ should respond to sayHello() [Success]: ✔ should respond to sayMyName() [Success]: ✔ should respond to saveMyName() [Success]: ✔ should respond to saveMyMessage() [Success]: ✔ should respond to getAllMessages() [File]: src/sample/__tests__/index.unit.spec.ts [Groups]: 2 pass, 2 total [Result]: ✔ PASS [Snapshot]: 0 total, 0 added, 0 removed, 0 different [Summary]: 7 pass, 0 fail, 7 total [Time]: 19.164ms ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Result]: ✔ PASS [Files]: 1 total [Groups]: 2 count, 2 pass [Tests]: 7 pass, 0 fail, 7 total [Time]: 8217.768ms ✨ Done in 8.86s. ``` ![Near, Inc. logo](https://near.org/wp-content/themes/near-19/assets/img/logo.svg?t=1553011311) ## Design ### Interface ```ts export function showYouKnow(): void; ``` - "View" function (ie. a function that does NOT alter contract state) - Takes no parameters - Returns nothing ```ts export function showYouKnow2(): bool; ``` - "View" function (ie. a function that does NOT alter contract state) - Takes no parameters - Returns true ```ts export function sayHello(): string; ``` - "View" function - Takes no parameters - Returns a string ```ts export function sayMyName(): string; ``` - "Change" function (although it does NOT alter state, it DOES read from `context`, [see docs for details](https://docs.near.org/docs/develop/contracts/as/intro)) - Takes no parameters - Returns a string ```ts export function saveMyName(): void; ``` - "Change" function (ie. a function that alters contract state) - Takes no parameters - Saves the sender account name to contract state - Returns nothing ```ts export function saveMyMessage(message: string): bool; ``` - "Change" function - Takes a single parameter message of type string - Saves the sender account name and message to contract state - Returns nothing ```ts export function getAllMessages(): Array<string>; ``` - "Change" function - Takes no parameters - Reads all recorded messages from contract state (this can become expensive!) - Returns an array of messages if any are found, otherwise empty array ## Setting up your terminal The scripts in this folder support a simple demonstration of the contract. It uses the following setup: ```txt ┌───────────────────────────────────────┬───────────────────────────────────────┐ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ A │ B │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └───────────────────────────────────────┴───────────────────────────────────────┘ ``` ### Terminal **A** *This window is used to compile, deploy and control the contract* - Environment ```sh export CONTRACT= # depends on deployment export OWNER= # any account you control # for example # export CONTRACT=dev-1615190770786-2702449 # export OWNER=sherif.testnet ``` - Commands ```sh 1.init.sh # cleanup, compile and deploy contract 2.run.sh # call methods on the deployed contract ``` ### Terminal **B** *This window is used to render the contract account storage* - Environment ```sh export CONTRACT= # depends on deployment # for example # export CONTRACT=dev-1615190770786-2702449 ``` - Commands ```sh # monitor contract storage using near-account-utils # https://github.com/near-examples/near-account-utils watch -d -n 1 yarn storage $CONTRACT ``` --- ## OS Support ### Linux - The `watch` command is supported natively on Linux - To learn more about any of these shell commands take a look at [explainshell.com](https://explainshell.com) ### MacOS - Consider `brew info visionmedia-watch` (or `brew install watch`) ### Windows - Consider this article: [What is the Windows analog of the Linux watch command?](https://superuser.com/questions/191063/what-is-the-windows-analog-of-the-linux-watch-command#191068)
Learn-NEAR-Hispano_NCD2L1--songdao
README.md assembly __tests__ as-pect.d.ts example.spec.ts classes.ts index.ts tsconfig.json
# songdao Getting Started To create a new NEAR project with default settings, you just need one command Using npm's npx: npx create-near-app [options] new-awesome-project Or, if you prefer yarn: yarn create near-app [options] new-awesome-project Without any options, this will create a project with a vanilla JavaScript frontend and an AssemblyScript smart contract Other options: --frontend=react – use React for your frontend template --contract=rust – use Rust for your smart contract Develop your own Dapp Follow the instructions in the README.md in the project you just created! 🚀 Getting Help Check out our documentation or chat with us on Discord. We'd love to hear from you! Contributing To make changes to create-near-app itself: clone the repository (Windows users, use git clone -c core.symlinks=true) in your terminal, enter one of the folders inside templates, such as templates/vanilla now you can run yarn to install dependencies and yarn dev to run the local development server, just like you can in a new app created with create-near-app about commit messages create-near-app uses semantic versioning and auto-generates nice release notes & a changelog all based off of the commits. We do this by enforcing Conventional Commits. In general the pattern mostly looks like this: type(scope?): subject #scope is optional; multiple scopes are supported (current delimiter options: "/", "\" and ",") Real world examples can look like this: chore: run tests with GitHub Actions fix(server): send cors headers feat(blog): add comment section If your change should show up in release notes as a feature, use feat:. If it should show up as a fix, use fix:. Otherwise, you probably want refactor: or chore:. More info Deploy If you want to deploy a new version, you will need two prerequisites: Get publish-access to the NPM package Get write-access to the GitHub repository Obtain a personal access token (it only needs the "repo" scope). Make sure the token is available as an environment variable called GITHUB_TOKEN Then run one script: yarn release Or just release-it
evgenykuzyakov_wonderland
README.md contract-rs wonderland Cargo.toml README.md build.sh src account.rs board.rs fungible_token.rs internal.rs lib.rs liquidity.rs types.rs frontend README.md package.json public index.html manifest.json robots.txt src App.js gh-fork-ribbon.css index.css index.js
# Wonderland A fork of berryclub designed to create a zero-sum ecosystem for custom fungible tokens. ## Definitions: - `FT` - an instance of a fungible token used for this version of the Wonderland. E.g. wUSDC, wDAI or Banana. - `L` - an inner fungible token used to track liquidity of this version of the Wonderland. - `ft_pool` - the total amount of `FT` tokens that are used to determine current drawing pricing and reward distribution - `l_pool` - the total amount of `L` tokens. ## Actions: - Draw a pixel - Add L - Remove L - Farm (passive) ### Draw a pixel The cost of drawing a pixel is determined by current `ft_pool` and a fixed coefficient `pixel_coef` (e.g. `1 / 10000`) `pixel_price = ft_pool * pixel_coef` When drawing multiple pixels in one transaction it's should be possible to correctly compute the total price. `draw_fee_coef` is used to determine which part of the pixel price goes to liquidity providers as a reward (e.g. `1 / 10`) - `your_ft -= pixel_price` - withdrawing `FT` amount from your account. - `lp_reward = draw_fee_coef * pixel_price` will be split proportionally to `L` owners at `your_l / l_pool` - `ft_pool += pixel_price - lp_reward` increasing `FT` pool ### Add L Anyone can buy `L` tokens at current `l_price`, but some amount of the newly minted `L` will be held by the app to disincentive the liquidity providers from frequently add and remove liquidity. `l_price = ft_pool / l_pool` The amount you get depends on `farm_hold_coefficient` (e.g. `1 / 10`) The amount of `FT` you want to spend. - `your_ft -= ft_amount` - `l_amount = ft_amount / l_price` - total amount of `L` being minted - `app_l_amount = l_amount * farm_hold_coefficient` - the amount of `L` that will be forever held by the app to incentivize farmers. - `your_l_amount = l_amount - app_l_amount` - the amount of `L` you get. - `ft_pool += ft_amount` - increasing `FT` pool - `l_pool += l_amount` - increasing `L` pool - `your_l += your_l_amount` - increasing your `L` total amount - `app_l += app_l_amount` - increasing app's `L` total amount ### Remove L Any liquidity provider (except for the App) can remove the liquidity by burning `L` tokens and getting corresponding amount of `FT` tokens based on the current `l_price`. There is no fee to remove `L` - `l_amount` - the amount of `L` tokens to remove/burn - `your_l -= l_amount` - remove `L` tokens from your balance - `ft_amount = l_amount * l_price` - the amount `FT` you get for removing liquidity - `your_ft += ft_amount` - increase your `FT` balance - `ft_pool -= ft_amount` - decrease amount of `FT` in the pool - `l_pool -= l_amount` - decrease amount of `L` in the pool ### Farm Every second a pixel on board is earning `FT` tokens to the pixel owner based on current `ft_pool`. - `ft_amount_per_pixel = (magic formula based on time) * ft_pool` - `ft_pool -= ft_amount_per_pixel * num_active_pixels` - `ft_farmed_per_pixel += ft_amount_per_pixel` - increased based on time passed from last update Every account tracks: - `last_ft_farmed_per_pixel` - the previous `ft_farmed_per_pixel` value - `num_pixels` - the number of pixels the account owns on the board Touching account - `diff_ft_farmed_per_pixel = ft_farmed_per_pixel - last_ft_farmed_per_pixel` - the difference from the last time account was touched - `farmed_ft_amount = diff_ft_farmed_per_pixel * num_pixels` - the accumulated farmed amount from last time - `last_ft_farmed_per_pixel = ft_farmed_per_pixel` - remembering the current value - `acc_ft += farmed_ft_amount` - adding farmed balance to the account balance ## App fee The app owner will not be able to withdraw app liquidity, so the farmers can be certain that the `FT` pool can't be fully drained. But the app owner will be able to claim draw fees earned by the app liquidity. # NEAR Place Smart contract to keep track of the board. ## Building ```bash ./build.sh ``` ## Testing To test run: ```bash cargo test --package near-place -- --nocapture ``` This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `yarn start` Runs the app in the development mode.<br /> Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.<br /> You will also see any lint errors in the console. ### `yarn test` Launches the test runner in the interactive watch mode.<br /> See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `yarn build` Builds the app for production to the `build` folder.<br /> It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.<br /> Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `yarn eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting ### Analyzing the Bundle Size This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size ### Making a Progressive Web App This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app ### Advanced Configuration This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration ### Deployment This section has moved here: https://facebook.github.io/create-react-app/docs/deployment ### `yarn build` fails to minify This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
joe-rlo_90s-Name-Generator-Web4Hackathon
Cargo.toml README.md res index.html src lib.rs utils.rs web4.rs
90s Wallet Name Generator ========================== A totally rad site that let's you generate a killer name. You can then check if it already exists before trying creating it or whatever. Just don't have a cow if its already taken. Party on dawg! Uses: * [Web4](https://web4.near.page) is a gateway to the smart contracts deployed to NEAR protocol. * NEAR API JS * JQuery CLI (just to add some fun in the experience)
kcole16_sputnik-dao-2-ui-mainnet
README.md babel.config.js package.json src Navbar.js __mocks__ fileMock.js assets logo-black.svg logo-white.svg config.js global.css index.html index.js jest.init.js main.test.js utils.js utils Loading.js funcs.js store.js wallet login index.html
sputnik-dao-ui ================== coming soon....
JoseGabriel-web_NearBook
README.md contract as-pect.config.js asconfig.json assembly __tests__ as-pect.d.ts main.spec.ts as_types.d.ts index.ts models Comment.ts Post.ts tsconfig.json package-lock.json package.json scripts build.sh clean.sh dev-deploy.sh frontend README.md package.json public index.html manifest.json robots.txt src App.js assets CommentIcon.js Liked.js Trash.js Unliked.js components Comment.js CreatePost.js Feed.js Home.js Loader.js Logo.js Post.js Profile.js SignIn.js SignOut.js contract.js contractInfo.json index.js near.js styles App.css button.css comment.css createPost.css feed.css home.css loader.css post.css profile.css utils.js package.json
# NearBook La idea de nuestro proyecto es el de conectar a la comunidad Near en su propio social media, nuestro contrato permite crear articulos, darle like, quitar el like, conseguir los articulos creados, eliminar articulos creados estas son algunas de las funcionalidades, si tuvieramos mas tiempo agregariamos poder comentar que es posible que sea añadido para la presentacion.. Este smart contract permite: - Crear/Eliminar un post. - Dar/Quitar likes. - Crear/Eliminar comments. # :gear: Instalación Para la instalación local de este projecto: ## Pre - requisitos - Asegúrese de haber instalado Node.js ≥ 12 (recomendamos usar nvm). - Asegúrese de haber instalado yarn: npm install -g yarn. - Instalar dependencias: yarn install. - Crear un test near account NEAR test account. - Instalar el NEAR CLI globally: near-cli es una interfaz de linea de comando (CLI) para interacturar con NEAR blockchain. # :key: Configurar NEAR CLI Configura tu near-cli para autorizar tu cuenta de prueba creada recientemente: ```html near login ``` # :page_facing_up: Clonar el repositorio ```html git clone https://github.com/JoseGabriel-web/NearBook.git ``` ```html cd NearBook ``` # :hammer_and_wrench: Build del proyecto y despliegue en development mode. Instalar las dependencias necesarias con npm. ```html npm install ``` Hacer el build y deployment en development mode. ```html yarn start:app ``` # Comandos: ## Comando para crear un Post: ```html near call $CONTRATO createPost '{"title": "string", "description": "string"}' --account-id <id>.testnet ``` ## Comando para crear un Comentario: ```html near call $CONTRATO createComment '{"label": "string", "postID": "string"}' --account-id <id>.testnet ``` ## Comando para conseguir lista de Posts: ```html near view $CONTRATO listPosts ``` ## Comando para conseguir lista de Post creados: ```html near call $CONTRATO getMyPosts --account-id <id>.testnet ``` ## Comando para eliminar un comentario: ```html near call $CONTRATO removeComment '{"postID": "string", "commentID": "string"}' --account-id <id>.testnet ``` ## Comando para quitar/dar like a un post: ```html near call $CONTRATO handlePostLike '{"postID": "string"}' --account-id <id>.testnet ``` ## Comando para eliminar un Post: ```html near call $CONTRATO removePost '{"postID": "string"}' --account-id <id>.testnet ``` # Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `yarn start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.\ You will also see any lint errors in the console. ### `yarn test` Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `yarn build` Builds the app for production to the `build` folder.\ It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.\ Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `yarn eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) ### Analyzing the Bundle Size This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) ### Making a Progressive Web App This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) ### Advanced Configuration This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) ### Deployment This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) ### `yarn build` fails to minify This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
k1ryl_dacade-near-marketplace-contract
README.md asconfig.json assembly as_types.d.ts index.ts model.ts tsconfig.json package.json
https://dacade.org/communities/near/courses/near-101/learning-modules/b52ba9f1-caac-4339-96ed-fad3b1ab6bbd
Loozr-Protocol_milestones
README.md
# Milestone Completion This is a straightforward explanation of how to use the Loozr platform based on the NF agreed milestones. #### Briefing: The platform that sets musicians loosed to INDEPENDENTLY establish their own economy in seconds by leveraging NEAR Protocol's cutting-edge Blockchain technology - Loozr is the user friendly toolkit. Here are a few resources for learning more about the Loozr project; a token-based music streaming platform that allows everyone to invest in and profit from the success of artists per second. - Website: https://loozr.io - LiteDoc: https://loozr-1.gitbook.io - Pitchdeck: https://drive.google.com/file/d/1xqMEJlfraHRkSU5zFslI-aNflWn1680V/view - Twitter: https://twitter.com/officialloozr With our no-code automated smart contract launchpad and user friendly interface, Loozr empowers users to Trade2Earn, Listen2Earn, Hodl2Earn and Budl2Earn. #### Loozr actualizes these dreams through her 5 Flagship Products: 1. Music token launchpad: Artists launch tradable profiles and song tokens, fans Invest2Earn, and trade. 2. Streaming: Streaming revenue split among token holders (artists and fans). 3. Music NFT marketplace: Interoperability for Music NFTs 4. SocialFi ($MOMENT): Similar to TikTok, artists and fans can share video moments of LIVE events, recording sessions, tours, skits, covers, EPs, etc… and every $MOMENT can be bought and sold on Loozr as digital assets. 5. LOOZRverse: First-ever immersive location-based music AR/VR Metaverse. Watch the LOOZRverse demo https://www.youtube.com/watch?v=mO5-Nx-EENc&t=23s 🔸 The LZR coin is the platform's native currency that powers the entire ecosystem. Which can be used to purchase launched tokens ($ARTIST & $MUSIC), liquidate those tokens, stream music, hodl and trade on the Loozr platform. Loozr is the first social music streaming platform built on the blockchain where fans, artists and other music stakeholders succeed in a manner that isn’t detrimental to one another. ### `Quick links below` Run dApp in the Beta mode: - KYC & Contract: "lzr.testnet" - Account on NEAR Explorer https://explorer.testnet.near.org/accounts/lzr.testnet - Login [https://loozr-official-homepage2.vercel.app/login](https://loozr-official-homepage2.vercel.app/login) to view it in your browser. - Create New Account [https://loozr-official-homepage2.vercel.app/signup](https://loozr-official-homepage2.vercel.app/signup) - No knowledge of crypto necessary. Upon signup, a unique NEAR subdomain account for LZR is created (e.g username.lzr.testnet). - Launch your artist token # Milestone 1. #### Requirement 1: - Launch of the web Beta version, which will allow Artistes to tokenize their profile and brand directly on the Near blockchain for trading on Loozr. R&D #### Requirement 2: - Expanding our Loozr Artiste Ecosystem, which includes onboarding 1000-2000 musicians, labels, and music distribution houses, as well as prepping them for the Beta. # Evidence for Requirement 1: 1. After signup, to tokenize your profile as an artist on the Loozr platform, complete your profile to verify your account (On the Testnet, artist verification is automatic. The Loozr community will accept artist submissions and approve them for verification - LoozrDAO). Direct link here https://loozr-official-homepage2.vercel.app/profile/edit \ Feel free to always track your profile activity, transaction, history on any NEAR Web3 Explorer. The username "howfa.lzr.testnet" for example, can be located https://explorer.testnet.near.org/accounts/howfa.lzr.testnet <img width="753" alt="Screenshot 2022-10-03 at 1 49 57 PM" src="https://user-images.githubusercontent.com/24845329/193580985-a5dc8740-5d04-4004-a234-2b1a6f6877d7.png"> 2. Click on "Become an artist" button on the Loozr dApp dashboard https://loozr-official-homepage2.vercel.app/explore <img width="858" alt="Screenshot 2022-10-03 at 11 09 24 AM" src="https://user-images.githubusercontent.com/24845329/193579629-64713b42-f8c9-43f5-bc84-0ecdb944bdf6.png"> 3. Reserve your Artist Token Name (e.g $ADARSH), and set the percentage you'd wish to reward holders of your token https://loozr-official-homepage2.vercel.app/artist-account-setup \ A 100% Founders Reward means you get to keep 100% of your token earnings. Feel free to confirm your created account ID on any NEAR Explorer (for instance the account ID generated on the image below "howfa.cct2.testnet"). <img width="1343" alt="Screenshot 2022-10-03 at 2 02 26 PM" src="https://user-images.githubusercontent.com/24845329/193583141-d27763a3-819e-47a0-b2e9-b435a5158d68.png"> \ Your profile token has been created as an artist and users/fans can start buying/selling and trading your profile token on the Loozr platform. <img width="840" alt="Screenshot 2022-10-03 at 2 30 13 PM" src="https://user-images.githubusercontent.com/24845329/193590011-cd4c05ad-d8b0-4b31-b02a-893aaa7aa308.png"> Once your token dashboard has been properly launched and you have generated some token sales as an artist, your profile will now appear as shown. #### `Trading Artist Tokens` * ### Buying Artist Token a. Click on the artist coin you want to invest in <img width="769" alt="Screenshot 2022-10-03 at 2 35 26 PM" src="https://user-images.githubusercontent.com/24845329/193591137-96cb3474-b85d-4bbf-844c-a5243a8792c0.png"> b. Click on to "Buy artist coin" on artist profile <img width="800" alt="Screenshot 2022-10-03 at 2 38 36 PM" src="https://user-images.githubusercontent.com/24845329/193591703-26e49289-89f4-454d-880c-c061f34d7a7d.png"> c. Once you've exchanged your NEAR/USD for LZR, you can use it to buy your favorite artist's coin. Simply enter the amount of LZR to invest in an artist, buy and hold. <img width="798" alt="Screenshot 2022-10-03 at 2 40 22 PM" src="https://user-images.githubusercontent.com/24845329/193592018-8ed25f9e-8eef-4454-b1ad-e34e44f2ec20.png"> * ### Selling Artist Token a. Click on the artist coin you wish to sell for LZR "Sell artist coin" (that you hold). <img width="800" alt="Screenshot 2022-10-03 at 2 38 36 PM" src="https://user-images.githubusercontent.com/24845329/193596211-a0b00cc0-7868-44e9-b955-08eeff1fabe5.png"> b. Enter the amount of artist coin you wish to exchange for LZR. <img width="751" alt="Screenshot 2022-10-03 at 3 03 19 PM" src="https://user-images.githubusercontent.com/24845329/193597415-3720fffd-5aa5-41bd-89a1-ff292b63bb37.png"> <img width="729" alt="Screenshot 2022-10-03 at 3 12 11 PM" src="https://user-images.githubusercontent.com/24845329/193599221-140aa2a2-4f99-40ef-be37-e14be71226bd.png"> # Evidence for Requirement 2: Artists and labels currently on the Loozr ecosystem here https://docs.google.com/document/d/1XvJZ4snTMBDVfsFzywoHk65VEDXALDFp8WNmeI971PU/edit?usp=sharing
Learn-NEAR-Hispano_NCD4L1--block-transfer
README.md babel.config.js contract README.md as-pect.config.js asconfig.json assembly __tests__ as-pect.d.ts as_types.d.ts index.ts tsconfig.json compile.js package-lock.json package.json package.json src App.js Components Metadata.js SendTokens.js __mocks__ fileMock.js assets logo-black.svg logo-white.svg config.js global.css index.html index.js jest.init.js main.test.js utils.js wallet login index.html
rollingrps Smart Contract ================== A [smart contract] written in [AssemblyScript] for an app initialized with [create-near-app] Quick Start =========== Before you compile this code, you will need to install [Node.js] ≥ 12 Exploring The Code ================== 1. The main smart contract code lives in `assembly/index.ts`. You can compile it with the `./compile` script. 2. Tests: You can run smart contract tests with the `./test` script. This runs standard AssemblyScript tests using [as-pect]. [smart contract]: https://docs.near.org/docs/develop/contracts/overview [AssemblyScript]: https://www.assemblyscript.org/ [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [as-pect]: https://www.npmjs.com/package/@as-pect/cli # Block-transfer Transfer Aplication Running on Near Testnet Sign in with NEAR and send NEAR Quick Start =========== To run this project locally: 1. Prerequisites: Make sure you have Node.js ≥ 12 installed (https://nodejs.org), then use it to install [yarn]: `npm install --global yarn` (or just `npm i -g yarn`) 2. Run the local development server: `yarn && yarn dev` (see `package.json` for a full list of `scripts` you can run with `yarn`) Now you'll have a local development environment backed by the NEAR TestNet! Running `yarn dev` will tell you the URL you can visit in your browser to see the app. Exploring The Code ================== 1. The backend code lives in the `/assembly` folder. This code gets deployed to the NEAR blockchain when you run `yarn deploy:contract`. This sort of code-that-runs-on-a-blockchain is called a "smart contract" – [learn more about NEAR smart contracts][smart contract docs]. 2. The frontend code lives in the `/src` folder. [/src/index.html](/src/index.html) is a great place to start exploring. Note that it loads in `/src/index.js`, where you can learn how the frontend connects to the NEAR blockchain. 3. Tests: there are different kinds of tests for the frontend and backend. The backend code gets tested with the [asp] command for running the backend AssemblyScript tests, and [jest] for running frontend tests. You can run both of these at once with `yarn test`. Both contract and client-side code will auto-reload as you change source files. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `yarn dev`, your smart contracts get deployed to the live NEAR TestNet with a throwaway account. When you're ready to make it permanent, here's how. Step 0: Install near-cli -------------------------- You need near-cli installed globally. Here's how: npm install --global near-cli This will give you the `near` [CLI] tool. Ensure that it's installed with: near --version Step 1: Create an account for the contract ------------------------------------------ Visit [NEAR Wallet] and make a new account. You'll be deploying these smart contracts to this new account. Now authorize NEAR CLI for this new account, and follow the instructions it gives you: near login Step 2: set contract name in code --------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'your-account-here!' Step 3: change remote URL if you cloned this repo ------------------------- Unless you forked this repository you will need to change the remote URL to a repo that you have commit access to. This will allow auto deployment to Github Pages from the command line. 1) go to GitHub and create a new repository for this project 2) open your terminal and in the root of this project enter the following: $ `git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.git` Step 4: deploy! --------------- One command: yarn deploy As you can see in `package.json`, this does two things: 1. builds & deploys smart contracts to NEAR TestNet 2. builds & deploys frontend code to GitHub using [gh-pages]. This will only work if the project already has a repository set up on GitHub. Feel free to modify the `deploy` script in `package.json` to deploy elsewhere. [NEAR]: https://nearprotocol.com/ [yarn]: https://yarnpkg.com/ [AssemblyScript]: https://docs.assemblyscript.org/ [React]: https://reactjs.org [smart contract docs]: https://docs.nearprotocol.com/docs/roles/developer/contracts/assemblyscript [asp]: https://www.npmjs.com/package/@as-pect/cli [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.nearprotocol.com/docs/concepts/account [NEAR Wallet]: https://wallet.nearprotocol.com [near-cli]: https://github.com/nearprotocol/near-cli [CLI]: https://www.w3schools.com/whatis/whatis_cli.asp [create-near-app]: https://github.com/nearprotocol/create-near-app [gh-pages]: https://github.com/tschaub/gh-pages
KazanderDad_DonationSplitter
README.md rust .cargo config.toml lib.rs
# PaymentSplitter
loayei_Near-Patika-dev
README.md as-pect.config.js asconfig.json package.json scripts 1.dev-deploy.sh 2.use-contract.sh 3.cleanup.sh README.md src as_types.d.ts simple __tests__ as-pect.d.ts index.unit.spec.ts asconfig.json assembly index.ts singleton __tests__ as-pect.d.ts index.unit.spec.ts asconfig.json assembly index.ts tsconfig.json utils.ts
## Setting up your terminal The scripts in this folder are designed to help you demonstrate the behavior of the contract(s) in this project. It uses the following setup: ```sh # set your terminal up to have 2 windows, A and B like this: ┌─────────────────────────────────┬─────────────────────────────────┐ │ │ │ │ │ │ │ A │ B │ │ │ │ │ │ │ └─────────────────────────────────┴─────────────────────────────────┘ ``` ### Terminal **A** *This window is used to compile, deploy and control the contract* - Environment ```sh export CONTRACT= # depends on deployment export OWNER= # any account you control # for example # export CONTRACT=dev-1615190770786-2702449 # export OWNER=sherif.testnet ``` - Commands _helper scripts_ ```sh 1.dev-deploy.sh # helper: build and deploy contracts 2.use-contract.sh # helper: call methods on ContractPromise 3.cleanup.sh # helper: delete build and deploy artifacts ``` ### Terminal **B** *This window is used to render the contract account storage* - Environment ```sh export CONTRACT= # depends on deployment # for example # export CONTRACT=dev-1615190770786-2702449 ``` - Commands ```sh # monitor contract storage using near-account-utils # https://github.com/near-examples/near-account-utils watch -d -n 1 yarn storage $CONTRACT ``` --- ## OS Support ### Linux - The `watch` command is supported natively on Linux - To learn more about any of these shell commands take a look at [explainshell.com](https://explainshell.com) ### MacOS - Consider `brew info visionmedia-watch` (or `brew install watch`) ### Windows - Consider this article: [What is the Windows analog of the Linux watch command?](https://superuser.com/questions/191063/what-is-the-windows-analog-of-the-linuo-watch-command#191068) # `near-sdk-as` Starter Kit This is a good project to use as a starting point for your AssemblyScript project. ## Samples This repository includes a complete project structure for AssemblyScript contracts targeting the NEAR platform. The example here is very basic. It's a simple contract demonstrating the following concepts: - a single contract - the difference between `view` vs. `change` methods - basic contract storage There are 2 AssemblyScript contracts in this project, each in their own folder: - **simple** in the `src/simple` folder - **singleton** in the `src/singleton` folder ### Simple We say that an AssemblyScript contract is written in the "simple style" when the `index.ts` file (the contract entry point) includes a series of exported functions. In this case, all exported functions become public contract methods. ```ts // return the string 'hello world' export function helloWorld(): string {} // read the given key from account (contract) storage export function read(key: string): string {} // write the given value at the given key to account (contract) storage export function write(key: string, value: string): string {} // private helper method used by read() and write() above private storageReport(): string {} ``` ### Singleton We say that an AssemblyScript contract is written in the "singleton style" when the `index.ts` file (the contract entry point) has a single exported class (the name of the class doesn't matter) that is decorated with `@nearBindgen`. In this case, all methods on the class become public contract methods unless marked `private`. Also, all instance variables are stored as a serialized instance of the class under a special storage key named `STATE`. AssemblyScript uses JSON for storage serialization (as opposed to Rust contracts which use a custom binary serialization format called borsh). ```ts @nearBindgen export class Contract { // return the string 'hello world' helloWorld(): string {} // read the given key from account (contract) storage read(key: string): string {} // write the given value at the given key to account (contract) storage @mutateState() write(key: string, value: string): string {} // private helper method used by read() and write() above private storageReport(): string {} } ``` ## Usage ### Getting started (see below for video recordings of each of the following steps) INSTALL `NEAR CLI` first like this: `npm i -g near-cli` 1. clone this repo to a local folder 2. run `yarn` 3. run `./scripts/1.dev-deploy.sh` 3. run `./scripts/2.use-contract.sh` 4. run `./scripts/2.use-contract.sh` (yes, run it to see changes) 5. run `./scripts/3.cleanup.sh` ### Videos **`1.dev-deploy.sh`** This video shows the build and deployment of the contract. [![asciicast](https://asciinema.org/a/409575.svg)](https://asciinema.org/a/409575) **`2.use-contract.sh`** This video shows contract methods being called. You should run the script twice to see the effect it has on contract state. [![asciicast](https://asciinema.org/a/409577.svg)](https://asciinema.org/a/409577) **`3.cleanup.sh`** This video shows the cleanup script running. Make sure you add the `BENEFICIARY` environment variable. The script will remind you if you forget. ```sh export BENEFICIARY=<your-account-here> # this account receives contract account balance ``` [![asciicast](https://asciinema.org/a/409580.svg)](https://asciinema.org/a/409580) ### Other documentation - See `./scripts/README.md` for documentation about the scripts - Watch this video where Willem Wyndham walks us through refactoring a simple example of a NEAR smart contract written in AssemblyScript https://youtu.be/QP7aveSqRPo ``` There are 2 "styles" of implementing AssemblyScript NEAR contracts: - the contract interface can either be a collection of exported functions - or the contract interface can be the methods of a an exported class We call the second style "Singleton" because there is only one instance of the class which is serialized to the blockchain storage. Rust contracts written for NEAR do this by default with the contract struct. 0:00 noise (to cut) 0:10 Welcome 0:59 Create project starting with "npm init" 2:20 Customize the project for AssemblyScript development 9:25 Import the Counter example and get unit tests passing 18:30 Adapt the Counter example to a Singleton style contract 21:49 Refactoring unit tests to access the new methods 24:45 Review and summary ``` ## The file system ```sh ├── README.md # this file ├── as-pect.config.js # configuration for as-pect (AssemblyScript unit testing) ├── asconfig.json # configuration for AssemblyScript compiler (supports multiple contracts) ├── package.json # NodeJS project manifest ├── scripts │   ├── 1.dev-deploy.sh # helper: build and deploy contracts │   ├── 2.use-contract.sh # helper: call methods on ContractPromise │   ├── 3.cleanup.sh # helper: delete build and deploy artifacts │   └── README.md # documentation for helper scripts ├── src │   ├── as_types.d.ts # AssemblyScript headers for type hints │   ├── simple # Contract 1: "Simple example" │   │   ├── __tests__ │   │   │   ├── as-pect.d.ts # as-pect unit testing headers for type hints │   │   │   └── index.unit.spec.ts # unit tests for contract 1 │   │   ├── asconfig.json # configuration for AssemblyScript compiler (one per contract) │   │   └── assembly │   │   └── index.ts # contract code for contract 1 │   ├── singleton # Contract 2: "Singleton-style example" │   │   ├── __tests__ │   │   │   ├── as-pect.d.ts # as-pect unit testing headers for type hints │   │   │   └── index.unit.spec.ts # unit tests for contract 2 │   │   ├── asconfig.json # configuration for AssemblyScript compiler (one per contract) │   │   └── assembly │   │   └── index.ts # contract code for contract 2 │   ├── tsconfig.json # Typescript configuration │   └── utils.ts # common contract utility functions └── yarn.lock # project manifest version lock ``` You may clone this repo to get started OR create everything from scratch. Please note that, in order to create the AssemblyScript and tests folder structure, you may use the command `asp --init` which will create the following folders and files: ``` ./assembly/ ./assembly/tests/ ./assembly/tests/example.spec.ts ./assembly/tests/as-pect.d.ts ```
KenMan79_NEAR-Pet-Shop-Template
README.md migrations 1_initial_migration.js 2_deploy_adoption.js package-lock.json package.json src css bootstrap.min.css custom.css fonts glyphicons-halflings-regular.svg index.html js app.js bootstrap.min.js pets.json test testAdoption.test.js truffle-box.json truffle-config.js
# NEAR Pet Shop This project is based on Truffle's [Pet Shop Tutorial](https://www.trufflesuite.com/tutorials/pet-shop) but uses NEAR's custom provider called [near-web3-provider](https://github.com/nearprotocol/near-web3-provider) and deploys the Solidity contracts to the [NEAR EVM](https://github.com/near/near-evm). You may read more about the NEAR EVM in the link above. In brief, it's an implementation of the Ethereum Virtual Machine (EVM) incorporated into NEAR. This means developers may preserve existing investment by compiling existing Ethereum contracts and deploying them to the NEAR blockchain as well. This is made possible by two NEAR libraries: 1. [near-api-js](https://www.npmjs.com/package/near-api-js): the JavaScript library used to abstract JSON RPC calls. 2. [near-web3-provider](https://www.npmjs.com/package/near-web3-provider): the web3 provider for NEAR containing utilities and Ethereum routes (ex. `eth_call`, `eth_getBlockByHash`, etc.) This project uses Truffle for testing and migrating. Migrating, in this sense, also means deploying to an environment. Please see `truffle-config.js` for network connection details. ## Install mkdir near-pet-shop cd near-pet-shop npx truffle unbox near-examples/near-pet-shop ## Get NEAR Betanet account If you don't have a NEAR Betanet account, please create one using the Wallet interface at: https://wallet.betanet.near.org ## Betanet migration **Note**: for instructions on migrating to a local NEAR environment, please read [these instructions](https://docs.near.org/docs/evm/evm-local-setup). Replace `YOUR_NAME` in the command below and run it: env NEAR_MASTER_ACCOUNT=YOUR_NAME.betanet npx truffle migrate --network near_betanet ## Run the web app npm run betanet On this site you'll see a grid of pets to adopt with corresponding **Adopt** buttons. The first time you run this app, the **Adopt** buttons will be disabled until you've logged in. Click on the **Login** button in the upper-right corner of the screen. You will be redirected to the NEAR Betanet Wallet and asked to confirm creating a function-call access key, which you'll want to allow. After allowing, you're redirected back to Pet Shop, and a special key exists in your browser's local storage. Now you can adopt a pet! Once you've clicked the **Adopt** button pay attention to the top of the page, as a link to NEAR Explorer will appear. (This is similar to [etherscan](https://etherscan.io/) for Ethereum.) ## Testing Run a local `nearcore` node following [these instructions](https://docs.near.org/docs/evm/evm-local-setup#set-up-near-node). Then run: npm run test ### Troubleshooting During development while changing the Solidity code, if unexpected behavior continues, consider removing the `build` folder and migrating again.
htafolla_initial-contracts
README.md lockup Cargo.toml README.md build.sh src lib.rs staking-pool Cargo.toml README.md build.sh src lib.rs test_utils.rs test.sh tests general.rs quickcheck.rs utils.rs
# Initial contracts *In the process of refactoring to add more contracts here* - [Staking Pool / Delegation contract](./staking-pool/) - [[WIP] Lockup / Vesting contract](./lockup/) # Staking / Delegation contract This contract provides a way for other users to delegate funds to a single validation node. Implements the https://github.com/nearprotocol/NEPs/pull/27 standard. There are three different roles: - The staking pool contract account `my_validator`. A key-less account with the contract that pools funds. - The owner of the staking contract `owner`. Owner runs the validator node on behalf of the staking pool account. - Delegator accounts `user1`, `user2`, etc. Accounts that want to stake their funds with the pool. The owner can setup such contract and validate on behalf of this contract in their node. Any other user can send their tokens to the contract, which will be pooled together and increase the total stake. These users accrue rewards (subtracted fees set by the owner). Then they can unstake and withdraw their balance after some unlocking period. ## Staking pool implementation details For secure operation of the staking pool, the contract should not have any access keys. Otherwise the contract account may issue a transaction that can violate the contract guarantees. After users deposit tokens to the contract, they can stake some or all of them to receive "stake" shares. The price of a "stake" share can be defined as the total amount of staked tokens divided by the the total amount of "stake" shares. The number of "stake" shares is always less than the number of the staked tokens, so the price of single "stake" share is not less than `1`. ### Initialization A contract has to be initialized with the following parameters: - `owner_id` - `string` the account ID of the contract owner. This account will be able to call owner-only methods. E.g. `owner` - `stake_public_key` - `string` the initial public key that will be used for staking on behalf of the contract's account in base58 ED25519 curve. E.g. `KuTCtARNzxZQ3YvXDeLjx83FDqxv2SdQTSbiq876zR7` - `reward_fee_fraction` - `json serialized object` the initial value of the fraction of the reward that the owner charges delegators for running the node. The fraction is defined by the numerator and denumerator with `u32` types. E.g. `{numerator: 10, denominator: 100}` defines `10%` reward fee. The fraction can be at most `1`. The denumerator can't be `0`. During the initialization the contract checks validity of the input and initializes the contract. The contract shouldn't have locked balance during the initialization. At the initialization the contract allocates one trillion yocto NEAR tokens towards "stake" share price guarantees. This fund is later used to adjust the the amount of staked and unstaked tokens due to rounding error. For each stake and unstake action, the contract may spend at most 1 yocto NEAR from this fund (implicitly). The current total balance (except for the "stake" share price guarantee amount) is converted to shares and will be staked (after the next action). This balance can never be unstaked or withdrawn from the contract. It's used to maintain the minimum number of shares, as well as help pay for the potentially growing contract storage. ### Delegator accounts The contract maintains account information per delegator associated with the hash of the delegator's account ID. The information contains: - Unstaked balance of the account. - Number of "stake" shares. - The minimum epoch height when the unstaked balance can be withdrawn. Initially zero. A delegator can do the following actions: #### Deposit When a delegator account first deposits funds to the contract, the internal account is created and credited with the attached amount of unstaked tokens. #### Stake When an account wants to stake a given amount, the contract calculates the number of "stake" shares (`num_shares`) and the actual rounded stake amount (`amount`). The unstaked balance of the account is decreased by `amount`, the number of "stake" shares of the account is increased by `num_shares`. The contract increases the total number of staked tokens and the total number of "stake" shares. Then the contract restakes. #### Unstake When an account wants to unstake a given amount, the contract calculates the number of "stake" shares needed (`num_shares`) and the actual required rounded unstake amount (`amount`). It's calculated based on the current total price of "stake" shares. The unstaked balance of the account is increased by `amount`, the number of "stake" shares of the account is decreased by `num_shares`. The minimum epoch height when the account can withdraw is set to the current epoch height increased by `4`. The contract decreases the total number of staked tokens and the total number of "stake" shares. Then the contract restakes. #### Withdraw When an account wants to withdraw, the contract checks the minimum epoch height of this account and checks the amount. Then sends the transfer and decreases the unstaked balance of the account. #### Ping Calls the internal function to distribute rewards if the blockchain epoch switched. The contract will restake in this case. ### Reward distribution Before every action the contract calls method `internal_ping`. This method distributes rewards towards active delegators when the blockchain epoch switches. The rewards might be given due to staking and also because the contract earns gas fee rebates for every function call. The method first checks that the current epoch is different from the last epoch, and if it's not changed exits the method. The reward are computed the following way. The contract keeps track of the last known total account balance. This balance consist of the initial contract balance, and all delegator account balances (including the owner) and all accumulated rewards. (Validation rewards are added automatically at the beginning of the epoch, while contract execution gas rebates are added after each transaction) When the method is called the contract uses the current total account balance (without attached deposit) and the subtracts the last total account balance. The difference is the total reward that has to be distributed. The fraction of the reward is awarded to the contract owner. The fraction is configurable by the owner, but can't exceed 1. The remaining part of the reward is added to the total staked balance. This action increases the price of each "stake" share without changing the amount of "stake" shares owned by different accounts. Which is effectively distributing the reward based on the number of shares. The owner's reward is converted into "stake" shares at the new price and added to the owner's account. It's done similarly to `stake` method but without debiting the unstaked balance of owner's account. Once the rewards are distributed the contract remembers the new total balance. ## Owner-only methods Contract owner can do the following: - Change public staking key. This action restakes with the new key. - Change reward fee fraction. - Vote on behalf of the pool. This is needed for the NEAR chain governence, and can be discussed in the following NEP: https://github.com/nearprotocol/NEPs/pull/62 ## Staking pool contract guarantees and invariants This staking pool implementation guarantees the required properties of the staking pool standard: - The contract can't lose or lock tokens of users. - If a user deposited X, the user should be able to withdraw at least X. - If a user successfully staked X, the user can unstake at least X. - The contract should not lock unstaked funds for longer than 4 epochs after unstake action. It also has inner invariants: - The staking pool contract is secure if it doesn't have any access keys. - The price of a "stake" is always at least `1`. - The price of a "stake" share never decreases. - The reward fee is a fraction be from `0` to `1` inclusive. - The owner can't withdraw funds from other delegators. - The owner can't delete the staking pool account. ## Pre-requisites To develop Rust contracts you would need to: * Install [Rustup](https://rustup.rs/): ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` * Add wasm target to your toolchain: ```bash rustup target add wasm32-unknown-unknown ``` ## Building the contract ```bash ./build.sh ``` ## Usage Commands to deploy and initialize a staking contract: ```bash near create_account my_validator --masterAccount=owner near deploy --accountId=my_validator --wasmFile=res/staking_pool.wasm # Initialize staking pool at account `my_validator` for the owner account ID `owner`, given staking pool and 10% reward fee. near call my_validator new '{"owner_id": "owner", "stake_public_key": "CE3QAXyVLeScmY9YeEyR3Tw9yXfjBPzFLzroTranYtVb", "reward_fee_fraction": {"numerator": 10, "denominator": 100}}' --account_id owner # TODO: Delete all access keys from the `my_validator` account ``` As a user, to delegate money: ```bash near call my_validator deposit '{}' --accountId user1 --amount 100 near call my_validator stake '{"amount": "100000000000000000000000000"}' --accountId user1 ``` To update current rewards: ```bash near call my_validator ping '{}' --accountId user1 ``` View methods: ```bash # User1 total balance near view my_validator get_account_total_balance '{"account_id": "user1"}' # User1 staked balance near view my_validator get_account_staked_balance '{"account_id": "user1"}' # User1 unstaked balance near view my_validator get_account_unstaked_balance '{"account_id": "user1"}' # Whether user1 can withdraw now near view my_validator is_account_unstaked_balance_available '{"account_id": "user1"}' # Total staked balance of the entire pool near view my_validator get_total_staked_balance '{}' # Owner of the staking pool near view my_validator get_owner_id '{}' # Current reward fee near view my_validator get_reward_fee_fraction '{}' # Owners balance near view my_validator get_account_total_balance '{"account_id": "owner"}' ``` To un-delegate, first run `unstake`: ```bash near call my_validator unstake '{"amount": "100000000000000000000000000"}' --accountId user1 ``` And after 3 epochs, run `withdraw`: ```bash near call my_validator withdraw '{"amount": "100000000000000000000000000"}' --accountId user1 ``` ## Interface ```rust pub struct RewardFeeFraction { pub numerator: u32, pub denominator: u32, } /// Initializes the contract with the given owner_id, initial staking public key (with ED25519 /// curve) and initial reward fee fraction that owner charges for the validation work. #[init] pub fn new( owner_id: AccountId, stake_public_key: Base58PublicKey, reward_fee_fraction: RewardFeeFraction, ); /// Distributes rewards and restakes if needed. pub fn ping(&mut self); /// Deposits the attached amount into the inner account of the predecessor. #[payable] pub fn deposit(&mut self); /// Withdraws the non staked balance for given account. /// It's only allowed if the `unstake` action was not performed in the recent 3 epochs. pub fn withdraw(&mut self, amount: U128); /// Stakes the given amount from the inner account of the predecessor. /// The inner account should have enough unstaked balance. pub fn stake(&mut self, amount: U128); /// Unstakes the given amount from the inner account of the predecessor. /// The inner account should have enough staked balance. /// The new total unstaked balance will be available for withdrawal in 3 epochs. pub fn unstake(&mut self, amount: U128); /****************/ /* View methods */ /****************/ /// Returns the unstaked balance of the given account. pub fn get_account_unstaked_balance(&self, account_id: AccountId) -> U128; /// Returns the staked balance of the given account. /// NOTE: This is computed from the amount of "stake" shares the given account has and the /// current amount of total staked balance and total stake shares on the account. pub fn get_account_staked_balance(&self, account_id: AccountId) -> U128; /// Returns the total balance of the given account (including staked and unstaked balances). pub fn get_account_total_balance(&self, account_id: AccountId) -> U128; /// Returns `true` if the given account can withdraw tokens in the current epoch. pub fn is_account_unstaked_balance_available(&self, account_id: AccountId) -> bool; /// Returns the total staking balance. pub fn get_total_staked_balance(&self) -> U128; /// Returns account ID of the staking pool owner. pub fn get_owner_id(&self) -> AccountId; /// Returns the current reward fee as a fraction. pub fn get_reward_fee_fraction(&self) -> RewardFeeFraction; /*******************/ /* Owner's methods */ /*******************/ /// Owner's method. /// Updates current public key to the new given public key. pub fn update_staking_key(&mut self, stake_public_key: Base58PublicKey); /// Owner's method. /// Updates current reward fee fraction to the new given fraction. pub fn update_reward_fee_fraction(&mut self, reward_fee_fraction: RewardFeeFraction); /// Owner's method. /// Vote on a given proposal on a given voting contract account ID on behalf of the pool. /// NOTE: This method allows the owner to call `vote(proposal_id: U64)` on any contract on /// behalf of this staking pool. pub fn vote(&mut self, voting_account_id: AccountId, proposal_id: ProposalId) -> Promise; ``` ## Migrating from an existing validator or contract This provides instructions to migrate your staked validator or a validator contract to a new contract #### Upgrade to the latest near-shell: ```bash npm install -g near-shell ``` #### Set Environment and Login: ##### If not logged into the browser, recover your account with the seed phrase first https://wallet.betanet.nearprotocol.com/create/ ```bash #Set the NEAR environment to the target network (betanet,testnet,mainnet) export NEAR_ENV=betanet near login ``` #### Unstake and Withdraw: ```bash #If you staked to your validator unstake, there is no withdraw near stake nearkat.betanet <staking public key> 0 #If you staked to a contract get the staked balance near view my_validator get_account_staked_balance '{"account_id": "user1"}' #Unsake by copying and pasting the staked balance near call my_validator unstake '{"amount": "100000000000000000000000000"}' --accountId user1 #Wait 4 epochs (12 hours) to withdraw and check if balance is available to withdraw near view my_validator is_account_unstaked_balance_available '{"account_id": "user1"}' #If is_account_unstaked_balance_available returns "true" withdraw near call my_validator withdraw '{"amount": "100000000000000000000000000"}' --accountId user1 ``` #### Download new contract with Git: ```bash mkdir staking-pool cd staking-pool git clone https://github.com/near/initial-contracts cd initial-contracts cd staking-pool ``` #### Build contract with Rust (This step is optional since the contract is compiled): ##### Install Rust: ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh #Add rust to current shell path source $HOME/.cargo/env ``` ##### Add wasm target to your toolchain: ```bash rustup target add wasm32-unknown-unknown ``` ##### Build: ```bash ./build.sh ``` #### Create a new account to deploy contract to - Set my_validator to the name you want publicly displayed - --masterAccount is your account you signed up to StakeWars2 with ```bash near create_account my_validator --masterAccount=owner ``` #### Deploy the contract to the new account ```bash near deploy --accountId=my_validator --wasmFile=res/staking_pool.wasm ``` #### Create a new node: **Note** after you NEAR is unstaked stop your node and create a new one to run as the contract account ##### Stop your node ```bash nearup stop ``` ##### Move your ~/.near/betanet folder, to remove references to any previous validator node ```bash mv ~/.near/betanet ~/.near/betanet_old ``` ##### Launch your new node With the command nearup betanet. Modify the launch command according to your actual validator configuration (e.g. using --nodocker and --binary-path) ##### Set your validator ID. Put your staking pool account (the one we called my_validator in the steps above) ##### Copy your validator public key, or issue the command (before the next step) ```bash cat ~/.near/betanet/validator_key.json |grep "public_key" ``` #### Initialize staking pool at account `my_validator` for the owner account ID `owner`, given staking pool and 10% reward fee ```bash near call my_validator new '{"owner_id": "owner", "stake_public_key": "CE3QAXyVLeScmY9YeEyR3Tw9yXfjBPzFLzroTranYtVb", "reward_fee_fraction": {"numerator": 10, "denominator": 100}}' --account_id owner ``` #### Check the current `seat price` to transfer the correct amount to your delegator(s) ```bash near validators next| grep "seat price" ``` #### Register a delegator account (repeat these steps for additional delegators) -- https://wallet.betanet.near.org -- backup your seed phrase -- transfer NEAR from your MasterAccount to the delegator account #### Login and authorize the delegator ```bash near login ``` #### Deposit NEAR from the delegator account to the valdiator contract ```bash near call my_validator deposit '{}' --accountId user1 --amount 100 ``` #### Stake the deposited amount to the validator contract ```bash near call my_validator stake '{"amount": "100000000000000000000000000"}' --accountId user1 ``` #### Check that your validator proposal was (Accepted) or deposit and stake more NEAR ```bash near proposals | grep my_validator #After some time check to make sure you're listed near validators next | grep my_validator ``` ## Common errors and resolutions #### ERROR while adding wasm32 to toolchain: error[E0463]: can't find crate for `core` You might have a nightly version of cargo, rustc, rustup, update to stable ```bash rustup update stable #Install target with stable version of Rustup rustup +stable target add wasm32-unknown-unknown ``` #### Error: TypedError: [-32000] Server error: account <accountId> does not exist while viewing You are not logged in ```bash near login ``` #### Error: GasExceeded [Error]: Exceeded the prepaid gas Add additional gas by adding the parameter: --gas 10000000000000000 #### Error: "wasm execution failed with error: FunctionCallError(MethodResolveError(MethodNotFound))" Your function call is incorrect or your contract is not updated # Lockup / Vesting contract *Work in progress.*
jerry1ye10_blocfrens
README.md party-bid .gitpod.yml README.md babel.config.js contracts compile.js factory Cargo.toml src lib.rs neardev dev-account.env party Cargo.toml src lib.rs neardev dev-account.env test.bat lambda index.js package.json src App.js __mocks__ fileMock.js assets avatar.svg logo-black.svg logo-white.svg near_logo.svg orb.svg common constants.js theme components button.js index.js utils.js components AuctionStatusComponents.js ContributionCard LoginPanelStates.js VoteModal.js index.js ContributionFeed.js CreateBlocModal.js Footer.js Layout.js LiveFeed.js Loader.js LoginView.js NFTCard.js Navbar.js svgs.js config.js data indexer.js updateContract.js global.css index.html index.js jest.init.js main.test.js utils.js views bloc.js blocs.js home.js index.js marketplace.js wallet login index.html vercel.json
# near-party-bid party-bid ================== This [React] app was initialized with [create-near-app] Quick Start =========== To run this project locally: 1. Prerequisites: Make sure you've installed [Node.js] ≥ 12 2. Install dependencies: `yarn install` 3. Run the local development server: `yarn dev` (see `package.json` for a full list of `scripts` you can run with `yarn`) Now you'll have a local development environment backed by the NEAR TestNet! Go ahead and play with the app and the code. As you make code changes, the app will automatically reload. Exploring The Code ================== 1. The "backend" code lives in the `/contract` folder. See the README there for more info. 2. The frontend code lives in the `/src` folder. `/src/index.html` is a great place to start exploring. Note that it loads in `/src/index.js`, where you can learn how the frontend connects to the NEAR blockchain. 3. Tests: there are different kinds of tests for the frontend and the smart contract. See `contract/README` for info about how it's tested. The frontend code gets tested with [jest]. You can run both of these at once with `yarn run test`. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `yarn dev`, your smart contract gets deployed to the live NEAR TestNet with a throwaway account. When you're ready to make it permanent, here's how. Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `yarn install`, but for best ergonomics you may want to install it globally: yarn install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `party-bid.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `party-bid.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account party-bid.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: set contract name in code --------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'party-bid.YOUR-NAME.testnet' Step 3: deploy! --------------- One command: yarn deploy As you can see in `package.json`, this does two things: 1. builds & deploys smart contract to NEAR TestNet 2. builds & deploys frontend code to GitHub using [gh-pages]. This will only work if the project already has a repository set up on GitHub. Feel free to modify the `deploy` script in `package.json` to deploy elsewhere. Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [React]: https://reactjs.org/ [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/docs/concepts/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli [gh-pages]: https://github.com/tschaub/gh-pages If you run into the following error: ``` error[E0463]: can't find crate for `core` | = note: the `wasm32-unknown-unknown` target may not be installed = help: consider downloading the target with `rustup target add wasm32-unknown-unknown` ``` try running `rustup target add wasm32-unknown-unknown` (source: https://stackoverflow.com/questions/66252428/errore0463-cant-find-crate-for-core-note-the-wasm32-unknown-unknown-t)
near_core-contracts-as
.github ISSUE_TEMPLATE BOUNTY.yml bounty-template.md bounty.md workflows test.yml .travis.yml README.md as-pect.config.js asconfig.json exchange-deposit-receiver __tests__ exchange.spec.ts asconfig.json assembly __tests__ as-pect.d.ts exchange.spec.ts index.ts package.json jest.config.js lockup asconfig.json assembly __tests__ as-pect.d.ts index.ts package.json multisig asconfig.json assembly __tests__ as-pect.d.ts index.ts package.json package.json setup.js staking-pool-factory asconfig.json assembly __tests__ as-pect.d.ts index.ts package.json staking-pool asconfig.json assembly __tests__ as-pect.d.ts index.ts package.json tsconfig.json voting asconfig.json assembly __tests__ as-pect.d.ts index.ts package.json whitelist as-pect.config.js asconfig.json assembly __tests__ as-pect.d.ts index.ts package.json
# core-contracts-as The [core contracts](https://github.com/near/core-contracts) implemented in AssemblyScript. ## build ```bash yarn build # or npm run build ``` Add `--target debug` for a debug build. ## test ### setup To setup the repo for testing using the Rust contracts and for reference use `yarn setup` or `node setup.sh` To run all the tests: ```bash yarn test # or npm run test ``` To run just one test, `yarn asp -f <file_pattern>` or `yarn jest -f <file_pattern>`
amiyatulu_nearprotocol_learning
README.md babel.config.js contract Cargo.toml README.md build.js src lib.rs package.json src App.css App.js App.test.js __mocks__ fileMock.js assets gray_near_logo.svg logo.svg near.svg config.js index.html index.js jest.init.js main.test.js wallet login index.html
<br /> <br /> <p> <img src="https://nearprotocol.com/wp-content/themes/near-19/assets/img/logo.svg?t=1553011311" width="240"> </p> <br /> <br /> ## Template for NEAR dapps ### Requirements ##### IMPORTANT: Make sure you have the latest version of NEAR Shell and Node Version > 10.x 1. [Node.js](https://nodejs.org/en/download/package-manager/) 2. (optional) near-shell ``` npm i -g near-shell ``` 3. (optional) yarn ``` npm i -g yarn ``` ### To run on NEAR testnet ```bash npm install && npm dev ``` with yarn: ```bash yarn && yarn dev ``` The server that starts is for static assets and by default serves them to http://localhost:1234. Navigate there in your browser to see the app running! NOTE: Both contract and client-side code will auto-reload once you change source files. ### To run tests ```bash npm test ``` with yarn: ```bash yarn test ``` ### Deploy #### Step 1: Create account for the contract You'll now want to authorize NEAR shell on your NEAR account, which will allow NEAR Shell to deploy contracts on your NEAR account's behalf \(and spend your NEAR account balance to do so\). Type the command `near login` which opens a webpage at NEAR Wallet. Follow the instructions there and it will create a key for you, stored in the `/neardev` directory. #### Step 2: Modify `src/config.js` line that sets the account name of the contract. Set it to the account id from step 1. NOTE: When you use [create-near-app](https://github.com/nearprotocol/create-near-app) to create the project it'll infer and pre-populate name of contract based on project folder name. ```javascript const CONTRACT_NAME = 'react-template'; /* TODO: Change this to your contract's name! */ const DEFAULT_ENV = 'development'; ... ``` #### Step 3: Check the scripts in the package.json, for frontend and backend both, run the command: ```bash npm run deploy ``` with yarn: ```bash yarn deploy ``` NOTE: This uses [gh-pages](https://github.com/tschaub/gh-pages) to publish resulting website on GitHub pages. It'll only work if project already has repository set up on GitHub. Feel free to modify `deploy:pages` script in `package.json` to deploy elsewhere. ### To Explore - `assembly/main.ts` for the contract code - `src/index.html` for the front-end HTML - `src/index.js` for the JavaScript front-end code and how to integrate contracts - `src/App.js` for the main React component - `src/main.test.js` for the JavaScript integration tests of smart contract - `src/App.test.js` for the main React component tests # Status Message Records the status messages of the accounts that call this contract. ## Testing To test run: ```bash cargo test --package status-message -- --nocapture ```
esaminu_donation-boilerplate-template-rs-2234
.github scripts runfe.sh workflows deploy-to-console.yml readme.yml tests.yml .gitpod.yml README.md contract README.md build.sh deploy.sh package-lock.json package.json src contract.ts model.ts utils.ts tsconfig.json integration-tests package-lock.json package.json src main.ava.ts package-lock.json package.json
# Donation 💸 [![](https://img.shields.io/badge/⋈%20Examples-Basics-green)](https://docs.near.org/tutorials/welcome) [![](https://img.shields.io/badge/Gitpod-Ready-orange)](https://gitpod.io/#/https://github.com/near-examples/donation-js) [![](https://img.shields.io/badge/Contract-js-yellow)](https://docs.near.org/develop/contracts/anatomy) [![](https://img.shields.io/badge/Frontend-JS-yellow)](https://docs.near.org/develop/integrate/frontend) [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fnear-examples%2Fdonation-js%2Fbadge&style=flat&label=Tests)](https://actions-badge.atrox.dev/near-examples/donation-js/goto) Our Donation example enables to forward money to an account while keeping track of it. It is one of the simplest examples on making a contract receive and send money. ![](https://docs.near.org/assets/images/donation-7cf65e5e131274fd1ae9aa34bc465bb8.png) # What This Example Shows 1. How to receive and transfer $NEAR on a contract. 2. How to divide a project into multiple modules. 3. How to handle the storage costs. 4. How to handle transaction results. 5. How to use a `Map`. <br /> # Quickstart Clone this repository locally or [**open it in gitpod**](https://gitpod.io/#/github.com/near-examples/donation-js). Then follow these steps: ### 1. Install Dependencies ```bash npm install ``` ### 2. Test the Contract Deploy your contract in a sandbox and simulate interactions from users. ```bash npm test ``` ### 3. Deploy the Contract Build the contract and deploy it in a testnet account ```bash npm run deploy ``` --- # Learn More 1. Learn more about the contract through its [README](./contract/README.md). 2. Check [**our documentation**](https://docs.near.org/develop/welcome). # Donation Contract The smart contract exposes methods to handle donating $NEAR to a `beneficiary`. ```ts @call donate() { // Get who is calling the method and how much $NEAR they attached let donor = near.predecessorAccountId(); let donationAmount: bigint = near.attachedDeposit() as bigint; let donatedSoFar = this.donations.get(donor) === null? BigInt(0) : BigInt(this.donations.get(donor) as string) let toTransfer = donationAmount; // This is the user's first donation, lets register it, which increases storage if(donatedSoFar == BigInt(0)) { assert(donationAmount > STORAGE_COST, `Attach at least ${STORAGE_COST} yoctoNEAR`); // Subtract the storage cost to the amount to transfer toTransfer -= STORAGE_COST } // Persist in storage the amount donated so far donatedSoFar += donationAmount this.donations.set(donor, donatedSoFar.toString()) // Send the money to the beneficiary const promise = near.promiseBatchCreate(this.beneficiary) near.promiseBatchActionTransfer(promise, toTransfer) // Return the total amount donated so far return donatedSoFar.toString() } ``` <br /> # Quickstart 1. Make sure you have installed [node.js](https://nodejs.org/en/download/package-manager/) >= 16. 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash npm run deploy ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # e.g. dev-1659899566943-21539992274727 ``` The contract will be automatically initialized with a default `beneficiary`. To initialize the contract yourself do: ```bash # Use near-cli to initialize contract (optional) near call <dev-account> init '{"beneficiary":"<account>"}' --accountId <dev-account> ``` <br /> ## 2. Get Beneficiary `beneficiary` is a read-only method (`view` method) that returns the beneficiary of the donations. `View` methods can be called for **free** by anyone, even people **without a NEAR account**! ```bash near view <dev-account> beneficiary ``` <br /> ## 3. Get Number of Donations `donate` forwards any attached money to the `beneficiary` while keeping track of it. `donate` is a payable method for which can only be invoked using a NEAR account. The account needs to attach money and pay GAS for the transaction. ```bash # Use near-cli to donate 1 NEAR near call <dev-account> donate --amount 1 --accountId <account> ``` **Tip:** If you would like to `donate` using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`.
Garfield550_qstn-dct2
.github dependabot.yml workflows actions.yml dependency-review.yml .vscode extensions.json settings.json README.md app api auth [...nextauth] _route.ts hello route.ts components ui use-toast.ts config site.ts env client.ts index.ts schema.ts server.ts example.env globalSetup next-environment.ts lib apollo.ts auth.ts chain.test.ts chain.ts fonts.ts session.ts utils.ts validations auth.ts lint-staged.config.js middleware.ts next.config.js package.json pages api auth [...nextauth].ts public next.svg thirteen.svg vercel.svg styles globals.css tsconfig.json types nav.ts vitest.config.ts
# QSTN Developer Code Test 2 ![GitHub Actions](https://img.shields.io/github/actions/workflow/status/Garfield550/qstn-dct2/actions.yml?logo=github&style=for-the-badge) ![Vercel Deployment](https://img.shields.io/github/deployments/Garfield550/qstn-dct2/production?label=vercel&logo=vercel&style=for-the-badge) ![Version](https://img.shields.io/github/package-json/v/Garfield550/qstn-dct2?style=for-the-badge) ![License](https://img.shields.io/github/license/Garfield550/qstn-dct2?style=for-the-badge) This is a [Next.js 13](https://nextjs.org/) project using new [App Route](https://nextjs.org/docs/app/building-your-application/routing) feature. ## Features - New `/app` dir - Interaction with Aurora blockchain using **ConnectKit** and **Wagmi** - Interaction with Near blockchain using **Near Wallet Selector** and **Near JavaScript API** - Query Aurora Explorer data using **Apollo GraphQL** - Server and Client Components - API Routes and Middleware - Authentication using **NextAuth.js** - UI Components built using **shadcn/ui** and **Radix UI** - Styled using **Tailwind CSS** - Validations using **Zod** - Written in **TypeScript** ## Backlogs - [ ] Reduce first load JS size for /dashboard page - [ ] Performance optimizations - [ ] Add more tests - [ ] Interaction with [TestERC721](https://explorer.testnet.aurora.dev/address/0x1875fcC416a92e04Ee23d2077203B02f3a51D0C0/contracts#address-tabs) contract - [ ] Interaction with Near Guest Book contract ## Known Issues 1. Hardcoded username(`johndoe`) and password(`abcd1234`) 1. Hardcoded user information 1. GitHub authentication not working 1. `/sign-in`, `/privacy` and `/terms` pages are not implemented ## Running Locally 1. Install dependencies using pnpm: ```sh pnpm install ``` 1. Copy `example.env` to `.env.local` and update the variables. ```sh cp example.env .env.local ``` > **Note** > > You can set `NEXT_PUBLIC_NFT_CONTRACT_ADDRESS` to `0x1875fcC416a92e04Ee23d2077203B02f3a51D0C0` and `NEXT_PUBLIC_NEAR_CONTRACT_ID` to `guest-book.testnet` 1. Start the development server: ```sh pnpm dev ``` ## Running Tests 1. Install dependencies using pnpm: ```sh pnpm install ``` 1. Copy `example.env` to `.env.test.local` and update the variables. ```sh cp example.env .env.test ``` 1. Run tests: ```sh pnpm test ``` ## Deploy on Vercel [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/Garfield550/qstn-dct2&project-name=qstn-dct2&repository-name=qstn-dct2) The easiest way to deploy a Next.js app is to use the [Vercel Platform](https://vercel.com/new). Check out the [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. ## License Licensed under the [MIT license](LICENSE).
mamad-1373_nft_escrow_sc_near
Cargo.toml README.md ft_token Cargo.toml build.sh commands.txt deploy.sh dev-deploy.sh init-args.js src lib.rs owner.rs nft_collection Cargo.toml build.sh deploy.sh dev-deploy.sh init-args.js src lib.rs owner.rs nft_escrow Cargo.toml active-ft-args.js active-nft-args.js active_ft_project.sh active_nft_project.sh build.sh commands.md contract.sh deploy.sh dev-deploy.sh init-args.js rustfmt.toml src curves.rs errors.rs lib.rs owner.rs pause.rs proxy_token.rs pt_metadata.rs token_receiver.rs utils.rs validates.rs views.rs test.sh tests escrow-tests.rs helpers.rs
# escrow_sc_near Escrow smart contract on Near network for Theia protocol # Required Software - Rust 1.61 + cargo - Node.js - NEAR CLI 3.2 # Usage ## Scripts ### Build #### 1. Build Fungible Token ``` $ cd ft_token $ cargo install $ ./build.sh $ cd .. ``` Compiles "Fungible Token" smart contract to a WebAssembly binary. The binary path is `./target/wasm32-unknown-unknown/release/ft_token.wasm`. #### 2. Build Non Fungible Token ``` $ cd nft_collection $ cargo install $ ./build.sh $ cd .. ``` Compiles "Non Fungible Token" smart contract to a WebAssembly binary. The binary path is `./target/wasm32-unknown-unknown/release/nft_collection.wasm`. #### 3. Build Escrow Smart Contract ``` $ cd nft_escrow $ cargo install $ ./build.sh $ cd .. ``` Compiles "Escrow" smart contract to a WebAssembly binary. The binary path is `./target/wasm32-unknown-unknown/release/nft_escrow_sc.wasm`. ### Test Integration testing of escrow contract. All 13 test features ``` $ cd nft_escrow $ ./test.sh ``` ### Deploy #### deploy smart contract on mainnet ``` $ cd nft_escrow $ ./deploy.sh <account-id> ``` Deploys the most recently built WASM binary to `<account-id>` on mainnet, and calls the `new` function with arguments generated by `init-args.js`. #### deploy smart contract on testnet ``` $ cd nft_escrow $ dev-deploy.sh [--force] ``` Deploys the most recently built WASM binary to the dev account in `neardev/`, or to a new dev account if `neardev/` is not found or `--force` is set. Calls the `new` function with arguments generated by `init-args.js`. #### active project - active ft project Calls `active_ft_project` function with arguments generated by `active-ft-args.js`. ``` $ cd ft_escrow $ ./active_ft_project.sh ``` - active nft project Calls `active_nft_project` function with arguments generated by `active-nft-args.js`. ``` $ cd nft_escrow $ ./active_nft_project.sh ``` #### other view functions in [here](./nft_escrow/commands.md)
near_multisig-tool
actions.js base.js index.html issue_template.md ledger.js lockup.js multisig.js package-lock.json package.json script.js scripts create-multisig.js staking.js style.css utils.js
MarmaJFoundation_pixeldapps-backend
.babelrc.js .vscode launch.json README.md assets css style.css js main.js components Footer.js Header.js Navbar.js Navbar2.js jsconfig.json next-env.d.ts next.config.js package-lock.json package.json pages _app.js _document.js api admin ch-banishment.ts ch-errors.ts ch edit-item.ts edit-monster.ts ctt edit-map.ts edit-unit.ts pp edit-pet.ts rating-decay.ts chainteamtactics challenge begin-create-room.ts end-create-room.ts get-all-rooms.ts get-my-rooms.ts join-room.ts notify-room.ts simulate-fight.ts get-leaderboard.ts get-playerdata.ts is-valid-login.ts marketplace advanced-search.ts buy-unit.ts cancel-offer-unit.ts offer-unit.ts refill-fightpoints.ts cryptohero get-leaderboard.ts get-playerdata.ts is-valid-login.ts marketplace advanced-search.ts buy-item.ts cancel-offer-item.ts completed-offers.ts history.ts offer-item.ts presale open-lootbox.ts request-lootbox.ts raid create-room.ts delete-room.ts get-highscores.ts get-room-info.ts join-room.ts kick-player.ts simulate-fight.ts refill-fightpoints.ts rewards reward-raid-easy.ts reward-raid-hard.ts reward-raid-medium.ts simulate-dungeon.ts pixelpets get-latest-rewards.ts get-leaderboard.ts get-playerdata.ts get-prev-week-top30.ts is-valid-login.ts marketplace buy-pet.ts cancel-offer-pet.ts get-available-pets.ts offer-pet.ts search.ts search2.ts open-egg.ts refill-fightpoints.ts rewards reward-clash.ts reward-global.ts simulate-fight.ts proxy call-change-function.ts call-view-function.ts get-ed25519pair.ts get-key-allowance.ts get-login-url.ts get-transaction-signing-url.ts callback index.js index.js presale cryptohero.js ctt.js pixelparty.js pixelpets.js rewards index.js tokenomics Stats.js postcss.config.js public chainteam TemplateData style-fs.css style.css index.html old_index.html testnet.html cryptoheroes TemplateData style-fs.css style.css index.html old_index.html testnet.html pixelpets TemplateData style-fs.css style.css index.html old_index.html testnet.html shiney.svg styles globals.css tailwind.config.js tsconfig.json utils backend chainteamtactics battle core.ts types.ts utils.ts helper basic_game.ts data_loader.ts types.ts utils.ts common blockchain.ts mongo-helper.ts mongodbv2.ts rq_utils.ts server-config.ts types.ts utils.ts cryptohero dungeon core.ts types.ts utils.ts helper basic_game.ts data_loader.ts types.ts utils.ts raid core.ts types.ts utils.ts pixelpets fight core.ts types.ts utils.ts helper basic_game.ts pet_scaling.ts types.ts frontend config.js near.js store.js
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). ## Getting Started First, run the development server: ```bash npm run dev # or yarn dev ``` Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. [API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. ## Learn More To learn more about Next.js, take a look at the following resources: - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! ## Deploy on Vercel The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
mfornet_small_near_admin
Cargo.toml README.md build.sh src lib.rs
# Small Admin NEAR Contract to test admin interface. Admin can be set to any NEAR account, including a [DAO](https://astrodao.com/). ## Compile ``` ./build.sh ``` [Contract builder](https://github.com/near/near-sdk-rs/tree/master/contract-builder) is recommended for reproducing the same binary while compiling on different machines. Final binary will be on `res/small_admin.wasm` ## Deploy Following commands are using [near-cli](https://github.com/near/near-cli) ``` near deploy small_admin.near res/small_admin.wasm '{"owner": "the_real_admin.near"}' ``` Notice on deployment a Full Access Key is created for this contract. The contract itself is considered an admin, so in order to remove it, all Full Access Keys must be removed (it should be only one during deployment). ## View methods ### get_owner ``` near view small_admin.near get_owner ``` ### get_counter Everyone can see the counter but only admin can increase it. ``` near view small_admin.near get_counter ``` ## Call methods Only the owner can call the following methods. ### increase_counter ``` near call small_admin.near increase_counter --accountId the_real_admin.near ``` ### set_owner New owner can be any NEAR account id, including a DAO account. Notice this replace the previous owner for the new one. ``` near call small_admin.near set_owner '{"owner": "dao_admin.sputnik-dao.near"}' --accountId the_real_admin.near ```
max-mainnet_guest-book-js
.github workflows tests.yml .gitpod.yml README.md contract README.md babel.config.json build.sh deploy.sh package.json src contract.ts model.ts tsconfig.json frontend App.js index.html index.js near-interface.js near-wallet.js package.json start.sh integration-tests package.json src main.ava.ts package.json
# Guest Book Contract The smart contract stores messages from users. Messages can be `premium` if the user attaches sufficient money (0.1 $NEAR). ```ts this.messages = []; @call // Public - Adds a new message. add_message({ text }: { text: string }) { // If the user attaches more than 0.01N the message is premium const premium = near.attachedDeposit() >= BigInt(POINT_ONE); const sender = near.predecessorAccountId(); const message = new PostedMessage({premium, sender, text}); this.messages.push(message); } @view // Returns an array of messages. get_messages({ fromIndex = 0, limit = 10 }: { fromIndex: number, limit: number }): PostedMessage[] { return this.messages.slice(fromIndex, fromIndex + limit); } ``` <br /> # Quickstart 1. Make sure you have installed [node.js](https://nodejs.org/en/download/package-manager/) >= 16. 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash npm run deploy ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # e.g. dev-1659899566943-21539992274727 ``` <br /> ## 2. Retrieve the Stored Messages `get_messages` is a read-only method (`view` method) that returns a slice of the vector `messages`. `View` methods can be called for **free** by anyone, even people **without a NEAR account**! ```bash near view <dev-account> get_messages '{"from_index":0, "limit":10}' ``` <br /> ## 3. Add a Message `add_message` adds a message to the vector of `messages` and marks it as premium if the user attached more than `0.1 NEAR`. `add_message` is a payable method for which can only be invoked using a NEAR account. The account needs to attach money and pay GAS for the transaction. ```bash # Use near-cli to donate 1 NEAR near call <dev-account> add_message '{"text": "a message"}' --amount 0.1 --accountId <account> ``` **Tip:** If you would like to add a message using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`. # Guest Book 📖 [![](https://img.shields.io/badge/⋈%20Examples-Basics-green)](https://docs.near.org/tutorials/welcome) [![](https://img.shields.io/badge/Gitpod-Ready-orange)](https://gitpod.io/#/https://github.com/near-examples/guest-book-js) [![](https://img.shields.io/badge/Contract-js-yellow)](https://docs.near.org/develop/contracts/anatomy) [![](https://img.shields.io/badge/Frontend-React-blue)](https://docs.near.org/develop/integrate/frontend) [![](https://img.shields.io/badge/Testing-passing-green)](https://docs.near.org/develop/integrate/frontend) The Guest Book is a simple app that stores messages from users, allowing to pay for a premium message. ![](https://docs.near.org/assets/images/guest-book-b305a87a35cbef2b632ebe289d44f7b2.png) # What This Example Shows 1. How to receive $NEAR on a contract. 2. How to store and retrieve information from the blockchain. 3. How to use a `Vector`. 4. How to interact with a contract from `React JS`. <br /> # Quickstart Clone this repository locally or [**open it in gitpod**](https://gitpod.io/#/github.com/near-examples/guest_book-js). Then follow these steps: ### 1. Install Dependencies ```bash npm install ``` ### 2. Test the Contract Deploy your contract in a sandbox and simulate interactions from users. ```bash npm test ``` ### 3. Deploy the Contract Build the contract and deploy it in a testnet account ```bash npm run deploy ``` ### 4. Start the Frontend Start the web application to interact with your smart contract ```bash npm start ``` --- # Learn More 1. Learn more about the contract through its [README](./contract/README.md). 2. Check [**our documentation**](https://docs.near.org/develop/welcome).
near-0x_dino-nft-marketplace
.gitpod.yml README.md babel.config.js contract Cargo.toml README.md compile.js src lib.rs target .rustc_info.json debug .fingerprint Inflector-09b64bba0943a9b1 lib-inflector.json autocfg-b608a474fcfc7e2d lib-autocfg.json borsh-derive-59a9b9ba1fd5442b lib-borsh-derive.json borsh-derive-internal-9c9f86853351bcff lib-borsh-derive-internal.json borsh-schema-derive-internal-6d3d44e6373763a7 lib-borsh-schema-derive-internal.json byteorder-8378e4fa82f56d29 build-script-build-script-build.json convert_case-b5daeccf1320ea35 lib-convert_case.json derive_more-6741b36e044967bd lib-derive_more.json generic-array-89cb70d2b50f351e build-script-build-script-build.json hashbrown-5d1757aa0d1ade5e lib-hashbrown.json hashbrown-6c0b142cb1d87347 run-build-script-build-script-build.json hashbrown-ac73041467297d08 build-script-build-script-build.json indexmap-78ca69c1aadb3050 build-script-build-script-build.json indexmap-7f8658479f0bc7a5 lib-indexmap.json indexmap-f59919e5cfa24e29 run-build-script-build-script-build.json itoa-e3956abfc18d017c lib-itoa.json memchr-323dad3cea80c26e build-script-build-script-build.json near-rpc-error-core-5289019ec52049f6 lib-near-rpc-error-core.json near-rpc-error-macro-594f8c8d5c4f0bc9 lib-near-rpc-error-macro.json near-sdk-core-7d754335d66485a0 lib-near-sdk-core.json near-sdk-macros-102797f7bb49717c lib-near-sdk-macros.json num-bigint-608ef2841a6c1017 build-script-build-script-build.json num-integer-02c3a27f3cfd5cbb build-script-build-script-build.json num-rational-56d0e3b0e024ac5d build-script-build-script-build.json num-traits-bcf1a3d42ec8cc0d build-script-build-script-build.json proc-macro-crate-a49f87a6d49039d2 lib-proc-macro-crate.json proc-macro2-4f3346a27594eaba lib-proc-macro2.json proc-macro2-b4f246f5d298f71d run-build-script-build-script-build.json proc-macro2-d933e705377afd4a build-script-build-script-build.json quote-00be81416b6d01f8 lib-quote.json ryu-3f2f96e14d13bf05 lib-ryu.json ryu-52a46a214676174c build-script-build-script-build.json ryu-8676aa5cfb41aeb2 run-build-script-build-script-build.json serde-89317e7289dfcfb2 build-script-build-script-build.json serde-bc9287f01ecccaba run-build-script-build-script-build.json serde-f71ed78cd8d319fd lib-serde.json serde_derive-26d148e90892c923 build-script-build-script-build.json serde_derive-3807a05efa902fb3 lib-serde_derive.json serde_derive-4411c575e47b636a run-build-script-build-script-build.json serde_json-22800fbd7a0fcda9 lib-serde_json.json serde_json-4958bd3f86d5290c run-build-script-build-script-build.json serde_json-a118a54315662ee0 build-script-build-script-build.json syn-35c033fc9fda6c1a run-build-script-build-script-build.json syn-721de1ad194c0ce5 lib-syn.json syn-c5b3d455d722431d build-script-build-script-build.json toml-ecf0119da781b917 lib-toml.json typenum-c4aff89bdd9cb4a3 build-script-build-script-main.json unicode-xid-afa6831eaee85ded lib-unicode-xid.json version_check-608ad375928751d6 lib-version_check.json wee_alloc-8f29aa5bb7abd297 build-script-build-script-build.json wasm32-unknown-unknown debug .fingerprint ahash-503034fcf7191e05 lib-ahash.json aho-corasick-29c59e1e2960e37d lib-aho_corasick.json base64-9b69736e7b255960 lib-base64.json block-buffer-03e6c05c308c2874 lib-block-buffer.json block-buffer-f7a0e539419adf2b lib-block-buffer.json block-padding-4afdf67094f15cd0 lib-block-padding.json borsh-222977c50282e528 lib-borsh.json bs58-00bc5b97ed99f19d lib-bs58.json byte-tools-0276963d534cca73 lib-byte-tools.json byteorder-34e5be2cb9d82d40 lib-byteorder.json byteorder-4102761c5b18f904 run-build-script-build-script-build.json cfg-if-27831d94e0348483 lib-cfg-if.json cfg-if-f75a4797bfbddf54 lib-cfg-if.json digest-0e86a62e42b51925 lib-digest.json digest-8404d7c542a044a7 lib-digest.json generic-array-0f96323547641628 lib-generic_array.json generic-array-394a34caa40754ec run-build-script-build-script-build.json generic-array-d091ea047c61b28f lib-generic_array.json greeter-98ace302c5fafa12 lib-greeter.json hashbrown-02356c7e88ac9880 lib-hashbrown.json hashbrown-b86e0868d035847c lib-hashbrown.json hashbrown-fc867551893f808b run-build-script-build-script-build.json hex-48c622c0d368080c lib-hex.json indexmap-d3544c43860ab116 lib-indexmap.json indexmap-d5109f1144a7ead2 run-build-script-build-script-build.json itoa-2ed57a740718afc9 lib-itoa.json keccak-8e777639cdd4231b lib-keccak.json lazy_static-a9d75cbde4cbb92e lib-lazy_static.json memchr-4f61685f9cf98f1e run-build-script-build-script-build.json memchr-8e8e0da377c924f2 lib-memchr.json memory_units-dd07fee101297caf lib-memory_units.json near-primitives-core-2e94783fdd1634e3 lib-near-primitives-core.json near-runtime-utils-8d0c14d3186dda4a lib-near-runtime-utils.json near-sdk-055080cf24c33f66 lib-near-sdk.json near-vm-errors-4c50fb38b50082c4 lib-near-vm-errors.json near-vm-logic-ed927772a58567ba lib-near-vm-logic.json num-bigint-2478e2d4c54190b2 lib-num-bigint.json num-bigint-902677f513d3a69e run-build-script-build-script-build.json num-integer-338204211706c3f6 run-build-script-build-script-build.json num-integer-e8a02c268d2e1362 lib-num-integer.json num-rational-3937e138a2d1829b lib-num-rational.json num-rational-d66c79d3dbcddff1 run-build-script-build-script-build.json num-traits-1fb55b2d307d6bf8 lib-num-traits.json num-traits-d696547fc89bcaa1 run-build-script-build-script-build.json opaque-debug-64c78318ce9413cb lib-opaque-debug.json opaque-debug-cc2aa504495f797f lib-opaque-debug.json regex-ce0f065e4b80e20a lib-regex.json regex-syntax-1bcf792234c18f52 lib-regex-syntax.json ryu-4062810293822cc9 run-build-script-build-script-build.json ryu-4f2f5a8905f83672 lib-ryu.json serde-a020739b795fa4b3 run-build-script-build-script-build.json serde-e81df0462c842946 lib-serde.json serde_json-39a2f7714e497388 run-build-script-build-script-build.json serde_json-42fca67207bf12be lib-serde_json.json sha2-a116e69bb5e84015 lib-sha2.json sha3-ad7d2d5235a12291 lib-sha3.json typenum-0ed3ab46d9512387 lib-typenum.json typenum-aaf2306a478f4725 run-build-script-build-script-main.json wee_alloc-06dddbd699a604a3 run-build-script-build-script-build.json wee_alloc-be71e49330d50e61 lib-wee_alloc.json build num-bigint-902677f513d3a69e out radix_bases.rs typenum-aaf2306a478f4725 out consts.rs op.rs tests.rs wee_alloc-06dddbd699a604a3 out wee_alloc_static_array_backend_size_bytes.txt package.json src App.js App2.js __mocks__ fileMock.js assets logo-black.svg logo-white.svg components Collection.js CollectionDetails.js Create.js Explore.js Home.js Item.js Profile.js View.js subsections HotBids.js LiveAuction.js TopCollection.js TopSellers.js config.js global.css index.html index.js jest.init.js main.test.js utils.js wallet login index.html
nft-marketplace ================== This [React] app was initialized with [create-near-app] Quick Start =========== To run this project locally: 1. Prerequisites: Make sure you've installed [Node.js] ≥ 12 2. Install dependencies: `yarn install` 3. Run the local development server: `yarn dev` (see `package.json` for a full list of `scripts` you can run with `yarn`) Now you'll have a local development environment backed by the NEAR TestNet! Go ahead and play with the app and the code. As you make code changes, the app will automatically reload. Exploring The Code ================== 1. The "backend" code lives in the `/contract` folder. See the README there for more info. 2. The frontend code lives in the `/src` folder. `/src/index.html` is a great place to start exploring. Note that it loads in `/src/index.js`, where you can learn how the frontend connects to the NEAR blockchain. 3. Tests: there are different kinds of tests for the frontend and the smart contract. See `contract/README` for info about how it's tested. The frontend code gets tested with [jest]. You can run both of these at once with `yarn run test`. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `yarn dev`, your smart contract gets deployed to the live NEAR TestNet with a throwaway account. When you're ready to make it permanent, here's how. Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `yarn install`, but for best ergonomics you may want to install it globally: yarn install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `nft-marketplace.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `nft-marketplace.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account nft-marketplace.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: set contract name in code --------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'nft-marketplace.YOUR-NAME.testnet' Step 3: deploy! --------------- One command: yarn deploy As you can see in `package.json`, this does two things: 1. builds & deploys smart contract to NEAR TestNet 2. builds & deploys frontend code to GitHub using [gh-pages]. This will only work if the project already has a repository set up on GitHub. Feel free to modify the `deploy` script in `package.json` to deploy elsewhere. Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [React]: https://reactjs.org/ [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/docs/concepts/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli [gh-pages]: https://github.com/tschaub/gh-pages nft-marketplace Smart Contract ================== A [smart contract] written in [Rust] for an app initialized with [create-near-app] Quick Start =========== Before you compile this code, you will need to install Rust with [correct target] Exploring The Code ================== 1. The main smart contract code lives in `src/lib.rs`. You can compile it with the `./compile` script. 2. Tests: You can run smart contract tests with the `./test` script. This runs standard Rust tests using [cargo] with a `--nocapture` flag so that you can see any debug info you print to the console. [smart contract]: https://docs.near.org/docs/develop/contracts/overview [Rust]: https://www.rust-lang.org/ [create-near-app]: https://github.com/near/create-near-app [correct target]: https://github.com/near/near-sdk-rs#pre-requisites [cargo]: https://doc.rust-lang.org/book/ch01-03-hello-cargo.html
Peersyst_NIP
CODE_OF_CONDUCT.md ISSUE_TEMPLATE.md | NIPs nip-0001.md nip-0002.md nip-0003.md nip-0004.md nip-0005.md nip-0006.md nip-0007.md nip-0008.md nip-0008 exchanges-custom-mosaics.md exchanges-list.md nip-0009.md nip-0010.md nip-0011.md nip-0012.md nip-0013.md nip-0013 reason-codes.md nip-0014.md | README.md |
# NEM2 Improvement Proposal NEM2 Improvement Proposals (NIPs) is the process for submitting improvements to Symbol. This process aims to evolve Symbol openly and collaboratively. The NIP process cover the core protocol, API, SDKs, applications, and official libraries. ## Contributing Get familiar with [NIP-0001](NIPs/nip-0001.md) first. Open an issue using [this template](ISSUE_TEMPLATE.md). Clone this repository and then sumit a pull request with your NIP. ## NIP List | Number | Layer | Title | Author | Type | Status | | -------------- | -------- | -------------------------------------------------| -----------------------| ---------------| --------| | [1][nip-0001] | | NIP Process | Aleix Morgadas | Process | Active | | [2][nip-0002] | Library | Transaction URI Scheme | David Garcia | Standards Track| Active | | [3][nip-0003] | | Documenting a New Feature | David Garcia | Process | Active | | [4][nip-0004] | Library | Apostille Improvement Protocol | Jonathan Tey | Standards Track| Draft | | [5][nip-0005] | Application | Wallet as Browser Extension | Aleix M., Décentraliser| Standards Track| Proposed| | [6][nip-0006] | Application | Multi-Account Hierarchy for Deterministic Wallets| Grégory Saive | Standards Track| Active | | [7][nip-0007] | Library | QR Library Standard Definition | Anthony L., Grégory S. | Standards Track| Active | | [8][nip-0008] | | Catapult Technology Release for Public Network | Grégory Saive | Process | Draft | | [9][nip-0009] | Core | New Persistent Delegation Request Transaction | gimre | Standards Track| Active | | [10][nip-0010] | Core | Key Pair Generation and Address Format | gimre | Standards Track| Active | | [11][nip-0011] | Application | Symbol Configuration Utility (CLI) | Bader Y., David G. | Standards Track| Draft | | [12][nip-0012] | | Rebranding | David Garcia | Process | Draft | | [13][nip-0013] | Library | NEM Security Token Standard | Grégory Saive | Standards Track| Draft | | [14][nip-0014] | | Release Management for Symbol Packages | Fernando Boucquez | Process | Draft | [nip-0001]: NIPs/nip-0001.md [nip-0002]: NIPs/nip-0002.md [nip-0003]: NIPs/nip-0003.md [nip-0004]: NIPs/nip-0004.md [nip-0005]: NIPs/nip-0005.md [nip-0006]: NIPs/nip-0006.md [nip-0007]: NIPs/nip-0007.md [nip-0008]: NIPs/nip-0008.md [nip-0009]: NIPs/nip-0009.md [nip-0010]: NIPs/nip-0010.md [nip-0011]: NIPs/nip-0011.md [nip-0012]: NIPs/nip-0012.md [nip-0013]: NIPs/nip-0013.md [nip-0014]: NIPs/nip-0014.md
jon-lewis_js-test-3
.github ISSUE_TEMPLATE 01_BUG_REPORT.md 02_FEATURE_REQUEST.md 03_CODEBASE_IMPROVEMENT.md 04_SUPPORT_QUESTION.md config.yml PULL_REQUEST_TEMPLATE.md workflows build.yml deploy-to-console.yml lock.yml stale.yml README.md contract README.md babel.config.json build.sh check-deploy.sh deploy.sh package-lock.json package.json src contract.ts tsconfig.json docs CODE_OF_CONDUCT.md CONTRIBUTING.md SECURITY.md frontend .env .eslintrc.json .prettierrc.json contracts contract.ts greeting-contract.ts next-env.d.ts next.config.js package-lock.json package.json pages api hello.ts postcss.config.js public next.svg thirteen.svg vercel.svg styles globals.css tailwind.config.js tsconfig.json integration-tests package-lock.json package.json src main.ava.ts package-lock.json package.json
<h1 align="center"> <a href="https://github.com/near/boilerplate-template"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/near/boilerplate-template/main/docs/images/pagoda_logo_light.png"> <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/near/boilerplate-template/main/docs/images/pagoda_logo_dark.png"> <img alt="" src="https://raw.githubusercontent.com/near/boilerplate-template/main/docs/images/pagoda_logo_dark.png"> </picture> </a> </h1> <div align="center"> Boilerplate Template React <br /> <br /> <a href="https://github.com/near/boilerplate-template/issues/new?assignees=&labels=bug&template=01_BUG_REPORT.md&title=bug%3A+">Report a Bug</a> · <a href="https://github.com/near/boilerplate-template/issues/new?assignees=&labels=enhancement&template=02_FEATURE_REQUEST.md&title=feat%3A+">Request a Feature</a> . <a href="https://github.com/near/boilerplate-template/issues/new?assignees=&labels=question&template=04_SUPPORT_QUESTION.md&title=support%3A+">Ask a Question</a> </div> <div align="center"> <br /> [![Pull Requests welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg?style=flat-square)](https://github.com/near/boilerplate-template/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) [![code with love by near](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-near-ff1414.svg?style=flat-square)](https://github.com/near) </div> <details open="open"> <summary>Table of Contents</summary> - [Getting Started](#getting-started) - [Prerequisites](#prerequisites) - [Installation](#installation) - [Usage](#usage) - [Exploring The Code](#exploring-the-code) - [Deploy](#deploy) - [Step 0: Install near-cli (optional)](#step-0-install-near-cli-optional) - [Step 1: Create an account for the contract](#step-1-create-an-account-for-the-contract) - [Step 2: deploy the contract](#step-2-deploy-the-contract) - [Step 3: set contract name in your frontend code](#step-3-set-contract-name-in-your-frontend-code) - [Troubleshooting](#troubleshooting) - [Deploy on Vercel](#deploy-on-vercel) - [Roadmap](#roadmap) - [Support](#support) - [Project assistance](#project-assistance) - [Contributing](#contributing) - [Authors \& contributors](#authors--contributors) - [Security](#security) </details> --- ## About This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) and [`tailwindcss`](https://tailwindcss.com/docs/guides/nextjs) created for easy-to-start as a React skeleton template in the Pagoda Gallery. Smart-contract was initialized with [create-near-app]. Use this template and start to build your own gallery project! ### Built With [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app), [`tailwindcss`](https://tailwindcss.com/docs/guides/nextjs), [`tailwindui`](https://tailwindui.com/), [`@headlessui/react`](https://headlessui.com/), [`@heroicons/react`](https://heroicons.com/), [create-near-app], [`amazing-github-template`](https://github.com/dec0dOS/amazing-github-template) Getting Started ================== ### Prerequisites Make sure you have a [current version of Node.js](https://nodejs.org/en/about/releases/) installed – we are targeting versions `18>`. Read about other [prerequisites](https://docs.near.org/develop/prerequisites) in our docs. ### Installation Install all dependencies: npm install Build your contract: npm run build Deploy your contract to TestNet with a temporary dev account: npm run deploy Usage ===== Start your frontend in development mode: npm run dev Start your frontend in production mode: npm run start Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. Test your contract: npm run test Exploring The Code ================== 1. The smart-contract code lives in the `/contract` folder. See the README there for more info. In blockchain apps the smart contract is the "backend" of your app. 2. The frontend code lives in the `/frontend` folder. You can start editing the page by modifying `frontend/pages/index.tsx`. The page auto-updates as you edit the file. This is your entrypoint to learn how the frontend connects to the NEAR blockchain. 3. Test your contract (must use node v16): `npm test`, this will run the tests in `integration-tests` directory. 4. [API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `frontend/pages/api/hello.ts`. 5. The `frontend/pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. 6. This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `npm run deploy`, your smart contract gets deployed to the live NEAR TestNet with a temporary dev account. When you're ready to make it permanent, here's how: Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `npm install`, but for best ergonomics you may want to install it globally: npm install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `near-blank-project.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `near-blank-project.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account near-blank-project.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: deploy the contract --------------------------- Use the CLI to deploy the contract to TestNet with your account ID. Replace `PATH_TO_WASM_FILE` with the `wasm` that was generated in `contract` build directory. near deploy --accountId near-blank-project.YOUR-NAME.testnet --wasmFile PATH_TO_WASM_FILE Step 3: set contract name in your frontend code ----------------------------------------------- Modify `NEXT_PUBLIC_CONTRACT_NAME` in `frontend/.env.local` that sets the account name of the contract. Set it to the account id you used above. NEXT_PUBLIC_CONTRACT_NAME=near-blank-project.YOUR-NAME.testnet Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [create-next-app]: https://github.com/vercel/next.js/tree/canary/packages/create-next-app [Node.js]: https://nodejs.org/en/download/package-manager [tailwindcss]: https://tailwindcss.com/docs/guides/nextjs [create-near-app]: https://github.com/near/create-near-app [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/concepts/basics/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! ## Deploy on Vercel The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. ## Roadmap See the [open issues](https://github.com/near/boilerplate-template/issues) for a list of proposed features (and known issues). - [Top Feature Requests](https://github.com/near/boilerplate-template/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc) (Add your votes using the 👍 reaction) - [Top Bugs](https://github.com/near/boilerplate-template/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc) (Add your votes using the 👍 reaction) - [Newest Bugs](https://github.com/near/boilerplate-template/issues?q=is%3Aopen+is%3Aissue+label%3Abug) ## Support Reach out to the maintainer: - [GitHub issues](https://github.com/near/boilerplate-template/issues/new?assignees=&labels=question&template=04_SUPPORT_QUESTION.md&title=support%3A+) ## Project assistance If you want to say **thank you** or/and support active development of Boilerplate Template React: - Add a [GitHub Star](https://github.com/near/boilerplate-template) to the project. - Tweet about the Boilerplate Template React. - Write interesting articles about the project on [Dev.to](https://dev.to/), [Medium](https://medium.com/) or your personal blog. Together, we can make Boilerplate Template React **better**! ## Contributing First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are **greatly appreciated**. Please read [our contribution guidelines](docs/CONTRIBUTING.md), and thank you for being involved! ## Authors & contributors The original setup of this repository is by [Dmitriy Sheleg](https://github.com/shelegdmitriy). For a full list of all authors and contributors, see [the contributors page](https://github.com/near/boilerplate-template/contributors). ## Security Boilerplate Template React follows good practices of security, but 100% security cannot be assured. Boilerplate Template React is provided **"as is"** without any **warranty**. Use at your own risk. _For more information and to report security issues, please refer to our [security documentation](docs/SECURITY.md)._ # Hello NEAR Contract The smart contract exposes two methods to enable storing and retrieving a greeting in the NEAR network. ```ts @NearBindgen({}) class HelloNear { greeting: string = "Hello"; @view // This method is read-only and can be called for free get_greeting(): string { return this.greeting; } @call // This method changes the state, for which it cost gas set_greeting({ greeting }: { greeting: string }): void { // Record a log permanently to the blockchain! near.log(`Saving greeting ${greeting}`); this.greeting = greeting; } } ``` <br /> # Quickstart 1. Make sure you have installed [node.js](https://nodejs.org/en/download/package-manager/) >= 16. 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash npm run deploy ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # e.g. dev-1659899566943-21539992274727 ``` <br /> ## 2. Retrieve the Greeting `get_greeting` is a read-only method (aka `view` method). `View` methods can be called for **free** by anyone, even people **without a NEAR account**! ```bash # Use near-cli to get the greeting near view <dev-account> get_greeting ``` <br /> ## 3. Store a New Greeting `set_greeting` changes the contract's state, for which it is a `call` method. `Call` methods can only be invoked using a NEAR account, since the account needs to pay GAS for the transaction. ```bash # Use near-cli to set a new greeting near call <dev-account> set_greeting '{"greeting":"howdy"}' --accountId <dev-account> ``` **Tip:** If you would like to call `set_greeting` using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`.
NEARBuilders_embeds
.github workflows release-mainnet.yml release-testnet.yml README.md aliases.mainnet.json aliases.testnet.json bos.config.json data.json package-lock.json package.json
# embeds.near ## Getting started 1. Install packages ```cmd yarn install ``` 2. Start dev environment ```cmd yarn run dev ``` This will start a gateway at [127.0.0.1:8080](http://127.0.0.1:8080) which will render your local widgets. The entry point for this app is [embeds.near/widget/Feed](http://127.0.0.1:8080/embeds.near/widget/Feed)
iLifetruth_near-workspace-test
Cargo.toml README-Gitpod.md README-Windows.md README.md borsh.js frontend App.js config.js index.html index.js integration-tests rs Cargo.toml src tests.rs ts main.ava.ts package.json src lib.rs
Status Message Forked from https://github.com/near-examples/rust-status-message ============== <!-- MAGIC COMMENT: DO NOT DELETE! Everything above this line is hidden on NEAR Examples page --> This smart contract saves and records the status messages of NEAR accounts that call it. Windows users: please visit the [Windows-specific README file](README-Windows.md). ## Prerequisites Ensure `near-cli` is installed by running: ``` near --version ``` If needed, install `near-cli`: ``` npm install near-cli -g ``` Ensure `Rust` is installed by running: ``` rustc --version ``` If needed, install `Rust`: ``` curl https://sh.rustup.rs -sSf | sh ``` Install dependencies ``` npm install ``` ## Quick Start To run this project locally: 1. Prerequisites: Make sure you have Node.js ≥ 12 installed (https://nodejs.org), then use it to install yarn: `npm install --global yarn` (or just `npm i -g yarn`) 2. Run the local development server: `yarn && yarn dev` (see package.json for a full list of scripts you can run with yarn) Now you'll have a local development environment backed by the NEAR TestNet! Running yarn dev will tell you the URL you can visit in your browser to see the app. ## Building this contract To make the build process compatible with multiple operating systems, the build process exists as a script in `package.json`. There are a number of special flags used to compile the smart contract into the wasm file. Run this command to build and place the wasm file in the `res` directory: ```bash npm run build ``` **Note**: Instead of `npm`, users of [yarn](https://yarnpkg.com) may run: ```bash yarn build ``` ### Important If you encounter an error similar to: >note: the `wasm32-unknown-unknown` target may not be installed Then run: ```bash rustup target add wasm32-unknown-unknown ``` ## Using this contract ### Web app Deploy the smart contract to a specific account created with the NEAR Wallet. Then interact with the smart contract using near-api-js on the frontend. If you do not have a NEAR account, please create one with [NEAR Wallet](https://wallet.testnet.near.org). Make sure you have credentials saved locally for the account you want to deploy the contract to. To perform this run the following `near-cli` command: ``` near login ``` Deploy the contract to your NEAR account: ```bash near deploy --wasmFile res/status_message.wasm --accountId YOUR_ACCOUNT_NAME ``` Build the frontend: ```bash npm start ``` If all is successful the app should be live at `localhost:1234`! ### Quickest deploy Build and deploy this smart contract to an development account. This development account will be created automatically and is not intended to be permanent. Please see the "Standard deploy" section for creating a more personalized account to deploy to. ```bash near dev-deploy --wasmFile res/status_message.wasm --helperUrl https://near-contract-helper.onrender.com ``` Behind the scenes, this is creating an account and deploying a contract to it. On the console, notice a message like: >Done deploying to dev-1234567890123 In this instance, the account is `dev-1234567890123`. A file has been created containing the key to the account, located at `neardev/dev-account`. To make the next few steps easier, we're going to set an environment variable containing this development account id and use that when copy/pasting commands. Run this command to the environment variable: ```bash source neardev/dev-account.env ``` You can tell if the environment variable is set correctly if your command line prints the account name after this command: ```bash echo $CONTRACT_NAME ``` The next command will call the contract's `set_status` method: ```bash near call $CONTRACT_NAME set_status '{"message": "aloha!"}' --accountId $CONTRACT_NAME ``` To retrieve the message from the contract, call `get_status` with the following: ```bash near view $CONTRACT_NAME get_status '{"account_id": "'$CONTRACT_NAME'"}' ``` ### Standard deploy In this option, the smart contract will get deployed to a specific account created with the NEAR Wallet. If you do not have a NEAR account, please create one with [NEAR Wallet](https://wallet.testnet.near.org). Make sure you have credentials saved locally for the account you want to deploy the contract to. To perform this run the following `near-cli` command: ``` near login ``` Deploy the contract: ```bash near deploy --wasmFile res/status_message.wasm --accountId YOUR_ACCOUNT_NAME ``` Set a status for your account: ```bash near call YOUR_ACCOUNT_NAME set_status '{"message": "aloha friend"}' --accountId YOUR_ACCOUNT_NAME ``` Get the status: ```bash near view YOUR_ACCOUNT_NAME get_status '{"account_id": "YOUR_ACCOUNT_NAME"}' ``` Note that these status messages are stored per account in a `HashMap`. See `src/lib.rs` for the code. We can try the same steps with another account to verify. **Note**: we're adding `NEW_ACCOUNT_NAME` for the next couple steps. There are two ways to create a new account: - the NEAR Wallet (as we did before) - `near create_account NEW_ACCOUNT_NAME --masterAccount YOUR_ACCOUNT_NAME` Now call the contract on the first account (where it's deployed): ```bash near call YOUR_ACCOUNT_NAME set_status '{"message": "bonjour"}' --accountId NEW_ACCOUNT_NAME ``` ```bash near view YOUR_ACCOUNT_NAME get_status '{"account_id": "NEW_ACCOUNT_NAME"}' ``` Returns `bonjour`. Make sure the original status remains: ```bash near view YOUR_ACCOUNT_NAME get_status '{"account_id": "YOUR_ACCOUNT_NAME"}' ``` ## Testing To test run: ```bash cargo test --package status-message -- --nocapture ``` ## building ```bash RUSTFLAGS='-C link-arg=-s' cargo build --all --target wasm32-unknown-unknown --release ``` ## integration-test Rust ```bash cargo run --package rust-status-message-integration-tests --example integration-tests --all-features ```
jackytank_near-food-marketplace
README.md package.json public index.html manifest.json robots.txt smartcontract README.md asconfig.json assembly as_types.d.ts index.ts model.ts tsconfig.json package-lock.json package.json src App.css App.js App.test.js components Wallet.js marketplace AddProduct.js Product.js Products.js utils Cover.js Loader.js Notifications.js index.css index.js logo.svg reportWebVitals.js setupTests.js utils config.js marketplace.js near.js
# Prerequsities Install the next tools: * `node` * `yarn` * `near-cli` Also, you'd need a code editor of choice. In this course we are going to use Visual Studio Code. ## Create project structure The next directories and files must be created to proceed with smart contracts: * assembly/ - this directory contains smart contracts source code * asconfig.json - contains most of configuration properties * assembly/tsconfig.json ### `assembly/asconfig.json` By default it's needed to add the next content to the file. By adding this, we just extend the configuration provided by `near-sdk-as`. ``` { "extends": "near-sdk-as/asconfig.json" } ``` ### `assembly/tsconfig.json` The purpose of this file is to specify compiler options and root level files that are necessary for a TypeScript project to be compiled. Also, this file implies that the directory where `tsconfig.json` is located is the root of the TypeScript project. ``` { "extends": "../node_modules/assemblyscript/std/assembly.json", "include": [ "./**/*.ts" ] } ``` ### `as_types.d.ts` This files declares that some type names must be included in the compilation. In this case, names are imported from `near-sdk-as` ``` /// <reference types="near-sdk-as/assembly/as_types" /> ``` ## Initialize project Run the next commands in a terminal window (in the project's root): ``` yarn init ``` It will create a `package.json` file where development dependencies can be added. Run the next command to add `near-sdk-as` to the project: ``` yarn add -D near-sdk-as ``` The next step is to create an entry file for the smart contract - create `index.ts` file in the `assembly` directory. The resulting project structure should be like this: ``` ├── asconfig.json ├── assembly │   ├── as_types.d.ts │   ├── index.ts │   └── tsconfig.json ├── package.json └── yarn.lock ``` # Compile, build and deployt the smart contract ## Compile & build a smart contract Before a smart contract can be deployed, it must be built as `.wasm`. To do that, the next command should be run from the project's root: ``` yarn asb ``` The output of this command is a `.wasm` file that is placed into `${PROJECT_ROOT}/build/release` directory. ## Login to an account in a shell In order to deploy a contract from via terminal, account's credentials are needed. To get the credentials, run the next command in a terminal window: ``` near login ``` It opens a wallet url in a browser where you can login to your account (or selected one of the existing accounts if you have one). As the result the session in the terminal window is authenticated and you can start deploying contracts and view/call functions. ## Deploy a smart contract To deploy a smart contract, run the next command from in a terminal window: ``` near deploy ${PATH_TO_WASM} --accountId=${ACCOUNT_NAME} ``` where: * `${ACCOUNT_NAME}` - an account name that should be used to deploy a smart contract * `${CONTRACT_NAME}` - an account name that should be used for the contract (we will use the same value as for `${ACCOUNT_NAME}`) * `${PATH_TO_WASM}` - a path to the `.wasm` file issued by the `yarn asb` command - `${PROJECT_ROOT}/build/release/some_name.wasm` ## Contract interaction There are two types of functions in `near`: * `view` functions are used to read state hence they are free. Nothing is modified/persisted when a `view` function is called. * `call` functions are used to modify state of the data stored in the blockchain. The app is hosted here: [https://near-food-store.vercel.app/](https://near-food-store.vercel.app/) # Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `yarn start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.\ You will also see any lint errors in the console. ### `yarn test` Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `yarn build` Builds the app for production to the `build` folder.\ It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.\ Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `yarn eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) ### Analyzing the Bundle Size This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) ### Making a Progressive Web App This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) ### Advanced Configuration This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) ### Deployment This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) ### `yarn build` fails to minify This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
Learn-NEAR-Club_be_positive_public
contract .rustfmt.toml Cargo.toml compile.js src lib.rs standards .cargo_vcs_info.json Cargo.toml README.md src fungible_token core.rs core_impl.rs macros.rs metadata.rs mod.rs receiver.rs resolver.rs storage_impl.rs lib.rs non_fungible_token approval approval_impl.rs approval_receiver.rs mod.rs core core_impl.rs mod.rs receiver.rs resolver.rs enumeration enumeration_impl.rs mod.rs macros.rs metadata.rs mod.rs token.rs utils.rs storage_management mod.rs upgrade mod.rs logo.svg package.json
# NEAR library for Rust contract standards This cargo provides a set of interfaces and implementations for NEAR's contract standards: - Upgradability - Fungible Token (NEP-141). See [example usage](../examples/fungible-token) ## Changelog ### `3.1.1` - Fixed FT macro compilation for Rust `1.51.0`
JILeXanDR_nearcoffee
.env README.md contract Cargo.toml build.sh src coffee.rs interface.rs lib.rs profile.rs utils.rs tests sim main.rs netlify.toml package.json postcss.config.js src assets logo.svg config.ts index.css index.html near.adapter.ts static.ts utils.ts tailwind.config.js tsconfig.json
# Buy me a coffee in NEAR ## development - to be able to get some coffee need to submit new account, for this is needed: - click to "login with NEAR" - it includes single contract written in Rust ### design - use NEAR logo on a cap of coffee! ## Usage ### Setup ```shell export CONTRACT=dev-1618250281091-9032689 export ACCOUNT_ID=jilexandr.testnet ``` ### Commands ```shell # Init state near call $CONTRACT new '{"owner_id": "jilexandr.testnet"}' --accountId $ACCOUNT_ID ``` ```shell # Buy coffee near call $CONTRACT buy_one_coffee_for '{"account_id": "jilexandr.testnet"}' --accountId $ACCOUNT_ID --amount 0.2 ``` ```shell # Get supporters of profile near call $CONTRACT who_bought_coffee_for '{"account_id": "jilexandr.testnet"}' --accountId $ACCOUNT_ID ``` ```shell # Create profile near call $CONTRACT create_profile '{"account_id": "jilexandr.testnet"}' --accountId $ACCOUNT_ID ``` ```shell # Get profile near call $CONTRACT get_profile_of '{"account_id": "jilexandr.testnet"}' --accountId $ACCOUNT_ID ``` ```shell # Update profile near call $CONTRACT update_profile '{"account_id": "jilexandr.testnet", "description": "test"}' --accountId $ACCOUNT_ID ``` ```shell # Swap coffee near call $CONTRACT swap_coffee '{}' --accountId $ACCOUNT_ID ``` ```shell # Withdraw fees near call $CONTRACT withdraw_fees '{}' --accountId $ACCOUNT_ID ``` ```shell # Get all profiles near call $CONTRACT get_all_profiles '{}' --accountId $ACCOUNT_ID ``` ## TODO: - [ ] MVP - [ ] Add contract owner when init contract - [ ] Make debug action (only for contract owner) to get current state. Just serialize whole contract struct as JSON? - [ ] Deploy contract to testnet (coffee.testnet or coffees.testnet) - [ ] `call $CONTRACT get_stats '{"account_id": "jilexandr.testnet"}' --accountId $ACCOUNT_ID`
Motzart_vesing-test
README.md declaration.d.ts package.json public index.html manifest.json robots.txt src config.ts hooks useLockup.ts useTokenBalance.ts useUserLockups.ts index.html services NearWallet.ts account.ts ft-contract.ts near.ts setupTests.ts state app.ts near.ts utils near-utils.ts numbers.ts time.ts tsconfig.json
# Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `yarn start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.\ You will also see any lint errors in the console. ### `yarn test` Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `yarn build` Builds the app for production to the `build` folder.\ It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.\ Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `yarn eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/).
mammothtraining_JavaScript-Smart-Contract-NEAR
hello-near .gitpod.yml README.md contract README.md babel.config.json build.sh build builder.c code.h hello_near.js methods.h deploy.sh neardev dev-account.env package-lock.json package.json src contract.ts tsconfig.json frontend assets global.css logo-black.svg logo-white.svg index.html index.js near-interface.js near-wallet.js package-lock.json package.json start.sh integration-tests package-lock.json package.json src main.ava.ts package-lock.json package.json
near-blank-project ================== This app was initialized with [create-near-app] Quick Start =========== If you haven't installed dependencies during setup: npm install Build and deploy your contract to TestNet with a temporary dev account: npm run deploy Test your contract: npm test If you have a frontend, run `npm start`. This will run a dev server. Exploring The Code ================== 1. The smart-contract code lives in the `/contract` folder. See the README there for more info. In blockchain apps the smart contract is the "backend" of your app. 2. The frontend code lives in the `/frontend` folder. `/frontend/index.html` is a great place to start exploring. Note that it loads in `/frontend/index.js`, this is your entrypoint to learn how the frontend connects to the NEAR blockchain. 3. Test your contract: `npm test`, this will run the tests in `integration-tests` directory. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `npm run deploy`, your smart contract gets deployed to the live NEAR TestNet with a temporary dev account. When you're ready to make it permanent, here's how: Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `npm install`, but for best ergonomics you may want to install it globally: npm install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `near-blank-project.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `near-blank-project.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account near-blank-project.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: deploy the contract --------------------------- Use the CLI to deploy the contract to TestNet with your account ID. Replace `PATH_TO_WASM_FILE` with the `wasm` that was generated in `contract` build directory. near deploy --accountId near-blank-project.YOUR-NAME.testnet --wasmFile PATH_TO_WASM_FILE Step 3: set contract name in your frontend code ----------------------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'near-blank-project.YOUR-NAME.testnet' Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/concepts/basics/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli [gh-pages]: https://github.com/tschaub/gh-pages # Hello NEAR Contract The smart contract exposes two methods to enable storing and retrieving a greeting in the NEAR network. ```ts @NearBindgen({}) class HelloNear { greeting: string = "Hello"; @view // This method is read-only and can be called for free get_greeting(): string { return this.greeting; } @call // This method changes the state, for which it cost gas set_greeting({ greeting }: { greeting: string }): void { // Record a log permanently to the blockchain! near.log(`Saving greeting ${greeting}`); this.greeting = greeting; } } ``` <br /> # Quickstart 1. Make sure you have installed [node.js](https://nodejs.org/en/download/package-manager/) >= 16. 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash npm run deploy ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # e.g. dev-1659899566943-21539992274727 ``` <br /> ## 2. Retrieve the Greeting `get_greeting` is a read-only method (aka `view` method). `View` methods can be called for **free** by anyone, even people **without a NEAR account**! ```bash # Use near-cli to get the greeting near view <dev-account> get_greeting ``` <br /> ## 3. Store a New Greeting `set_greeting` changes the contract's state, for which it is a `call` method. `Call` methods can only be invoked using a NEAR account, since the account needs to pay GAS for the transaction. ```bash # Use near-cli to set a new greeting near call <dev-account> set_greeting '{"greeting":"howdy"}' --accountId <dev-account> ``` **Tip:** If you would like to call `set_greeting` using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`.
OlexandrSai_NEAR--mail-frontend
README.md babel.config.js contract NCD--messagebox contract as-pect.config.js asconfig.json assembly __tests__ as-pect.d.ts main.spec.ts as_types.d.ts index.ts tsconfig.json utils.ts compile.js package-lock.json package.json documentation.md neardev dev-account.env package-lock.json package.json readme.md src config.js testcase.md package-lock.json package.json postcss.config.js public index.html src composables near.js index.css main.js router index.js services near.js store store.js tailwind.config.js
# near-mail-frontend ## Project setup ``` npm install ``` ### Compiles and hot-reloads for development ``` npm run serve ``` ### Compiles and minifies for production ``` npm run build ``` ### Lints and fixes files ``` npm run lint ``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/).
kaanarslan1990_patika-near
README.md aasignment.md as-pect.config.js asconfig.json package-lock.json package.json scripts 1.dev-deploy.sh 2.use-contract.sh 3.cleanup.sh README.md src as_types.d.ts simple __tests__ as-pect.d.ts index.unit.spec.ts asconfig.json assembly index.ts singleton __tests__ as-pect.d.ts index.unit.spec.ts asconfig.json assembly index.ts tsconfig.json utils.ts
## Setting up your terminal The scripts in this folder are designed to help you demonstrate the behavior of the contract(s) in this project. It uses the following setup: ```sh # set your terminal up to have 2 windows, A and B like this: ┌─────────────────────────────────┬─────────────────────────────────┐ │ │ │ │ │ │ │ A │ B │ │ │ │ │ │ │ └─────────────────────────────────┴─────────────────────────────────┘ ``` ### Terminal **A** *This window is used to compile, deploy and control the contract* - Environment ```sh export CONTRACT= # depends on deployment export OWNER= # any account you control # for example # export CONTRACT=dev-1615190770786-2702449 # export OWNER=sherif.testnet ``` - Commands _helper scripts_ ```sh 1.dev-deploy.sh # helper: build and deploy contracts 2.use-contract.sh # helper: call methods on ContractPromise 3.cleanup.sh # helper: delete build and deploy artifacts ``` ### Terminal **B** *This window is used to render the contract account storage* - Environment ```sh export CONTRACT= # depends on deployment # for example # export CONTRACT=dev-1615190770786-2702449 ``` - Commands ```sh # monitor contract storage using near-account-utils # https://github.com/near-examples/near-account-utils watch -d -n 1 yarn storage $CONTRACT ``` --- ## OS Support ### Linux - The `watch` command is supported natively on Linux - To learn more about any of these shell commands take a look at [explainshell.com](https://explainshell.com) ### MacOS - Consider `brew info visionmedia-watch` (or `brew install watch`) ### Windows - Consider this article: [What is the Windows analog of the Linux watch command?](https://superuser.com/questions/191063/what-is-the-windows-analog-of-the-linuo-watch-command#191068) # `near-sdk-as` Starter Kit This is a good project to use as a starting point for your AssemblyScript project. ## Samples This repository includes a complete project structure for AssemblyScript contracts targeting the NEAR platform. The example here is very basic. It's a simple contract demonstrating the following concepts: - a single contract - the difference between `view` vs. `change` methods - basic contract storage There are 2 AssemblyScript contracts in this project, each in their own folder: - **simple** in the `src/simple` folder - **singleton** in the `src/singleton` folder ### Simple We say that an AssemblyScript contract is written in the "simple style" when the `index.ts` file (the contract entry point) includes a series of exported functions. In this case, all exported functions become public contract methods. ```ts // return the string 'hello world' export function helloWorld(): string {} // read the given key from account (contract) storage export function read(key: string): string {} // write the given value at the given key to account (contract) storage export function write(key: string, value: string): string {} // private helper method used by read() and write() above private storageReport(): string {} ``` ### Singleton We say that an AssemblyScript contract is written in the "singleton style" when the `index.ts` file (the contract entry point) has a single exported class (the name of the class doesn't matter) that is decorated with `@nearBindgen`. In this case, all methods on the class become public contract methods unless marked `private`. Also, all instance variables are stored as a serialized instance of the class under a special storage key named `STATE`. AssemblyScript uses JSON for storage serialization (as opposed to Rust contracts which use a custom binary serialization format called borsh). ```ts @nearBindgen export class Contract { // return the string 'hello world' helloWorld(): string {} // read the given key from account (contract) storage read(key: string): string {} // write the given value at the given key to account (contract) storage @mutateState() write(key: string, value: string): string {} // private helper method used by read() and write() above private storageReport(): string {} } ``` ## Usage ### Getting started (see below for video recordings of each of the following steps) INSTALL `NEAR CLI` first like this: `npm i -g near-cli` 1. clone this repo to a local folder 2. run `yarn` 3. run `./scripts/1.dev-deploy.sh` 3. run `./scripts/2.use-contract.sh` 4. run `./scripts/2.use-contract.sh` (yes, run it to see changes) 5. run `./scripts/3.cleanup.sh` ### Videos **`1.dev-deploy.sh`** This video shows the build and deployment of the contract. [![asciicast](https://asciinema.org/a/409575.svg)](https://asciinema.org/a/409575) **`2.use-contract.sh`** This video shows contract methods being called. You should run the script twice to see the effect it has on contract state. [![asciicast](https://asciinema.org/a/409577.svg)](https://asciinema.org/a/409577) **`3.cleanup.sh`** This video shows the cleanup script running. Make sure you add the `BENEFICIARY` environment variable. The script will remind you if you forget. ```sh export BENEFICIARY=<your-account-here> # this account receives contract account balance ``` [![asciicast](https://asciinema.org/a/409580.svg)](https://asciinema.org/a/409580) ### Other documentation - See `./scripts/README.md` for documentation about the scripts - Watch this video where Willem Wyndham walks us through refactoring a simple example of a NEAR smart contract written in AssemblyScript https://youtu.be/QP7aveSqRPo ``` There are 2 "styles" of implementing AssemblyScript NEAR contracts: - the contract interface can either be a collection of exported functions - or the contract interface can be the methods of a an exported class We call the second style "Singleton" because there is only one instance of the class which is serialized to the blockchain storage. Rust contracts written for NEAR do this by default with the contract struct. 0:00 noise (to cut) 0:10 Welcome 0:59 Create project starting with "npm init" 2:20 Customize the project for AssemblyScript development 9:25 Import the Counter example and get unit tests passing 18:30 Adapt the Counter example to a Singleton style contract 21:49 Refactoring unit tests to access the new methods 24:45 Review and summary ``` ## The file system ```sh ├── README.md # this file ├── as-pect.config.js # configuration for as-pect (AssemblyScript unit testing) ├── asconfig.json # configuration for AssemblyScript compiler (supports multiple contracts) ├── package.json # NodeJS project manifest ├── scripts │   ├── 1.dev-deploy.sh # helper: build and deploy contracts │   ├── 2.use-contract.sh # helper: call methods on ContractPromise │   ├── 3.cleanup.sh # helper: delete build and deploy artifacts │   └── README.md # documentation for helper scripts ├── src │   ├── as_types.d.ts # AssemblyScript headers for type hints │   ├── simple # Contract 1: "Simple example" │   │   ├── __tests__ │   │   │   ├── as-pect.d.ts # as-pect unit testing headers for type hints │   │   │   └── index.unit.spec.ts # unit tests for contract 1 │   │   ├── asconfig.json # configuration for AssemblyScript compiler (one per contract) │   │   └── assembly │   │   └── index.ts # contract code for contract 1 │   ├── singleton # Contract 2: "Singleton-style example" │   │   ├── __tests__ │   │   │   ├── as-pect.d.ts # as-pect unit testing headers for type hints │   │   │   └── index.unit.spec.ts # unit tests for contract 2 │   │   ├── asconfig.json # configuration for AssemblyScript compiler (one per contract) │   │   └── assembly │   │   └── index.ts # contract code for contract 2 │   ├── tsconfig.json # Typescript configuration │   └── utils.ts # common contract utility functions └── yarn.lock # project manifest version lock ``` You may clone this repo to get started OR create everything from scratch. Please note that, in order to create the AssemblyScript and tests folder structure, you may use the command `asp --init` which will create the following folders and files: ``` ./assembly/ ./assembly/tests/ ./assembly/tests/example.spec.ts ./assembly/tests/as-pect.d.ts ```
GoldenEagle1035_marketplace-api_NEAR
.gitlab-ci.yml .vscode c_cpp_properties.json app controllers Albums.js Auth.js Followers.js Marketplace.js Near.js NominationVotes.js Nominations.js Playlists.js PlaylistsSongs.js Search.js Showcases.js Songs.js Transactions.js Transfer.js Upload.js UserNFT.js Users.js lib cron.js db.js external-services.js filters.js helper.js near.js passport.js models Album.js Follower.js Nomination.js NominationVote.js Playlist.js PlaylistsSong.js Showcase.js Song.js Transfer.js User.js index.js routes albums.js auth.js followers.js marketplace.js moonpay.js near.js nfts.js nomination-votes.js nominations.js playlists-songs.js playlists.js search.js showcases.js songs.js transactions.js transfers.js uploads.js users.js knexfile.js migrations 20210510111634_User.js 20210511134544_publicKey.js 20210517104752_AlbumSOngs.js 20210517112700_albumQty.js 20210603142153_cid.js 20210604123353_newFields.js 20210604131006_fileCID.js 20210604163032_txn_hash.js 20210608161243_songUsedId.js 20210615160447_Readdqty.js 20210616124423_AlbumOwnedBy.js 20210616125014_SongsOwnedBy.js 20210616143157_removeSongowerid.js 20210622135329_playlist.js 20210622145720_Showcase.js 20210622180245_nominate.js 20210623122207_NominationQueue.js 20210623124951_nominationQueueId.js 20210623183926_mintCopies.js 20210628150207_songsQty.js 20210628152436_Price.js 20210629164224_Transfers.js 20210630170112_artisttype.js 20210707121342_near_in_yocto.js 20210708163338_isPurchased.js 20210708163812_isPurchasedSong.js 20210715164602_transactionType.js 20210719160404_is_owner.js 20210719162446_bidding_price.js 20210719162831_isForSale.js 20210728160802_followers.js 20210802193835_nominationVotes.js 20210802195459_queue.js 20210802203421_RemoveNotificationQuueTable.js 20210806153553_removeYoctoNear.js 20210811124826_yoctoNear.js 20210825131425_nearAmount.js 20211007151154_minting_cost.js 20211012171822_near_account_type.js package.json pinata.js server.js
lubkoll_near-simplified-nft
.github dependabot.yml scripts readme-quick-deploy.sh workflows readme-ci.yml tests.yml .gitpod.yml Cargo.toml README-Windows.md README.md integration-tests rs Cargo.toml src tests.rs ts package.json src main.ava.ts utils.ts nft Cargo.toml src lib.rs res README.md scripts build.bat build.sh flags.sh test-approval-receiver Cargo.toml src lib.rs test-token-receiver Cargo.toml src lib.rs
# Folder that contains wasm files Non-fungible Token (NFT) =================== >**Note**: If you'd like to learn how to create an NFT contract from scratch that explores every aspect of the [NEP-171](https://github.com/near/NEPs/blob/master/neps/nep-0171.md) standard including an NFT marketplace, check out the NFT [Zero to Hero Tutorial](https://docs.near.org/tutorials/nfts/introduction). [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/near-examples/NFT) This repository includes an example implementation of a [non-fungible token] contract which uses [near-contract-standards] and workspaces-js and -rs tests. [non-fungible token]: https://nomicon.io/Standards/NonFungibleToken/README.html [near-contract-standards]: https://github.com/near/near-sdk-rs/tree/master/near-contract-standards [simulation]: https://github.com/near/near-sdk-rs/tree/master/near-sdk-sim Prerequisites ============= If you're using Gitpod, you can skip this step. * Make sure Rust is installed per the prerequisites in [`near-sdk-rs`](https://github.com/near/near-sdk-rs). * Make sure [near-cli](https://github.com/near/near-cli) is installed. Explore this contract ===================== The source for this contract is in `nft/src/lib.rs`. It provides methods to manage access to tokens, transfer tokens, check access, and get token owner. Note, some further exploration inside the rust macros is needed to see how the `NonFungibleToken` contract is implemented. Building this contract ====================== Run the following, and we'll build our rust project up via cargo. This will generate our WASM binaries into our `res/` directory. This is the smart contract we'll be deploying onto the NEAR blockchain later. ```bash ./scripts/build.sh ``` Testing this contract ===================== We have some tests that you can run. For example, the following will run our simple tests to verify that our contract code is working. *Unit Tests* ```bash cd nft cargo test -- --nocapture ``` *Integration Tests* *Rust* ```bash cd integration-tests/rs cargo run --example integration-tests ``` *TypeScript* ```bash cd integration-tests/ts yarn && yarn test ``` Using this contract =================== ### Quickest deploy You can build and deploy this smart contract to a development account. [Dev Accounts](https://docs.near.org/concepts/basics/account#dev-accounts) are auto-generated accounts to assist in developing and testing smart contracts. Please see the [Standard deploy](#standard-deploy) section for creating a more personalized account to deploy to. ```bash near dev-deploy --wasmFile res/non_fungible_token.wasm ``` Behind the scenes, this is creating an account and deploying a contract to it. On the console, notice a message like: >Done deploying to dev-1234567890123 In this instance, the account is `dev-1234567890123`. A file has been created containing a key pair to the account, located at `neardev/dev-account`. To make the next few steps easier, we're going to set an environment variable containing this development account id and use that when copy/pasting commands. Run this command to set the environment variable: ```bash source neardev/dev-account.env ``` You can tell if the environment variable is set correctly if your command line prints the account name after this command: ```bash echo $CONTRACT_NAME ``` The next command will initialize the contract using the `new` method: ```bash near call $CONTRACT_NAME new_default_meta '{"owner_id": "'$CONTRACT_NAME'"}' --accountId $CONTRACT_NAME ``` To view the NFT metadata: ```bash near view $CONTRACT_NAME nft_metadata ``` ### Standard deploy This smart contract will get deployed to your NEAR account. For this example, please create a new NEAR account. Because NEAR allows the ability to upgrade contracts on the same account, initialization functions must be cleared. If you'd like to run this example on a NEAR account that has had prior contracts deployed, please use the `near-cli` command `near delete`, and then recreate it in Wallet. To create (or recreate) an account, please follow the directions in [Test Wallet](https://wallet.testnet.near.org) or ([NEAR Wallet](https://wallet.near.org/) if we're using `mainnet`). In the project root, log in to your newly created account with `near-cli` by following the instructions after this command. near login To make this tutorial easier to copy/paste, we're going to set an environment variable for our account id. In the below command, replace `MY_ACCOUNT_NAME` with the account name we just logged in with, including the `.testnet` (or `.near` for `mainnet`): ID=MY_ACCOUNT_NAME We can tell if the environment variable is set correctly if our command line prints the account name after this command: echo $ID Now we can deploy the compiled contract in this example to your account: near deploy --wasmFile res/non_fungible_token.wasm --accountId $ID NFT contract should be initialized before usage. More info about the metadata at [nomicon.io](https://nomicon.io/Standards/NonFungibleToken/Metadata.html). But for now, we'll initialize with the default metadata. near call $ID new_default_meta '{"owner_id": "'$ID'"}' --accountId $ID We'll be able to view our metadata right after: near view $ID nft_metadata Then, let's mint our first token. This will create a NFT based on Olympus Mons where only one copy exists: near call $ID nft_mint '{"token_id": "0", "receiver_id": "'$ID'", "token_metadata": { "title": "Olympus Mons", "description": "Tallest mountain in charted solar system", "media": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Olympus_Mons_alt.jpg/1024px-Olympus_Mons_alt.jpg", "copies": 1}}' --accountId $ID --deposit 0.1 Transferring our NFT ==================== Let's set up an account to transfer our freshly minted token to. This account will be a sub-account of the NEAR account we logged in with originally via `near login`. near create-account alice.$ID --masterAccount $ID --initialBalance 10 Checking Alice's account for tokens: near view $ID nft_tokens_for_owner '{"account_id": "'alice.$ID'"}' Then we'll transfer over the NFT into Alice's account. Exactly 1 yoctoNEAR of deposit should be attached: near call $ID nft_transfer '{"token_id": "0", "receiver_id": "alice.'$ID'", "memo": "transfer ownership"}' --accountId $ID --depositYocto 1 Checking Alice's account again shows us that she has the Olympus Mons token. Notes ===== * The maximum balance value is limited by U128 (2**128 - 1). * JSON calls should pass U128 as a base-10 string. E.g. "100". * This does not include escrow functionality, as ft_transfer_call provides a superior approach. An escrow system can, of course, be added as a separate contract or additional functionality within this contract. AssemblyScript ============== Currently, AssemblyScript is not supported for this example. An old version can be found in the [NEP4 example](https://github.com/near-examples/NFT/releases/tag/nep4-example), but this is not recommended as it is out of date and does not follow the standards the NEAR SDK has set currently. # near-simplified-nft
lhvietanh_Near_first_contract
.rustc_info.json Cargo.toml README.md debug .fingerprint Inflector-c436f7f0ac4cac71 lib-inflector.json ahash-1967cc04c22c18c6 lib-ahash.json ahash-9f755501bff2d7f3 lib-ahash.json aho-corasick-7ba58e1c9363d81e lib-aho_corasick.json aho-corasick-aef40ab8786d64dc lib-aho_corasick.json autocfg-8f6f992da8b6439e lib-autocfg.json base64-63fa1d9b157223de lib-base64.json base64-71c90ac137df990d lib-base64.json block-buffer-352012584a3dc04a lib-block-buffer.json block-buffer-b2b9846559caac65 lib-block-buffer.json block-padding-279c2d138032bc65 lib-block-padding.json block-padding-eda545815dc84a62 lib-block-padding.json borsh-2cf0d73346d821e9 lib-borsh.json borsh-4fbadd31ae6ed8d2 lib-borsh.json borsh-derive-d02156b4aef84eab lib-borsh-derive.json borsh-derive-internal-06820d2a5f0471e5 lib-borsh-derive-internal.json borsh-schema-derive-internal-e1dbeff18203f7f3 lib-borsh-schema-derive-internal.json bs58-1801d0e23fc90040 lib-bs58.json bs58-69a66f084a652b72 lib-bs58.json byteorder-05f1bf91f5cd7369 lib-byteorder.json byteorder-0dac5eb881eb88e7 lib-byteorder.json cfg-if-2079fcd564b2b5d6 lib-cfg-if.json cfg-if-3cd7bda968e519ae lib-cfg-if.json cfg-if-7e74d31581507915 lib-cfg-if.json cfg-if-d11314982639f912 lib-cfg-if.json convert_case-6aefe2f3d987d223 lib-convert_case.json cpufeatures-1cdaf062eab5ab43 lib-cpufeatures.json cpufeatures-6becbfb968b15950 lib-cpufeatures.json derive_more-6e2f7c77cc022ef8 lib-derive_more.json digest-51931e9e5760974c lib-digest.json digest-f97ea15c3fa55aad lib-digest.json generic-array-13d383fe19cd14c1 build-script-build-script-build.json generic-array-402d805d9e6f4512 run-build-script-build-script-build.json generic-array-61990963c9533961 lib-generic_array.json generic-array-c416dfb4c61cd3c9 lib-generic_array.json hashbrown-197b9c5442cfcb9c lib-hashbrown.json hashbrown-3ac20ce16539a84d lib-hashbrown.json hashbrown-62d2794599d0b3a5 lib-hashbrown.json hashbrown-cc0873b95a3962ff lib-hashbrown.json hex-b14a6cc6710b1be9 lib-hex.json hex-f285e0a400276b11 lib-hex.json indexmap-475afac1a9e1ca8f build-script-build-script-build.json indexmap-c136fc4e366c4c99 lib-indexmap.json indexmap-c3ceecb5d2d97613 run-build-script-build-script-build.json indexmap-f1fe4e1860182b1a lib-indexmap.json itoa-19f0d96e674cd7c4 lib-itoa.json itoa-de9eca8b84305685 lib-itoa.json keccak-1e0e12c090d36ea1 lib-keccak.json keccak-9486c3b3fabd92f5 lib-keccak.json lazy_static-13a7b4f24d55cf9a lib-lazy_static.json lazy_static-c4fa5978e157842d lib-lazy_static.json libc-0072008621ac6d0d run-build-script-build-script-build.json libc-144914a8a507d182 lib-libc.json libc-8ce7c811e383a046 lib-libc.json libc-bc4182337eef54a1 build-script-build-script-build.json memchr-1dee02e84714013a lib-memchr.json memchr-3bafc6871b5efe45 build-script-build-script-build.json memchr-db4a21db1af5def4 run-build-script-build-script-build.json memchr-f1c5bc4a07e1927c lib-memchr.json memory_units-50d579d213a1cb67 lib-memory_units.json memory_units-7cdfc6b494713aeb lib-memory_units.json near-primitives-core-b47ae3aafe96261a lib-near-primitives-core.json near-primitives-core-d2320e55cf0e8256 lib-near-primitives-core.json near-rpc-error-core-a1e771bcd770e852 lib-near-rpc-error-core.json near-rpc-error-macro-c4827c64be3b6d54 lib-near-rpc-error-macro.json near-runtime-utils-09b934b9b1ad0a68 lib-near-runtime-utils.json near-runtime-utils-bfcb880744965d85 lib-near-runtime-utils.json near-sdk-b512166b416e028f lib-near-sdk.json near-sdk-cec1a299bb7f124c lib-near-sdk.json near-sdk-core-89a57312ea03706c lib-near-sdk-core.json near-sdk-macros-f51197017590af51 lib-near-sdk-macros.json near-vm-errors-686a99333cd29e8f lib-near-vm-errors.json near-vm-errors-dc7973021d44260b lib-near-vm-errors.json near-vm-logic-a284ef4e7ec16c7d lib-near-vm-logic.json near-vm-logic-df3863cfbee2287f lib-near-vm-logic.json num-bigint-186958ca19d9a588 lib-num-bigint.json num-bigint-3b7cab2399247391 build-script-build-script-build.json num-bigint-5cd94574fdd45f3e run-build-script-build-script-build.json num-bigint-8106ef48a701df5f lib-num-bigint.json num-integer-609e0a1fcc532426 lib-num-integer.json num-integer-8c50ced402ed6480 lib-num-integer.json num-integer-8f58f6b865c60561 build-script-build-script-build.json num-integer-c30481e6d76095af run-build-script-build-script-build.json num-rational-0a35a2b3da4fda0a lib-num-rational.json num-rational-12d836b2f69fc833 build-script-build-script-build.json num-rational-bf38c5e3bd865d02 run-build-script-build-script-build.json num-rational-caa7f8d37b381311 lib-num-rational.json num-traits-4483c96bf8848395 lib-num-traits.json num-traits-7b8441388a5bdb4c build-script-build-script-build.json num-traits-7ebcab3d67bb0c36 run-build-script-build-script-build.json num-traits-cbe7fbf4a83c69fd lib-num-traits.json opaque-debug-0d82ef37e467c2b8 lib-opaque-debug.json opaque-debug-9f33558de634ada2 lib-opaque-debug.json proc-macro-crate-2f5320247de554f3 lib-proc-macro-crate.json proc-macro2-7291bf7eee435204 build-script-build-script-build.json proc-macro2-7e35b434889e2fbc run-build-script-build-script-build.json proc-macro2-ee87d944f41267b3 lib-proc-macro2.json quote-ebcfe88e09cbcf93 lib-quote.json regex-aed4a4cfc02c326f lib-regex.json regex-e6669510fe6264a0 lib-regex.json regex-syntax-55c532d7f6596a1e lib-regex-syntax.json regex-syntax-ef07e97d687779e1 lib-regex-syntax.json rust-counter-tutorial-4644d82e3ec66e2c test-lib-rust-counter-tutorial.json rust-counter-tutorial-579133bd627820d8 test-lib-rust-counter-tutorial.json rust-counter-tutorial-5f4be86c29fd5239 test-lib-rust-counter-tutorial.json rust-counter-tutorial-66b0f1be31d23f2a lib-rust-counter-tutorial.json rust-counter-tutorial-85c5436c9dca145f bin-rust-counter-tutorial.json rust-counter-tutorial-87daacc157d44a6e test-bin-rust-counter-tutorial.json rust-counter-tutorial-979ea918988d9047 test-bin-rust-counter-tutorial.json rust-counter-tutorial-a920e1b9873ca5a6 lib-rust-counter-tutorial.json rust-counter-tutorial-ad1e6c229a71e639 lib-rust-counter-tutorial.json rust-counter-tutorial-b6ee74aedb56a867 lib-rust-counter-tutorial.json rust-counter-tutorial-c89a7b65179aadab test-lib-rust-counter-tutorial.json ryu-52b84e8d03c8c45c lib-ryu.json ryu-7e3518dd7719de0a lib-ryu.json serde-4c138022e7f259ab run-build-script-build-script-build.json serde-6acb4c6fdab2083a lib-serde.json serde-7108713fe6650c46 build-script-build-script-build.json serde-9146155f7d0497f1 lib-serde.json serde_derive-ab1eb1b837683c79 build-script-build-script-build.json serde_derive-e1992cd1fbde908b run-build-script-build-script-build.json serde_derive-f6e3253844f27d51 lib-serde_derive.json serde_json-0fcb613842ab3af9 lib-serde_json.json serde_json-5eeaee0fc99a6b6b build-script-build-script-build.json serde_json-72f60fffb4f0d731 run-build-script-build-script-build.json serde_json-9683d8f76f5e4ceb lib-serde_json.json sha2-bf632ea53973549a lib-sha2.json sha2-df83a03bc5293aab lib-sha2.json sha3-290ffbaf6b841cf2 lib-sha3.json sha3-8142806e64ea8035 lib-sha3.json syn-a2e6dc1d550d999e run-build-script-build-script-build.json syn-b88d4fafaedca86c lib-syn.json syn-c998c8ac30099f7a build-script-build-script-build.json toml-f1f3b043a511c970 lib-toml.json typenum-a1dd6198bef276d8 lib-typenum.json typenum-eba9811536b7659f lib-typenum.json typenum-f3cdf2a7bd3a3e52 build-script-build-script-main.json typenum-f652251080214f38 run-build-script-build-script-main.json unicode-xid-1b6f7ffe825e103f lib-unicode-xid.json version_check-9aa0558631c3a6ad lib-version_check.json wee_alloc-54937a0312c818dc lib-wee_alloc.json wee_alloc-b724ac321ae537f6 build-script-build-script-build.json wee_alloc-e2cb34bd00ad2611 run-build-script-build-script-build.json wee_alloc-f5d5268166f07c50 lib-wee_alloc.json build num-bigint-5cd94574fdd45f3e out radix_bases.rs typenum-f652251080214f38 out consts.rs op.rs tests.rs wee_alloc-e2cb34bd00ad2611 out wee_alloc_static_array_backend_size_bytes.txt lib.rs src lib.rs
# Near_first_contract
nearprotocol_near-reserve
.travis.yml README.md assembly main.ts model.ts tsconfig.json gulpfile.js package.json setup.js src config.js index.html loader.html main.js test-setup.js test.html test.js
# Example of NEAR Wallet integration ## Description This example demonstrates how to integrate your application with NEAR Wallet. The contract is quite simple. It can store the account_id of last sender and return it. It also shows how you can debug contracts using logs. ## To Run *In NEAR Studio (https://studio.nearprotocol.com)* 1. Click the "Run" button on the top of the Studio window 2. You will be redirected to the new window where you can interract with the app. 3. You'd be asked to sign-up with NEAR wallet (https://wallet.nearprotocol.com). If you don't have an account yet, then the wallet asks you to create one. 4. Once you have an account, you would be asked to authorize the application and the contract. 5. Once authorized, you would be redirected back to the application and it would have access to your account ID and be able to issue transactions on behalf of your account. The transactions can only go to the authorized contract and can't include any tokens with them. 6. "Say Hi!" ## To Test *In NEAR Studio (https://studio.nearprotocol.com)* 1. Click the "Test" button on the top of the Studio window 2. You will be redirected to the output for the JavaScript tests described in `src/test.js` to show that the contract is performing properly. ## To Explore - `assembly/main.ts` for the contract code - `src/index.html` for the front-end HTML - `src/main.js` for the JavaScript front-end code and how to integrate contracts - `src/test.js` for the JS tests for the contract
amiyatulu_shivarthu_old
README.md approval-voting Cargo.toml build.js src lib.rs contract Cargo.toml build.js src lib.rs package.json public index.html manifest.json robots.txt sortitionsumtree Cargo.toml build.js src lib.rs src App.css App.js App.test.js index.css index.js logo.svg serviceWorker.js setupTests.js voter-validation Cargo.toml build.js src lib.rs shivarthu.rs shivarthu account.rs token.rs token votervalidation.rs
# Shivarthu ### Decentralized democracy with experts as leaders. https://shivarthu.reaudito.com/#/ Whitepaper https://shivarthu.reaudito.com/paper/Shivarthu_whitepaper.pdf Decentralized Democracy UI https://gateway.ipfs.io/ipfs/QmUTMU4ndH6TpjYZkuES78wDNbMKLr1d2eSjE6SMh4nmwJ/ Video: [![Shivarthu](https://img.youtube.com/vi/JhTgKYNNUjY/0.jpg)](https://www.youtube.com/watch?v=JhTgKYNNUjY "Shivarthu") Build with near protocol blockchain, ipfs and react <p> <img src="https://nearprotocol.com/wp-content/themes/near-19/assets/img/logo.svg?t=1553011311" width="240"> <img src="ipfs.png" height="150"> </p>
noemk2_holamundo_as
README.md as-pect.config.js asconfig.json assembly __tests__ as-pect.d.ts index.spec.ts as_types.d.ts index.ts tsconfig.json package.json
Hola mundo en near con AssemblyScript ================== Introducción a holamundo en near (assemblyScript) ================== un holamundo en near protocol, este contrato te perminte: 1. print "Hello world" 2. print "Hello " + $USER 👨‍💻 Instalación en local =========== Para correr este proyecto en local debes seguir los siguientes pasos: Paso 1: Pre - Requisitos ------------------------------ 1. Asegúrese de haber instalado [Node.js] ≥ 12 ((recomendamos usar [nvm]) 2. Asegúrese de haber instalado yarn: `npm install -g yarn` 3. Instalar dependencias: `yarn install` 4. Crear un test near account [NEAR test account] 5. Instalar el NEAR CLI globally: [near-cli] es una interfaz de linea de comando (CLI) para interacturar con NEAR blockchain yarn install --global near-cli Step 2: Configura tu NEAR CLI ------------------------------- Configura tu near-cli para autorizar su cuenta de prueba creada recientemente: near login Step 3: Clonar Repositorio ------------------------------- Este comando nos permite clonar el repositorio de nuestro proyecto ```bash git clone https://github.com/noemk2/holamundo_as.git ``` Una vez que hayas descargado el repositorio, asegurate de ejecutar los comandos dentro del repositorio descargado. Puedes hacerlo con ```bash cd holamundo_as/ ``` Step 4: Realiza el BUILD para implementación de desarrollo de contrato inteligente ------------------------------------------------------------------------------------ Instale el gestor de dependencia de Node.js dentro del repositorio ```bash npm install ``` Cree el código de contrato inteligente e implemente el servidor de desarrollo local: ```bash yarn deploy:dev ``` Cree la variable local $CONTRACT_NAME (permite guardar tu contrato temporal en una variable facil de recordar) ```bash source ./neardev/dev-account.env ``` Consulte` package.json` para obtener una lista completa de `scripts` que puede ejecutar con` yarn`). Este script le devuelve un contrato inteligente provisional implementado (guárdelo para usarlo más tarde) ¡Felicitaciones, ahora tendrá un entorno de desarrollo local ejecutándose en NEAR TestNet! ✏️ Comando view : request estatico ----------------------------------------------- Permite imprimir "Hello world" Para Linux: ```bash near view $CONTRACT_NAME hello_world --account-id <username>.testnet ``` ✏️ Comando call : request dinamico -------------------------------------------- Permite imprimir "Hello " + username.testnet Para Linux : ```bash near call $CONTRACT_NAME hello --account-id <username>.testnet ``` 🤖 Test ================== Las pruebas son parte del desarrollo, luego, para ejecutar las pruebas en el contrato inteligente , debe ejecutar el siguiente comando: yarn test ============================================== [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [NEAR accounts]: https://docs.near.org/docs/concepts/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli [NEAR test account]: https://docs.near.org/docs/develop/basics/create-account#creating-a-testnet-account [nvm]: https://github.com/nvm-sh/nvm [UX/UI]: https://www.figma.com/proto/GqP5EF5zRZRvAv3HoaSsuN/uniwap?node-id=39%3A2300&scaling=min-zoom&page-id=0%3A1&starting-point-node-id=39%3A2300&hide-ui=1 [UX/UI]: https://www.figma.com/proto/0dZLC0WI1eVsfjeKu3T8J8/Garant%C3%ADzame?node-id=2%3A8&scaling=scale-down-width&page-id=0%3A1&starting-point-node-id=2%3A8
onehumanbeing_WaverFinance
README.md license.md src contract client Cargo.toml build.sh neardev dev-account.env scripts create_strategy.sh data create_buy.json create_grid.json create_sale.json env.sh init.sh oracle_failed.json oracle_test.sh view.sh src lib.rs models.rs util.rs meta Cargo.toml build.sh deploy.sh neardev dev-account.env scripts create_contract.sh env.sh ft_transfer.sh init.json init.sh oracle.json oracle_test.sh storage.sh test_key.json update_ft_config.sh view.sh src constants.rs lib.rs models.rs dapp .eslintrc.json README.md abi mainContract.json assets img icons default-near-icon.svg near-coin.svg ref-coin.svg storage.svg usdc-coin.svg usdt-coin.svg configs near.ts constants client.ts gasFee.ts hooks waver.ts next.config.js package-lock.json package.json pages api hello.ts public manifest.json vercel.svg react-near.json services near common.ts ft.ts metadata.ts near.ts quan-client.ts quan-main.ts rest waver.ts styles Home.module.css tsconfig.json utils digital.ts nearHelper.ts string.ts query charts.py constants.py db.py explorer.py failed.json index.py loop.py loop_start.sh loop_stop.sh parser.py requirements.txt restart.sh rpc.py secret.py start.sh stop.sh success.json trade.py
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). ## Getting Started First, run the development server: ```bash npm run dev # or yarn dev ``` Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. [API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. ## Learn More To learn more about Next.js, take a look at the following resources: - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! ## Deploy on Vercel The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. # Waver Finance Waver Finance is the first decentralized quantitative trading platform on the NEAR protocol. We provide secure, transparent, intelligent, and low-cost quantitative trading services to all users. # Codes * src/contract/client: Waver locked sub-contract for users * src/contract/meta: Waver main contract & ft contract * src/query/index.py: Waver backend query server * src/query/loop.py: Waver oracle request process # Contracts * client contract example [fundsaresafu.ft.waver.testnet](https://explorer.testnet.near.org/accounts/fundsaresafu.ft.waver.testnet) * meta contract example [ft.waver.testnet](https://explorer.testnet.near.org/accounts/ft.waver.testnet) # Transactions Examples Oracle request failed, slippage error: https://explorer.testnet.near.org/transactions/5YSRp5LBSha3YBufZ4SdYiZbMVaMoNqJ9BsQyrUa5AcC Oracle request success: https://explorer.testnet.near.org/transactions/568LGpmQmW2VwWMFj1KNwgjVnhqbBNzQUmZSvzZgTHRG # Project Story ## Inspirations In the early days, the price of NEAR showed periodic fluctuations. During that time, we had the idea of developing a native quantitative trading algorithm on NEAR, this is where the Waver Finance inspiration comes from. However, how to provide users with safe services has become a main challenge, we are afraid of being hacked. Both the oracles that generate transactions and the smart contracts themselves can be attacked, and the risk is super high. We have seen many people deploy a transaction contract provided by others on Ethereum or BSC, and end up losing money because of malicious code. Security incidents are happening on web3 every day. What’s more, on centralized exchanges like Binance, grid trading fees range from 0.54% to 1.10%. Fees are high and funds are not safe. After FTX lost more than $1 billion, we deeply believe that people will lose confidence in centralized platforms and bullish in decentralized platforms. Combining the problem statement we mentioned above, and the recent centralized trading platforms bad news, we think about whether it is possible to provide customers with an absolutely safe trading platform under the context of **zero trust**. So it's our mission to launch Waver Finance. We believe that we can use the design mechanism of the NEAR smart contract to implement a **zero-trust-based** asset custody protocol and build a transparent and secure quantitative trading platform to solve all these problems. &nbsp; &nbsp; ## What it does Waver Finance is the first decentralized quantitative trading platform that provides secure, transparent, intelligent, and low-cost quantitative trading services for all users on the NEAR protocol. Users can use Waver Finance to obtain their locked sub-contracts and send assets to the sub-contracts. Users can create their own strategies to achieve automated trading or grid trading for the escrowed assets. Users only pay for gas and transition fees, and Waver Finance will pay $WAVER for each oracle request. The user's assets are locked on the sub-contract, and only the user can withdraw the funds. Waver Finance has set up independent security mechanisms in both the signature (functionCall access key) and the subcontract (which will verify the oracle request in the contract). Nowadays, **Centralized** trading services hold the dominant power of the transaction. Therefore, *users* bear a huge risk on their assets at any time. **Decentralized** trading platform, on the contrary, not only saves maintenance costs, but also creates a new business model that allows users to win-win with the platform and stand on an equal and transparent position. On the one hand, the platform can reduce customer acquisition costs through the **zero-trust** basis brought by smart contracts, and focus on providing users with financial and other services. On the other hand, users can trust their own assets and enjoy the services brought by the platform. It's a win-win situation, and to achieve the main accomplishment of our project: **security** Here's an overview of the big idea: ![graph](https://raw.githubusercontent.com/onehumanbeing/WaverFinance/master/docs/Waver.png) &nbsp; &nbsp; ## How we built it The 3rd stake battle of NEAR inspired us to build platform-based services. Specifically, the design of the Staking contract and AccessKey license on NEAR gave us the core ideas, and we developed Waver Finance's two main contracts based on them. *waver_meta* is Waver Finance's master contract and FT contract. When a user registers and staked 2 Near, the main contract will deploy a sub-contract *waver_client* for the user, and add signature permissions for the *request* and *storage* functions with a *functionCall* permissions. The *request* function is mainly used for oracle machine calls, and the *storage* function is mainly used for token staking registration. At the end of each user's registration, we will airdrop 10 $WAVER to motivate users to explore the service. *waver_client* allows each user to have a unique client contract. If the user's wallet address is *alex.testnet*, he will get a wallet *alex.waver.testnet*. By transferring cryptocurrency assets to this wallet, users can keep their assets in escrow. The client contract stores all trading strategies, and checks the legitimacy of the request for the user based on the strategy ID when the oracle machine submits it. This allows users and oracles to work together with *zero-trust*. Our Dapp & dashboard is built with React.js and next.js. Our backend query server is built with Flask, a micro server written in Python and deployed on AWS. We use a timed process to simulate the flow of automated trading. &nbsp; &nbsp; ## Challenges we ran into It is undeniable that security is the top priority of financial projects. During the trading process, both the oracle machine and the smart contract itself are at risk of being hacked. The core challenge and highlight of Waver Finance is to utilize design of the NEAR smart contract to implement a **zero-trust-based** asset escrow protocol, thereby establishing a transparent and secure quantitative trading platform. Through the multi-keyPair and sub-contract mechanism of the NEAR protocol, Waver Finance guarantees that even if the oracle machine is hacked, the user's assets are absolutely safe. &nbsp; &nbsp; ## Accomplishments that we're proud of Our project leader Henry has been learning NEAR since January, he is the co-founder of Near Tinker Union (NFT project), responsible for the development of all smart contracts. Our team member then started to learn more about the NEAR ecosystem with him. What makes us most proud is that we managed to complete the development of the Waver Finance project during this hackathon period, which was completely beyond our expectations. &nbsp; &nbsp; ## Business Model Traditional exchanges charge a certain percentage of grid trading volume as service fees. For example, Binance’s service fee ranges from 0.54% to 1.10%. On Waver Finance, if users need to use quantitative services, they need to purchase $WAVER on the exchange. When the transaction is successfully executed, the main contract will be paid in $WAVER. In addition, users only need to bear extremely low Gas fees and transition fees of less than 0.3% , which is friendly to whale users. With less server and ops cost, Waver Finance will use this tokenomics to maintain and sustain its unique business model. &nbsp; &nbsp; ## What we learned The main thing we learned was a deeper understanding of NEAR's underlying multi-signature mechanism and how to use it. We try to implement the ability to migrate contract state to update a contract with structural changes. At the same time, we also learn about decentralized prophecy machines to make the execution layer of the entire quantitative network more decentralized. &nbsp; &nbsp; ## What's next for Waver Finance What we have done for Waver Finance so far is only the beginning of our journey, there is still a long way to go and expand. Most importantly, we believe that Waver Finance can truly bring great impact and value to the market and contribute to the NEAR community. Here's an overview of Waver Finance's future journey: - **2023 Q1** : Improve tokenomic by developing our own liquidity staking pool, perform code audit, launch testnet and start airdrop. - **2023 Q2** : Launch the main network, support the development of leveraged funds and launch the test network - **2023 Q3** : Support leveraged funds on the mainnet, start the development of custom quantitative trading algorithms and economic design - **2023 Q4** : Launch custom quantitative trading algorithm, launch oracle decentralized test network &nbsp; &nbsp;
nicosup98_near-example-1
.github dependabot.yml workflows tests.yml .gitpod.yml .travis.yml Cargo.toml README-Gitpod.md README-Windows.md README.md borsh.js frontend App.js config.js index.html index.js package-lock.json package.json src lib.rs test.bat test.js test.sh tests-ava README.md __tests__ main.ava.ts package.json tsconfig.json
These tests use [near-workspaces-ava](https://github.com/near/workspaces-js/tree/main/packages/ava): delightful, deterministic local testing for NEAR smart contracts. You will need to install [NodeJS](https://nodejs.dev/). Then you can use the `scripts` defined in [package.json](./package.json): npm run test If you want to run `near-workspaces-ava` or `ava` directly, you can use [npx](https://nodejs.dev/learn/the-npx-nodejs-package-runner): npx near-workspaces-ava --help npx ava --help To run only one test file: npm run test "**/main*" # matches test files starting with "main" npm run test "**/whatever/**/*" # matches test files in the "whatever" directory To run only one test: npm run test -- -m "root sets*" # matches tests with titles starting with "root sets" yarn test -m "root sets*" # same thing using yarn instead of npm, see https://yarnpkg.com/ Status Message ============== [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/near-examples/rust-status-message) <!-- MAGIC COMMENT: DO NOT DELETE! Everything above this line is hidden on NEAR Examples page --> This smart contract saves and records the status messages of NEAR accounts that call it. Windows users: please visit the [Windows-specific README file](README-Windows.md). ## Prerequisites Ensure `near-cli` is installed by running: ``` near --version ``` If needed, install `near-cli`: ``` npm install near-cli -g ``` Ensure `Rust` is installed by running: ``` rustc --version ``` If needed, install `Rust`: ``` curl https://sh.rustup.rs -sSf | sh ``` Install dependencies ``` npm install ``` ## Quick Start To run this project locally: 1. Prerequisites: Make sure you have Node.js ≥ 12 installed (https://nodejs.org), then use it to install yarn: `npm install --global yarn` (or just `npm i -g yarn`) 2. Run the local development server: `yarn && yarn dev` (see package.json for a full list of scripts you can run with yarn) Now you'll have a local development environment backed by the NEAR TestNet! Running yarn dev will tell you the URL you can visit in your browser to see the app. ## Building this contract To make the build process compatible with multiple operating systems, the build process exists as a script in `package.json`. There are a number of special flags used to compile the smart contract into the wasm file. Run this command to build and place the wasm file in the `res` directory: ```bash npm run build ``` **Note**: Instead of `npm`, users of [yarn](https://yarnpkg.com) may run: ```bash yarn build ``` ### Important If you encounter an error similar to: >note: the `wasm32-unknown-unknown` target may not be installed Then run: ```bash rustup target add wasm32-unknown-unknown ``` ## Using this contract ### Web app Deploy the smart contract to a specific account created with the NEAR Wallet. Then interact with the smart contract using near-api-js on the frontend. If you do not have a NEAR account, please create one with [NEAR Wallet](https://wallet.testnet.near.org). Make sure you have credentials saved locally for the account you want to deploy the contract to. To perform this run the following `near-cli` command: ``` near login ``` Deploy the contract to your NEAR account: ```bash near deploy --wasmFile res/status_message.wasm --accountId YOUR_ACCOUNT_NAME ``` Build the frontend: ```bash npm start ``` If all is successful the app should be live at `localhost:1234`! ### Quickest deploy Build and deploy this smart contract to an development account. This development account will be created automatically and is not intended to be permanent. Please see the "Standard deploy" section for creating a more personalized account to deploy to. ```bash near dev-deploy --wasmFile res/status_message.wasm --helperUrl https://near-contract-helper.onrender.com ``` Behind the scenes, this is creating an account and deploying a contract to it. On the console, notice a message like: >Done deploying to dev-1234567890123 In this instance, the account is `dev-1234567890123`. A file has been created containing the key to the account, located at `neardev/dev-account`. To make the next few steps easier, we're going to set an environment variable containing this development account id and use that when copy/pasting commands. Run this command to the environment variable: ```bash source neardev/dev-account.env ``` You can tell if the environment variable is set correctly if your command line prints the account name after this command: ```bash echo $CONTRACT_NAME ``` The next command will call the contract's `set_status` method: ```bash near call $CONTRACT_NAME set_status '{"message": "aloha!"}' --accountId $CONTRACT_NAME ``` To retrieve the message from the contract, call `get_status` with the following: ```bash near view $CONTRACT_NAME get_status '{"account_id": "'$CONTRACT_NAME'"}' ``` ### Standard deploy In this option, the smart contract will get deployed to a specific account created with the NEAR Wallet. If you do not have a NEAR account, please create one with [NEAR Wallet](https://wallet.testnet.near.org). Make sure you have credentials saved locally for the account you want to deploy the contract to. To perform this run the following `near-cli` command: ``` near login ``` Deploy the contract: ```bash near deploy --wasmFile res/status_message.wasm --accountId YOUR_ACCOUNT_NAME ``` Set a status for your account: ```bash near call YOUR_ACCOUNT_NAME set_status '{"message": "aloha friend"}' --accountId YOUR_ACCOUNT_NAME ``` Get the status: ```bash near view YOUR_ACCOUNT_NAME get_status '{"account_id": "YOUR_ACCOUNT_NAME"}' ``` Note that these status messages are stored per account in a `HashMap`. See `src/lib.rs` for the code. We can try the same steps with another account to verify. **Note**: we're adding `NEW_ACCOUNT_NAME` for the next couple steps. There are two ways to create a new account: - the NEAR Wallet (as we did before) - `near create_account NEW_ACCOUNT_NAME --masterAccount YOUR_ACCOUNT_NAME` Now call the contract on the first account (where it's deployed): ```bash near call YOUR_ACCOUNT_NAME set_status '{"message": "bonjour"}' --accountId NEW_ACCOUNT_NAME ``` ```bash near view YOUR_ACCOUNT_NAME get_status '{"account_id": "NEW_ACCOUNT_NAME"}' ``` Returns `bonjour`. Make sure the original status remains: ```bash near view YOUR_ACCOUNT_NAME get_status '{"account_id": "YOUR_ACCOUNT_NAME"}' ``` ## Testing To test run: ```bash cargo test --package status-message -- --nocapture ```
near_zkevm-rom
.eslintrc.js .github ISSUE_TEMPLATE BOUNTY.yml bug.yml feature.yml question.yml README.md counters README.md counters-executor.js docs opcode-cost-zk-counters.md usage-ecrecover.md package.json tools checker.sh gen-parallel-tests.js helpers helpers.js parallel-tests-sample sample.test.js run-tests-zkasm.js
# zkevm-rom This repository contains the zkasm source code of the polygon-hermez zkevm ## Usage ```` npm i npm run build ```` The resulting `json` file will be created in the `./build` directory ### Advanced options - `-i ${input zkasm file}`: specify input source `zkasm` path - default value: `main/main.zkasm` - `-o ${destination rom file}`: specify output path for the resulting `json` - default value: `build/rom.json` - `-s ${steps}`: specify steps as $2^{steps}$ - default value: current steps in `constants.zkasm` Example: ``` npm run build -- -i ${path} -o ${path} -s ${steps} ``` ## Counters testing tool The purpose of this tool is to detect counters altertions in zkrom code. A unit test is created for each function and opcode of the zkEVM. The structure of the test is the following: ````` INCLUDE "../initIncludes.zkasm" // Include the files imported at the beginning of the test start: 1000000 => GAS operation: 2 :MSTORE(SP++) 2 :MSTORE(SP++) :JMP(opADD) // Assert counters. Check for each function, the exact number of each counter is matched checkCounters: %OPADD_STEP - STEP:JMPN(failedCounters) %OPADD_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters) %OPADD_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters) %OPADD_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters) %OPADD_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters) %OPADD_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters) %OPADD_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters) // Finalize execution 0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0 finalizeExecution: :JMP(finalWait) readCode: txType: :JMP(checkCounters) failedCounters: // Force failed assert 2 => A 1 :ASSERT INCLUDE "../endIncludes.zkasm" // Include the files imported at the end of the test ````` Run all tests: ````` node counters/counters-executor.js ````` Limitations: - Not all the tests are implemented yet, just the most complex ones - For some test (the simplest ones), the counters it should spend are stored in `countersConstants.zkasm` file. For tests with a lot of utils calls or a lot of complexity, the values of the counters are hardcoded in the test. - The tests always try to cover as much coverage as posible and always with the worst case counters scenario but this approach gets a bit tricky for complex opcodes as they have different contexts and behaviours. - The objective is to keep adding tests with already not implemented functions but also adding tests for already implemented opcodes but with different scenarios (Example: calldatacopy from a call or from a create2)
esaminu_console-donation-template-2342sdfv
.github scripts runfe.sh workflows deploy-to-console.yml readme.yml tests.yml .gitpod.yml README.md contract README.md build.sh deploy.sh package-lock.json package.json src contract.ts model.ts utils.ts tsconfig.json integration-tests package-lock.json package.json src main.ava.ts package-lock.json package.json
# Donation 💸 [![](https://img.shields.io/badge/⋈%20Examples-Basics-green)](https://docs.near.org/tutorials/welcome) [![](https://img.shields.io/badge/Gitpod-Ready-orange)](https://gitpod.io/#/https://github.com/near-examples/donation-js) [![](https://img.shields.io/badge/Contract-js-yellow)](https://docs.near.org/develop/contracts/anatomy) [![](https://img.shields.io/badge/Frontend-JS-yellow)](https://docs.near.org/develop/integrate/frontend) [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fnear-examples%2Fdonation-js%2Fbadge&style=flat&label=Tests)](https://actions-badge.atrox.dev/near-examples/donation-js/goto) Our Donation example enables to forward money to an account while keeping track of it. It is one of the simplest examples on making a contract receive and send money. ![](https://docs.near.org/assets/images/donation-7cf65e5e131274fd1ae9aa34bc465bb8.png) # What This Example Shows 1. How to receive and transfer $NEAR on a contract. 2. How to divide a project into multiple modules. 3. How to handle the storage costs. 4. How to handle transaction results. 5. How to use a `Map`. <br /> # Quickstart Clone this repository locally or [**open it in gitpod**](https://gitpod.io/#/github.com/near-examples/donation-js). Then follow these steps: ### 1. Install Dependencies ```bash npm install ``` ### 2. Test the Contract Deploy your contract in a sandbox and simulate interactions from users. ```bash npm test ``` ### 3. Deploy the Contract Build the contract and deploy it in a testnet account ```bash npm run deploy ``` --- # Learn More 1. Learn more about the contract through its [README](./contract/README.md). 2. Check [**our documentation**](https://docs.near.org/develop/welcome). # Donation Contract The smart contract exposes methods to handle donating $NEAR to a `beneficiary`. ```ts @call donate() { // Get who is calling the method and how much $NEAR they attached let donor = near.predecessorAccountId(); let donationAmount: bigint = near.attachedDeposit() as bigint; let donatedSoFar = this.donations.get(donor) === null? BigInt(0) : BigInt(this.donations.get(donor) as string) let toTransfer = donationAmount; // This is the user's first donation, lets register it, which increases storage if(donatedSoFar == BigInt(0)) { assert(donationAmount > STORAGE_COST, `Attach at least ${STORAGE_COST} yoctoNEAR`); // Subtract the storage cost to the amount to transfer toTransfer -= STORAGE_COST } // Persist in storage the amount donated so far donatedSoFar += donationAmount this.donations.set(donor, donatedSoFar.toString()) // Send the money to the beneficiary const promise = near.promiseBatchCreate(this.beneficiary) near.promiseBatchActionTransfer(promise, toTransfer) // Return the total amount donated so far return donatedSoFar.toString() } ``` <br /> # Quickstart 1. Make sure you have installed [node.js](https://nodejs.org/en/download/package-manager/) >= 16. 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash npm run deploy ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # e.g. dev-1659899566943-21539992274727 ``` The contract will be automatically initialized with a default `beneficiary`. To initialize the contract yourself do: ```bash # Use near-cli to initialize contract (optional) near call <dev-account> init '{"beneficiary":"<account>"}' --accountId <dev-account> ``` <br /> ## 2. Get Beneficiary `beneficiary` is a read-only method (`view` method) that returns the beneficiary of the donations. `View` methods can be called for **free** by anyone, even people **without a NEAR account**! ```bash near view <dev-account> beneficiary ``` <br /> ## 3. Get Number of Donations `donate` forwards any attached money to the `beneficiary` while keeping track of it. `donate` is a payable method for which can only be invoked using a NEAR account. The account needs to attach money and pay GAS for the transaction. ```bash # Use near-cli to donate 1 NEAR near call <dev-account> donate --amount 1 --accountId <account> ``` **Tip:** If you would like to `donate` using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`.
gheja_js13k2022
.vscode launch.json settings.json tasks.json README.md TODO.md build.sh embed_gfx.sh experiments coil.html near_login.html near_send_money.html minimized_names.md ids classes css keyframes from css settings.json src 3rdparty ZzFXMicro.min.js bonus coil.js near.js near.min.js consts.ts data.ts data_graphics.ts dialog.ts exports.js external.d.ts externs.js game.ts game_object.ts game_object_carrot.ts game_object_container.ts game_object_container_pan.ts game_object_container_pot.ts game_object_countertop.ts game_object_deputy.ts game_object_ingredient.ts game_object_meat.ts game_object_player.ts game_object_recipe.ts game_object_seasoning.ts game_object_shroom.ts game_object_slot.ts game_object_slot_chute.ts game_object_slot_trash.ts game_object_wall.ts index.html index.min.html input.ts lib.ts main.ts mobile_gamepad.ts particles.ts save.ts server server.js server.min.js stats.ts style.css types.ts vec2d.ts tsconfig.json
![Cooking for Skully](preview_v1_400x250.jpg) # Cooking for Skully An entry for the [js13kgames](https://js13kgames.com/) [2022](http://2022.js13kgames.com/) gamejam for the theme "death". Entry: https://js13kgames.com/entries/cooking-for-skully Branch for the jam version: [js13k2022-entry](https://github.com/gheja/js13k2022/tree/js13k2022-entry) The main branch contains some further developments. # Details The game is about the Devil who is asked by Skully (aka. Death) to cook some meal for him. The Devil is controlled by the player, they need to prepare dishes with various ingredients and seasoning based on recipes then Skully judges their performance by 5-star rating. Goblin (finding a better name is still on the TODO list) tries to guide the player and introduce them to new elements. And also, there is Cerberus, the three headed pup who takes care of any leftovers. The game is created with HTML5 + TypeScript + CSS, GIMP for graphics. The graphics is displayed using CSS3D, it also has Bonus features [...] For the release I use a build.sh to merge all TypeScript sources and use [typescript-closure-compiler](https://www.npmjs.com/package/typescript-closure-compiler) to transpile the bundle to JavaScript (ECMAScript 5), which is then compressed by [google-closure-compiler](https://www.npmjs.com/package/google-closure-compiler). The output gets embedded into a minimized HTML file, alongside with CSS and the images, then the hand-minimized server.js gets copied and these two files are compressed into a single ZIP file, which then gets recompressed by [advancecomp](https://github.com/amadvance/advancecomp)'s AdvZIP to be able to squeeze a few more bytes (can shave off 4% compared to the standard high compression ZIP). # Screenshots ![Screenshot from Cooking for Skully](preview_gameplay1.png)
iovayurt_dm
README.md
demo ================== This [React] app was initialized with [create-near-app] Quick Start =========== To run this project locally: 1. Prerequisites: Make sure you've installed [Node.js] ≥ 12 2. Install dependencies: `yarn install` 3. Run the local development server: `yarn dev` (see `package.json` for a full list of `scripts` you can run with `yarn`) Now you'll have a local development environment backed by the NEAR TestNet! Go ahead and play with the app and the code. As you make code changes, the app will automatically reload. Exploring The Code ================== 1. The "backend" code lives in the `/contract` folder. See the README there for more info. 2. The frontend code lives in the `/src` folder. `/src/index.html` is a great place to start exploring. Note that it loads in `/src/index.js`, where you can learn how the frontend connects to the NEAR blockchain. 3. Tests: there are different kinds of tests for the frontend and the smart contract. See `contract/README` for info about how it's tested. The frontend code gets tested with [jest]. You can run both of these at once with `yarn run test`. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `yarn dev`, your smart contract gets deployed to the live NEAR TestNet with a throwaway account. When you're ready to make it permanent, here's how. Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `yarn install`, but for best ergonomics you may want to install it globally: yarn install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `demo.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `demo.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account demo.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: set contract name in code --------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'demo.YOUR-NAME.testnet' Step 3: deploy! --------------- One command: yarn deploy As you can see in `package.json`, this does two things: 1. builds & deploys smart contract to NEAR TestNet 2. builds & deploys frontend code to GitHub using [gh-pages]. This will only work if the project already has a repository set up on GitHub. Feel free to modify the `deploy` script in `package.json` to deploy elsewhere. Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [React]: https://reactjs.org/ [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/docs/concepts/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli [gh-pages]: https://github.com/tschaub/gh-pages
here-wallet_phone-access-contract
.env README.md contract Cargo.toml src lib.rs test.sh
NEAR access by phone number ==== Smart contract for send NEAR, NFT, FT by sms Sample send NFT ``` near call tonic_goblin.enleap.near nft_transfer_call '{"receiver_id": "phone.herewallet.near","token_id":"1780", "msg": "[phone number hash]"}' --accountId mydev.near --gas 242794783120800 --depositYocto 1 ``` Sample send NEAR ``` near call phone.herewallet.testnet send_near_to_phone '{"phone":"[phone number hash]"}' --gas 242794783120800 --accountId petr4.testnet --deposit 1 ``` Sample send FT ``` near call usdn.testnet ft_transfer_call '{"receiver_id": "phone.herewallet.testnet", "amount": "100000000", "msg": "phone number hash]"}' --accountId petr4.testnet --gas 242794783120800 --depositYocto 1 ``` ---------- ## Development 1. Install `rustup` via https://rustup.rs/ 2. Run the following: ``` rustup default stable rustup target add wasm32-unknown-unknown ``` ### Testing Contracts have unit tests ``` make run-test ``` ### Compiling You can build release version by running next scripts inside each contract folder: ``` make build ``` ### Deploying to TestNet To deploy to TestNet, you can use next command: ``` make deploy-dev ``` This will use contract ID from `Makefile` ## Bash API ``` near call phone.herewallet.testnet send_near_to_phone '{"phone":"test"}' --gas 242794783120800 --accountId petr4.testnet --deposit 1 near call phone.herewallet.testnet receive_payments '{"phone":"test3"}' --gas 242794783120800 --accountId petr4.testnet near call phone.herewallet.testnet allocate_phone '{"phone":"test3", "account_id":"petr4.testnet"}' --gas 242794783120800 --accountId herewallet.testnet --depositYocto 1 ```
here-wallet_btc-bridge-contract
README.md contract Cargo.toml src lib.rs scripts buy nwrap.sh
BTC Bridge contract ===== ## How to use bridge как получить NEAR за BTC 0. Init accounts ``` NEAR_ENV=mainnet near call 2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near storage_deposit '{}' --gas 150000000000000 --deposit 0.1 --accountId bridge.mydev.near NEAR_ENV=mainnet near call v1.orderbook.near storage_deposit '{}' --gas 242794783120800 --deposit 0.01 --accountId mydev.near NEAR_ENV=mainnet near call wrap.near near_deposit '{}' --deposit 0.01 --gas 242794783120800 --accountId mydev.near ``` 1. create a transfer request with a random `request_id` of 8 characters ```bash NEAR_ENV=mainnet near call bridge.mydev.near create_request '{"request_id":"fh9032gh905", "btc_amount": "10000"}' --accountId mydev.near --gas 242794783120800 ``` 2. Every 3s we check the requests ``` NEAR_ENV=mainnet near view bridge.mydev.near get_request '{"request_id":"fh9032gh905"}' ``` 3. as soon as `target_btc_address` comes in the response, show it 4. regularly check your balance in btc with the command ``` NEAR_ENV=mainnet near view 2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near ft_balance_of '{"account_id":"mydev.near"}' ``` 5. balance is positive - it means bitcoin came, now you need to sell it to get NEAR ``` NEAR_ENV=mainnet near call a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near ft_transfer_call '{"receiver_id": "v1.orderbook.near", "amount": "1", "msg": "{market_id: \"2UmzUXYpaZg4vXfFVmD7r8mYUYkKEF19xpjLw7ygDUwp\", side: \"Buy\", amount_in: \"10\", min_amount_out: \"1\"}"}' --accountId mydev.near --depositYocto 1 --gas 300000000000000 ``` 6. Greate! We've got the nir, only it's a wrapped. Let's unwrapped him ``` NEAR_ENV=mainnet near call wrap.near near_withdraw '{"amount":"1000"}' --depositYocto 1 --gas 242794783120800 --accountId mydev.near ``` ------- Mainnet contract ID: `bridge.mydev.near`
esaminu_newTestProject
.eslintrc.yml .github ISSUE_TEMPLATE 01_BUG_REPORT.md 02_FEATURE_REQUEST.md 03_CODEBASE_IMPROVEMENT.md 04_SUPPORT_QUESTION.md config.yml PULL_REQUEST_TEMPLATE.md labels.yml workflows codeql.yml deploy-to-console.yml labels.yml lock.yml pr-labels.yml stale.yml .gitpod.yml README.md contract Cargo.toml README.md build.sh deploy.sh src lib.rs docs CODE_OF_CONDUCT.md CONTRIBUTING.md SECURITY.md frontend App.js assets global.css logo-black.svg logo-white.svg index.html index.js near-interface.js near-wallet.js package.json start.sh ui-components.js integration-tests Cargo.toml src tests.rs package.json
# Hello NEAR Contract The smart contract exposes two methods to enable storing and retrieving a greeting in the NEAR network. ```rust const DEFAULT_GREETING: &str = "Hello"; #[near_bindgen] #[derive(BorshDeserialize, BorshSerialize)] pub struct Contract { greeting: String, } impl Default for Contract { fn default() -> Self { Self{greeting: DEFAULT_GREETING.to_string()} } } #[near_bindgen] impl Contract { // Public: Returns the stored greeting, defaulting to 'Hello' pub fn get_greeting(&self) -> String { return self.greeting.clone(); } // Public: Takes a greeting, such as 'howdy', and records it pub fn set_greeting(&mut self, greeting: String) { // Record a log permanently to the blockchain! log!("Saving greeting {}", greeting); self.greeting = greeting; } } ``` <br /> # Quickstart 1. Make sure you have installed [rust](https://rust.org/). 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash ./deploy.sh ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # e.g. dev-1659899566943-21539992274727 ``` <br /> ## 2. Retrieve the Greeting `get_greeting` is a read-only method (aka `view` method). `View` methods can be called for **free** by anyone, even people **without a NEAR account**! ```bash # Use near-cli to get the greeting near view <dev-account> get_greeting ``` <br /> ## 3. Store a New Greeting `set_greeting` changes the contract's state, for which it is a `change` method. `Change` methods can only be invoked using a NEAR account, since the account needs to pay GAS for the transaction. ```bash # Use near-cli to set a new greeting near call <dev-account> set_greeting '{"message":"howdy"}' --accountId <dev-account> ``` **Tip:** If you would like to call `set_greeting` using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`. <h1 align="center"> <a href="https://github.com/near/boilerplate-template-rs"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/near/boilerplate-template-rs/main/docs/images/pagoda_logo_light.png"> <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/near/boilerplate-template-rs/main/docs/images/pagoda_logo_dark.png"> <img alt="" src="https://raw.githubusercontent.com/near/boilerplate-template-rs/main/docs/images/pagoda_logo_dark.png"> </picture> </a> </h1> <div align="center"> Rust Boilerplate Template <br /> <br /> <a href="https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=bug&template=01_BUG_REPORT.md&title=bug%3A+">Report a Bug</a> · <a href="https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=enhancement&template=02_FEATURE_REQUEST.md&title=feat%3A+">Request a Feature</a> . <a href="https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=question&template=04_SUPPORT_QUESTION.md&title=support%3A+">Ask a Question</a> </div> <div align="center"> <br /> [![Pull Requests welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg?style=flat-square)](https://github.com/near/boilerplate-template-rs/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) [![code with love by near](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-near-ff1414.svg?style=flat-square)](https://github.com/near) </div> <details open="open"> <summary>Table of Contents</summary> - [About](#about) - [Built With](#built-with) - [Getting Started](#getting-started) - [Prerequisites](#prerequisites) - [Installation](#installation) - [Usage](#usage) - [Roadmap](#roadmap) - [Support](#support) - [Project assistance](#project-assistance) - [Contributing](#contributing) - [Authors & contributors](#authors--contributors) - [Security](#security) </details> --- ## About This project is created for easy-to-start as a React + Rust skeleton template in the Pagoda Gallery. It was initialized with [create-near-app]. Clone it and start to build your own gallery project! ### Built With [create-near-app], [amazing-github-template](https://github.com/dec0dOS/amazing-github-template) Getting Started ================== ### Prerequisites Make sure you have a [current version of Node.js](https://nodejs.org/en/about/releases/) installed – we are targeting versions `16+`. Read about other [prerequisites](https://docs.near.org/develop/prerequisites) in our docs. ### Installation Install all dependencies: npm install Build your contract: npm run build Deploy your contract to TestNet with a temporary dev account: npm run deploy Usage ===== Test your contract: npm test Start your frontend: npm start Exploring The Code ================== 1. The smart-contract code lives in the `/contract` folder. See the README there for more info. In blockchain apps the smart contract is the "backend" of your app. 2. The frontend code lives in the `/frontend` folder. `/frontend/index.html` is a great place to start exploring. Note that it loads in `/frontend/index.js`, this is your entrypoint to learn how the frontend connects to the NEAR blockchain. 3. Test your contract: `npm test`, this will run the tests in `integration-tests` directory. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `npm run deploy`, your smart contract gets deployed to the live NEAR TestNet with a temporary dev account. When you're ready to make it permanent, here's how: Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `npm install`, but for best ergonomics you may want to install it globally: npm install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `near-blank-project.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `near-blank-project.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account near-blank-project.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: deploy the contract --------------------------- Use the CLI to deploy the contract to TestNet with your account ID. Replace `PATH_TO_WASM_FILE` with the `wasm` that was generated in `contract` build directory. near deploy --accountId near-blank-project.YOUR-NAME.testnet --wasmFile PATH_TO_WASM_FILE Step 3: set contract name in your frontend code ----------------------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'near-blank-project.YOUR-NAME.testnet' Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/concepts/basics/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli [gh-pages]: https://github.com/tschaub/gh-pages ## Roadmap See the [open issues](https://github.com/near/boilerplate-template-rs/issues) for a list of proposed features (and known issues). - [Top Feature Requests](https://github.com/near/boilerplate-template-rs/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc) (Add your votes using the 👍 reaction) - [Top Bugs](https://github.com/near/boilerplate-template-rs/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc) (Add your votes using the 👍 reaction) - [Newest Bugs](https://github.com/near/boilerplate-template-rs/issues?q=is%3Aopen+is%3Aissue+label%3Abug) ## Support Reach out to the maintainer: - [GitHub issues](https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=question&template=04_SUPPORT_QUESTION.md&title=support%3A+) ## Project assistance If you want to say **thank you** or/and support active development of Rust Boilerplate Template: - Add a [GitHub Star](https://github.com/near/boilerplate-template-rs) to the project. - Tweet about the Rust Boilerplate Template. - Write interesting articles about the project on [Dev.to](https://dev.to/), [Medium](https://medium.com/) or your personal blog. Together, we can make Rust Boilerplate Template **better**! ## Contributing First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are **greatly appreciated**. Please read [our contribution guidelines](docs/CONTRIBUTING.md), and thank you for being involved! ## Authors & contributors The original setup of this repository is by [Dmitriy Sheleg](https://github.com/shelegdmitriy). For a full list of all authors and contributors, see [the contributors page](https://github.com/near/boilerplate-template-rs/contributors). ## Security Rust Boilerplate Template follows good practices of security, but 100% security cannot be assured. Rust Boilerplate Template is provided **"as is"** without any **warranty**. Use at your own risk. _For more information and to report security issues, please refer to our [security documentation](docs/SECURITY.md)._
kingbsby_my-copyright
README.md contract Cargo.toml neardev dev-account.env src lib.rs frontend package.json public index.html manifest.json robots.txt src App.css App.js index.css index.js
# my-copyright near demo picture store ## concept This contract provides the function of a picture store. Users can upload and purchase pictures. The picture uses hash as the unique identifier. The same user uploads the same hash picture as a modification operation. Different users cannot modify other users' pictures, nor can they buy their own pictures. . ps: it will be changed to nft later You can access it online at https://kingbsby.github.io/my-copyright/ ## Getting Started 1、clone this repo ```shell git clone https://github.com/kingbsby/my-copyright ``` 2、run frontend ```shell cd frontend yarn install yarn dev ``` If all goes well, you'll be able to play by accessing address http://localhost:3000/my-copyright in your browser. > [Option] > > If you want to deploy a new dev contract, you need to do the following steps before run frontend: > > ``` > cd contract > rm -rf neardev > cargo build --target wasm32-unknown-unknown --release > cp target/wasm32-unknown-unknown/release/my_copyright.wasm res/ > near dev-deploy res/my_copyright.wasm > get the dev account(e.g. dev-1646378813317-27296479436263), Then modify the variables `ContractName` in file frontend/src/App.js. > near call $new-contract-id new --account-id $new-contract-id > ``` >
Learn-NEAR_NCD.L2.sample--promises
README.md babel.config.js package-lock.json package.json postcss.config.js public index.html src composables near.js index.css main.js router index.js services near.js store store.js tailwind.config.js
# near--promises ## Project setup ``` npm install ``` ### Compiles and hot-reloads for development ``` npm run serve ``` ### Compiles and minifies for production ``` npm run build ``` ### Lints and fixes files ``` npm run lint ``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/).
ifabrisarabellapark_ETHSF-scorebox-smartcontracts
README.md near README.md contract Cargo.toml build.sh deploy.sh src lib.rs package.json polygon README.md hardhat.config.js package-lock.json package.json requirements.txt scripts deploy.py
# Smart contracts This repo contains 2 smart contracts written in Rust and Solidity, respectively to store and query credit scores on either NEAR Protocol testnet or Polygon Mumbai testnet. Although the 2 contracts are written in different programming languages and are deployed on different blockchains their logic is almost identical. ### :cactus: Tree Diagram ```bash . └─── ├── near # NEAR smart contract in Rust ├── polygon # Polygon smart contract in Solidity ├── LICENSE └── README.md ``` # :rocket: ScoreBox Contract | NEAR The smart contract exposes two methods to enable storing and retrieving credit scores from the NEAR network. --- ### Functions Function call ```bash # upload credit score on blockchain pub fn upload_score( &mut self, score: u16, description: String, beneficiary: AccountId, amount: Balance ) -> bool { ... } ``` View call ```bash #query a user's scores (all) pub fn get_scores( &self, account_id: String ) -> ScoreVec { ... } ``` ### Quickstart Must-have: Rust, rustup, rustc, Near CLI, rust-toolchain, target to compile WASM ```bash rustup target add wasm32-unknown-unknown ``` Compile and deploy ```bash ./build.sh export a=ethsf.testnet yarn build && near deploy --wasmFile res/contract.wasm --accountId $a near call $a init '{"owner_id": "ethsf.testnet"}' --accountId $a ``` Interact ```bash near call $a upload_score '{"score": 371, "description": "Congrats! 371 points.", "beneficiary": "ethsf.testnet", "amount":1}' --accountId $a near view $a get_scores '{"account_id": "'$a'"}' --accountId $a ``` # :rocket: ScoreBox Contract | Polygon This is a smart contract written in Solidity and deployed on Polygon testnet (Mumbai), which can store users' credit scores and return them for free when queried using a view call. ___ ### Core functions Notice the first is a payable function, whereas the second is just a viewing function ```bash #save scores function uploadScore( int16 _score, string _description, address _beneficiary, uint256 _amount ) requiresFee(_amount) returns (bool b) # query scores function getScore(address _wallet) returns (User[]) # returns a vector of Structs ``` ___ ### Solidity env set up ```bash npm install --save-dev "hardhat@^2.12.0" npm install @openzeppelin/contracts ``` ### Test & compile You need Brownie, so install it. </br> Good alternatives are HardHat and Truffle, but both are JS based. ```bash pip install eth-brownie ``` ### Deploy Using Brownie ```bash brownie compile brownie run deploy.py --network polygon-test ``` ### Interact Run from terminal ```bash # import accounts brownie accounts list brownie accounts new josi # enter josi's private key and a password brownie accounts list # connect to blockchain brownie console --network polygon-test network.is_connected() network.show_active() # interact with contract sc = StoreScores.at('yourcontractaddress') nene = accounts.load('nene') josi = accounts.load('josi') sc.userCount() sc.uploadScore(501, 'Yo!', nene, 3, {'from':josi, 'value': 3}) sc.getScore(josi, {'from': josi}) ``` > `nene` and `josi` are an alias
anbork_web4-svelte
README.md asconfig.json assembly as_types.d.ts index.ts tsconfig.json htmlto.js index.html package-lock.json package.json src main.ts utils near.ts vite-env.d.ts svelte.config.js tsconfig.json tsconfig.node.json vite.config.ts
# Svelte + Web4 This template should help get you started developing with Svelte and Web4 for Near Protocol. ## Recommended Setup [Node.js](https://nodejs.org/en/) + [Near Cli](https://docs.near.org/docs/tools/near-cli#installation). ## What is Web4 Framework? Check out [Web4](https://github.com/vgrichina/web4), which is also powered by Near Protocol Team. Deployment front-end applications in new way. ## What is Svelte starter for Web4? Out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, Bootstrap, and more ## How it working (YARN)? - `yarn install` - `yarn dev` for developing **Then deploy application** - `yarn build` - `yarn asb` - `near login` - `near deploy --accountId youglogin.testnet --wasmFile build/release/web4ts.wasm` ## How it working (NPM)? - `npm install` - `npm run dev` for developing **Then deploy application** - `npm run build` - `npm run asb` - `near login` - `near deploy --accountId youglogin.testnet --wasmFile build/release/web4ts.wasm`
nearprotocol__archived_debugger
README.md api README.md bin start_gunicorn.sh setup.py src near __init__.py debugger_api __init__.py api.py db_objects.py models.py utils __init__.py schematics.py sql.py web __init__.py app.py blueprint.py gunicorn.py helpers.py http_errors.py run.py utils.py tests integration __init__.py test_client.py web-ui README.md package.json public index.html manifest.json src components BeaconBlockDetail.js BeaconChainDetail.js BlockDetail.js BlocksList.js ContractDetail.js DashboardDetail.js DesktopView.js Errors.js Footer.js MobileView.js PaginationTab.js ResponsiveContainer.js ShardBlockDetail.js ShardChainDetail.js TransactionDetail.js TransactionsList.js images explorer-logo.svg icon-account-bl.svg icon-account.svg icon-activity.svg icon-arrow-down.svg icon-arrow-left.svg icon-arrow-right.svg icon-arrow-up.svg icon-authorized.svg icon-blocks.svg icon-check.svg icon-close.svg icon-collapse.svg icon-contacts.svg icon-doc.svg icon-help.svg icon-home.svg icon-issues.svg icon-logout.svg icon-m-block.svg icon-m-copy.svg icon-m-doc.svg icon-m-node.svg icon-m-receipt.svg icon-m-sent.svg icon-m-transaction.svg icon-manage-wallet.svg icon-problems.svg icon-recent.svg icon-search.svg icon-send.svg icon-shard.svg icon-transactions.svg near.svg wallet.svg index.css index.js serviceWorker.js utils api.js
## Setup ### Install package ```bash yarn install ``` ## Running ```bash yarn start ``` ## Setup ### Install pipenv ```bash pip install --user pipenv ``` ### Install package ```bash pipenv install -e . ``` ## Running Note: Make sure to have local devnet running at localhost:3030 ```bash pipenv run python -m near.debugger_api.web.run ``` # Dashboard ## Development Run backend: follow instructions at `api/README.md` Run frontend: follow instructions at `web-ui/README.md`
esaminu_console-donation-template-324sdfsdf
.github scripts runfe.sh workflows deploy-to-console.yml readme.yml tests.yml .gitpod.yml README.md contract README.md build.sh deploy.sh package-lock.json package.json src contract.ts model.ts utils.ts tsconfig.json integration-tests package-lock.json package.json src main.ava.ts package-lock.json package.json
# Donation Contract The smart contract exposes methods to handle donating $NEAR to a `beneficiary`. ```ts @call donate() { // Get who is calling the method and how much $NEAR they attached let donor = near.predecessorAccountId(); let donationAmount: bigint = near.attachedDeposit() as bigint; let donatedSoFar = this.donations.get(donor) === null? BigInt(0) : BigInt(this.donations.get(donor) as string) let toTransfer = donationAmount; // This is the user's first donation, lets register it, which increases storage if(donatedSoFar == BigInt(0)) { assert(donationAmount > STORAGE_COST, `Attach at least ${STORAGE_COST} yoctoNEAR`); // Subtract the storage cost to the amount to transfer toTransfer -= STORAGE_COST } // Persist in storage the amount donated so far donatedSoFar += donationAmount this.donations.set(donor, donatedSoFar.toString()) // Send the money to the beneficiary const promise = near.promiseBatchCreate(this.beneficiary) near.promiseBatchActionTransfer(promise, toTransfer) // Return the total amount donated so far return donatedSoFar.toString() } ``` <br /> # Quickstart 1. Make sure you have installed [node.js](https://nodejs.org/en/download/package-manager/) >= 16. 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash npm run deploy ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # e.g. dev-1659899566943-21539992274727 ``` The contract will be automatically initialized with a default `beneficiary`. To initialize the contract yourself do: ```bash # Use near-cli to initialize contract (optional) near call <dev-account> init '{"beneficiary":"<account>"}' --accountId <dev-account> ``` <br /> ## 2. Get Beneficiary `beneficiary` is a read-only method (`view` method) that returns the beneficiary of the donations. `View` methods can be called for **free** by anyone, even people **without a NEAR account**! ```bash near view <dev-account> beneficiary ``` <br /> ## 3. Get Number of Donations `donate` forwards any attached money to the `beneficiary` while keeping track of it. `donate` is a payable method for which can only be invoked using a NEAR account. The account needs to attach money and pay GAS for the transaction. ```bash # Use near-cli to donate 1 NEAR near call <dev-account> donate --amount 1 --accountId <account> ``` **Tip:** If you would like to `donate` using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`. # Donation 💸 [![](https://img.shields.io/badge/⋈%20Examples-Basics-green)](https://docs.near.org/tutorials/welcome) [![](https://img.shields.io/badge/Gitpod-Ready-orange)](https://gitpod.io/#/https://github.com/near-examples/donation-js) [![](https://img.shields.io/badge/Contract-js-yellow)](https://docs.near.org/develop/contracts/anatomy) [![](https://img.shields.io/badge/Frontend-JS-yellow)](https://docs.near.org/develop/integrate/frontend) [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fnear-examples%2Fdonation-js%2Fbadge&style=flat&label=Tests)](https://actions-badge.atrox.dev/near-examples/donation-js/goto) Our Donation example enables to forward money to an account while keeping track of it. It is one of the simplest examples on making a contract receive and send money. ![](https://docs.near.org/assets/images/donation-7cf65e5e131274fd1ae9aa34bc465bb8.png) # What This Example Shows 1. How to receive and transfer $NEAR on a contract. 2. How to divide a project into multiple modules. 3. How to handle the storage costs. 4. How to handle transaction results. 5. How to use a `Map`. <br /> # Quickstart Clone this repository locally or [**open it in gitpod**](https://gitpod.io/#/github.com/near-examples/donation-js). Then follow these steps: ### 1. Install Dependencies ```bash npm install ``` ### 2. Test the Contract Deploy your contract in a sandbox and simulate interactions from users. ```bash npm test ``` ### 3. Deploy the Contract Build the contract and deploy it in a testnet account ```bash npm run deploy ``` --- # Learn More 1. Learn more about the contract through its [README](./contract/README.md). 2. Check [**our documentation**](https://docs.near.org/develop/welcome).
Amarnath-Rao_Voting-System
.gitpod.yml README.md babel.config.js contract README.md as-pect.config.js asconfig.json assembly __tests__ as-pect.d.ts main.spec.ts as_types.d.ts index.ts tsconfig.json compile.js package-lock.json package.json package.json src App.js Components Home.js NewPoll.js PollingStation.js __mocks__ fileMock.js assets blockvotelogo.svg loadingcircles.svg logo-black.svg logo-white.svg config.js global.css index.html index.js jest.init.js main.test.js utils.js wallet login index.html
blockvote Smart Contract ================== A [smart contract] written in [AssemblyScript] for an app initialized with [create-near-app] Quick Start =========== Before you compile this code, you will need to install [Node.js] ≥ 12 Exploring The Code ================== 1. The main smart contract code lives in `assembly/index.ts`. You can compile it with the `./compile` script. 2. Tests: You can run smart contract tests with the `./test` script. This runs standard AssemblyScript tests using [as-pect]. [smart contract]: https://docs.near.org/docs/develop/contracts/overview [AssemblyScript]: https://www.assemblyscript.org/ [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [as-pect]: https://www.npmjs.com/package/@as-pect/cli Polling Management ================== This [React] app was initialized with [create-near-app] Use "yarn build && yarn start" to start the page Images ========== ![Screenshot 2023-04-18 163320](https://user-images.githubusercontent.com/96937608/232758882-1490ccf4-e804-4fb3-81d1-59a99166cc1c.png) ![Screenshot 2023-04-18 163404](https://user-images.githubusercontent.com/96937608/232758917-15946039-d783-47f1-9aa0-5cd4a4ba7907.png) ![Screenshot 2023-04-18 163501](https://user-images.githubusercontent.com/96937608/232758933-43aa2981-6e8b-4e3b-b4b1-2a76cd02f6fd.png) Quick Start =========== To run this project locally: 1. Prerequisites: Make sure you've installed [Node.js] ≥ 12 2. Install dependencies: `yarn install` 3. Run the local development server: `yarn dev` (see `package.json` for a full list of `scripts` you can run with `yarn`) Now you'll have a local development environment backed by the NEAR TestNet! Go ahead and play with the app and the code. As you make code changes, the app will automatically reload. Exploring The Code ================== 1. The "backend" code lives in the `/contract` folder. See the README there for more info. 2. The frontend code lives in the `/src` folder. `/src/index.html` is a great place to start exploring. Note that it loads in `/src/index.js`, where you can learn how the frontend connects to the NEAR blockchain. 3. Tests: there are different kinds of tests for the frontend and the smart contract. See `contract/README` for info about how it's tested. The frontend code gets tested with [jest]. You can run both of these at once with `yarn run test`. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `yarn dev`, your smart contract gets deployed to the live NEAR TestNet with a throwaway account. When you're ready to make it permanent, here's how. Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `yarn install`, but for best ergonomics you may want to install it globally: yarn install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `blockvote.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `blockvote.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account blockvote.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: set contract name in code --------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'blockvote.YOUR-NAME.testnet'
near_near-public-lakehouse
README.md rust-extract-apis lockups .env Cargo.toml src account_details.rs lockup.rs lockup_types.rs main.rs src lakehouse notebooks BQ Writer Backfill from Genesis 2020-07-21 to 2023-08-28.py BQ Writer Stream.py BQ Writer Views & Data Dictionary.py Mainnet Loader.py Silver Lake Mainnet.sql
# near-public-lakehouse NEAR Public Lakehouse This repository contains the source code for ingesting NEAR Protocol data stored as JSON files in AWS S3 by [near-lake-indexer](https://github.com/near/near-lake-indexer). The data is loaded in a streaming fashion using Databricks Autoloader into raw/bronze tables, and transformed with Databricks Delta Live Tables streaming jobs into cleaned/enriched/silver tables. The silver tables are also copied into the GCP BigQuery Public Dataset. # Intro Blockchain data indexing in NEAR Public Lakehouse is for anyone who wants to make sense of blockchain data. This includes: - **Users**: create queries to track NEAR assets, monitor transactions, or analyze onchain events at massive scale. - **Researchers**: use indexed data for data science tasks including onchain activities, identifying trends, or feed AI/ML pipelines for predective analysis. - **Startups**: can use NEAR's indexed data for deep insights on user engagement, smart contract utilization, or insights across tokens and NFT adoption. Benefits: - **NEAR instant insights**: Historical onchain data queried at scale. - **Cost-effective**: eliminate the need to store and process bulk NEAR protocol data; query as little or as much data as preferred. - **Easy to use**: no prior experience with blockchain technology required; bring a general knowledge of SQL to unlock insights. # Architecture ![Architecture](./docs/Architecture.png "Architecture") Note: [Databricks Medallion Architecture](https://www.databricks.com/glossary/medallion-architecture) # What is NEAR Protocol? NEAR is a user-friendly, carbon-neutral blockchain, built from the ground up to be performant, secure, and infinitely scalable. It's a layer one, sharded, proof-of-stake blockchain designed with usability in mind. In simple terms, NEAR is blockchain for everyone. # Data Available The current data that we are providing was inspired by [near-indexer-for-explorer](https://github.com/near/near-indexer-for-explorer/). We plan to improve the data available in the NEAR Public Lakehouse making it easier to consume by denormalizing some tables. The tables available in the NEAR Public Lakehouse are: - **blocks**: A structure that represents an entire block in the NEAR blockchain. Block is the main entity in NEAR Protocol blockchain. Blocks are produced in NEAR Protocol every second. - **chunks**: A structure that represents a chunk in the NEAR blockchain. Chunk of a Block is a part of a Block from a Shard. The collection of Chunks of the Block forms the NEAR Protocol Block. Chunk contains all the structures that make the Block: Transactions, Receipts, and Chunk Header. - **transactions**: Transaction is the main way of interraction between a user and a blockchain. Transaction contains: Signer account ID, Receiver account ID, and Actions. - **execution_outcomes**: Execution outcome is the result of execution of Transaction or Receipt. In the result of the Transaction execution will always be a Receipt. - **receipt_details**: All cross-contract (we assume that each account lives in its own shard) communication in Near happens through Receipts. Receipts are stateful in a sense that they serve not only as messages between accounts but also can be stored in the account storage to await DataReceipts. Each receipt has a predecessor_id (who sent it) and receiver_id the current account. - **receipt_origin**: Tracks the transaction that originated the receipt. - **receipt_actions**: Action Receipt represents a request to apply actions on the receiver_id side. It could be derived as a result of a Transaction execution or another ACTION Receipt processing. Action kind can be: ADD_KEY, CREATE_ACCOUNT, DELEGATE_ACTION, DELETE_ACCOUNT, DELETE_KEY, DEPLOY_CONTRACT, FUNCTION_CALL, STAKE, TRANSFER. - **receipts (view)**: It's recommended to select only the columns and partitions (block_date) needed to avoid unnecessary query costs. This view join the receipt details, the transaction that originated the receipt and the receipt execution outcome. - **account_changes**: Each account has an associated state where it stores its metadata and all the contract-related data (contract's code + storage). # Examples - Queries: How many unique users do I have for my smart contract per day? ```sql SELECT r.block_date collected_for_day, COUNT(DISTINCT r.transaction_signer_account_id) FROM `bigquery-public-data.crypto_near_mainnet_us.receipt_actions` ra INNER JOIN `bigquery-public-data.crypto_near_mainnet_us.receipts` r ON r.receipt_id = ra.receipt_id WHERE ra.action_kind = 'FUNCTION_CALL' AND ra.receipt_receiver_account_id = 'near.social' -- change to your contract GROUP BY 1 ORDER BY 1 DESC; ``` # How to get started? 1. Login into your [Google Cloud Account](https://console.cloud.google.com/). 2. Open the [NEAR Protocol BigQuery Public Dataset](https://console.cloud.google.com/marketplace/product/bigquery-public-data/crypto-near-mainnet). 3. Click in the [VIEW DATASET](https://console.cloud.google.com/bigquery?p=bigquery-public-data&d=crypto_near_mainnet_us&page=dataset) button. 4. Click in the "+" to create a new tab and write your query, click in the "RUN" button, and check the "Query results" below the query. 5. Done :) # How much it costs? - NEAR pays for the storage and doesn't charge you to use the public dataset. To learn more about BigQuery public datasets check this [page](https://cloud.google.com/bigquery/public-data). - Google GCP charges for the queries that you perform on the data. For example, in today's price "Sep 1st, 2023" the On-demand (per TB) query pricing is $6.25 per TB where the first 1 TB per month is free. Please check the official Google's page for detailed pricing info, options, and best practices [here](https://cloud.google.com/bigquery/pricing#analysis_pricing_models). **Note:** You can check how much data it will query before running it in the BigQuery console UI. Again, since BigQuery uses a columnar data structure and partitions, it's recommended to select only the columns and partitions (block_date) needed to avoid unnecessary query costs. ![Query Costs](./docs/BQ_Query_Cost.png "BQ Query Costs") # References - https://cloud.google.com/bigquery/public-data - https://cloud.google.com/bigquery/pricing#analysis_pricing_models - https://docs.gcp.databricks.com/ingestion/auto-loader/index.html - https://www.databricks.com/product/delta-live-tables - https://docs.near.org/concepts/basics/protocol - https://docs.near.org/concepts/data-flow/near-data-flow - https://near-indexers.io/docs/data-flow-and-structures/structures/transaction#actionview - https://nomicon.io/RuntimeSpec/Receipts - https://nomicon.io/ - https://github.com/near/near-lake-indexer - https://github.com/near/near-indexer-for-explorer/
neon-tetra-labs_token-generator-contracts
.gitpod.yml Cargo.toml README-Windows.md README.md build.bat build.sh contract Cargo.toml src lib.rs nft_fractionalizer mod.rs sales mod.rs types.rs utils.rs flags.sh multi-token-standard-impl Cargo.toml README.md build.sh examples multi-token Cargo.toml build.sh mt Cargo.toml src lib.rs test-token-receiver Cargo.toml src lib.rs tests sim main.rs test_core.rs utils.rs multi_token Cargo.toml src core core_impl.rs mod.rs receiver.rs resolver.rs storage_impl.rs lib.rs macros.rs metadata.rs storage_management mod.rs token.rs utils.rs rustfmt.toml tests sim main.rs nft Cargo.toml src lib.rs rustfmt.toml scripts new-core-contract.sh new-nft-conftract.sh sim main.rs testing test_fractionalize.rs utils.rs specs tech.md workflows test.yml
# MultiToken Standard Experimentation This approach is to build a standard for erc-1155 for Near. This particular branch is to see the issues that arise from combining the FT Standard with the NFT Standard , and producing a collection of FT and NFTs. ## Build cargo build # Token Fractionalizing and Subsequent Sales The following smart contract found in the `contract` directory. The main purpose of the smart contract is to allow users to fractionalize a set of NFTs and subsequently sell them with a simple sales model. The fractionalize component basically means that a user can deposit some number of NFTs into a contract, the contract then locks up those NFTs and mints some number of Multi-Tokens (see the new [Multi Token proposal](https://github.com/near/NEPs/issues/246)). In order to redeem the NFTs, a caller has to burn all the supply of a fraction. These smart contracts make extensive use of the [Near internal balances plugin](https://docs.rs/near-internal-balances-plugin/latest/near_internal_balances_plugin/) alongside the [Near Accounts library](https://docs.rs/near-account/latest/near_account/). This contract also makes use of the [Multi Token Standard implementation](https://github.com/shipsgold/multi-token-standard-impl/tree/feat/initial-token). The public methods additionally exposed are defined by two traits, `NFTFractionalizeFns` and `SalesFns` are ```rust pub trait NftFractionalizerFns { /// Mints the new token /// * `mt_id`: The id of the new token. This id must be new and cannot have existed previously on this contract fn nft_fractionalize( &mut self, nfts: Vec<TokenId>, mt_id: MTTokenId, amount: U128, mt_owner: Option<AccountId>, token_metadata: MultiTokenMetadata, sale_amount: Option<U128>, sale_price_per_token: Option<U128>, ); /// Deletes the mt and releases the nfts. fn nft_fractionalize_unwrap(&mut self, mt_id: MTTokenId, release_to: Option<AccountId>); fn nft_fractionalize_update_mint_fee(&mut self, update: U128); fn nft_fractionalize_get_underlying(&self, mt_id: MTTokenId) -> Vec<TokenId>; fn nft_fractionalize_get_mint_fee(&self) -> U128; } pub trait SalesFns { fn sale_buy(&mut self, mt_id: MTTokenId, amount: U128); fn sale_info(&self, mt_id: MTTokenId) -> SaleOptionsSerial; fn sale_get_all_sales(&self) -> Vec<(MTTokenId, SaleOptionsSerial)>; } ``` as well as a `new` function ```rust /// Initializes the contract with the given total supply owned by the given `owner_id` with /// the given fungible token metadata. #[init] pub fn new( owner_id: Option<AccountId>, treasury: Option<AccountId>, nft_mint_fee_numerator: Option<U128>, sale_fee_numerator: Option<U128>, ); ``` Sample usage ============= For sample usage, please check out `sim/testing/utils.rs` and `sim/testing/test_fractionalize.rs`. Prerequisites ============= 1. Make sure Rust is installed per the prerequisites in [`near-sdk-rs`](https://github.com/near/near-sdk-rs#pre-requisites) 2. Ensure `near-cli` is installed by running `near --version`. If not installed, install with: `npm install -g near-cli` ## Building To build run: ```bash ./build.sh ``` Using this contract =================== ### Quickest deploy You can build and deploy this smart contract to a development account. [Dev Accounts](https://docs.near.org/docs/concepts/account#dev-accounts) are auto-generated accounts to assist in developing and testing smart contracts. Please see the [Standard deploy](#standard-deploy) section for creating a more personalized account to deploy to. ```bash near dev-deploy --wasmFile res/contract.wasm --helperUrl https://near-contract-helper.onrender.com ``` Behind the scenes, this is creating an account and deploying a contract to it. On the console, notice a message like: >Done deploying to dev-1234567890123 In this instance, the account is `dev-1234567890123`. A file has been created containing a key pair to the account, located at `neardev/dev-account`. To make the next few steps easier, we're going to set an environment variable containing this development account id and use that when copy/pasting commands. Run this command to the environment variable: ```bash source neardev/dev-account.env ``` You can tell if the environment variable is set correctly if your command line prints the account name after this command: ```bash echo $CONTRACT_NAME ``` The next command will initialize the contract using the `new` method: ```bash near call $CONTRACT_NAME new '{<ARGS>}' --accountId $CONTRACT_NAME ```
Peersyst_xrp-evm-bdjuno
.docs messages README.md bank.md crisis.md distribution.md gov.md slashing.md staking.md .github ISSUE_TEMPLATE bug_report.md feature_request.md PULL_REQUEST_TEMPLATE.md dependabot.yml workflows docker-build.yml lint-pr.yml lint.yml test.yml .mergify.yml CHANGELOG.md README.md Requirements.md cmd bdjuno main.go migrate cmd.go v1 config.go v3 migrate.go types.go utils.go parse auth cmd.go vesting.go bank cmd.go supply.go distribution cmd.go communitypool.go feegrant allowance.go cmd.go gov cmd.go proposal.go mint cmd.go inflation.go parse.go pricefeed cmd.go price.go pricehistory.go staking cmd.go staking.go validators.go database auth.go auth_test.go bank.go bank_test.go consensus.go consensus_test.go daily_refetch.go database.go database_test.go distribution.go distribution_test.go feegrant.go feegrant_test.go gov.go gov_test.go mint.go mint_test.go pricefeed.go pricefeed_test.go pruning.go schema 00-cosmos.sql 01-auth.sql 02-bank.sql 03-staking.sql 04-consensus.sql 05-mint.sql 06-distribution.sql 07-pricefeed.sql 08-gov.sql 09-modules.sql 10-slashing.sql 11-feegrant.sql 12-upgrade.sql slashing.go slashing_test.go staking_params.go staking_params_test.go staking_pool.go staking_pool_test.go staking_validators.go staking_validators_test.go types auth.go coins.go consensus.go distribution.go feegrant.go gov.go mint.go pricefeed.go slashing.go staking_params.go staking_pool.go staking_validators.go supply.go upgrade.go utils.go utils.go utils bank.go utils_test.go Moved from bank.sql for vesting account usage AUTH VESTING ACCOUNT start_time can be empty on DelayedVestingAccount SUPPLY PARAMS POOL VALIDATORS INFO DOUBLE SIGN EVIDENCE INFLATION COMMUNITY POOL TOKENS TOKEN PRICES Try updating with a lower height docker-compose.yml modules actions config.go handle_additional_operations.go handlers account_balance.go delegation.go delegation_total.go delegator_reward.go delegator_withdraw_address.go redelegation.go unbonding_delegation_total.go unbonding_delegations.go validator_commission.go validator_delegation.go validator_redelegations_from.go validator_unbonding_delegations.go logging prometheus.go utils.go module.go types handler.go payload.go response.go utils.go worker.go auth auth_accounts.go auth_vesting_accounts.go handle_genesis.go handle_msg.go module.go bank handle_periodic_operations.go module.go source local source.go remote source.go source_actions.go source.go consensus handle_block.go handle_genesis.go handle_periodic_operations.go module.go daily_refetch handle_periodic_operations.go module.go distribution handle_genesis.go handle_msg.go handle_periodic_operations.go module.go source local source.go remote source.go source_actions.go source.go utils_community_pool.go utils_params.go feegrant handle_block.go handle_msg.go module.go gov expected_modules.go handle_block.go handle_genesis.go handle_msg.go module.go source local source.go remote source.go source.go utils_params.go utils_proposal.go mint handle_genesis.go handle_periodic_operations.go module.go source local source.go remote source.go source.go utils_params.go modules handle_additional_operations.go module.go pricefeed coingecko apis.go apis_test.go types.go config.go handle_additional_operations.go handle_periodic_operations.go module.go registrar.go slashing handle_block.go handle_genesis.go module.go source local source.go remote source.go source.go utils_params.go utils_signing_info.go staking handle_block.go handle_genesis.go handle_msg.go handle_periodic_operations.go keybase apis.go types.go module.go source local source.go remote source.go source_actions.go source.go utils_gentx.go utils_params.go utils_staking_pool.go utils_validators.go types sources.go upgrade expected_modules.go handle_block.go module.go utils addresses.go addresses_test.go errors.go types auth.go bank.go config config.go encoding.go consensus.go distribution.go feegrant.go gov.go mint.go pricefeed.go slashing.go staking_double_vote.go staking_pool_params.go staking_validator.go utils genesis.go node.go utils.go
# BDJuno [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/forbole/bdjuno/Tests)](https://github.com/forbole/bdjuno/actions?query=workflow%3ATests) [![Go Report Card](https://goreportcard.com/badge/github.com/forbole/bdjuno)](https://goreportcard.com/report/github.com/forbole/bdjuno) ![Codecov branch](https://img.shields.io/codecov/c/github/forbole/bdjuno/cosmos/v0.40.x) BDJuno (shorthand for BigDipper Juno) is the [Juno](https://github.com/forbole/juno) implementation for [BigDipper](https://github.com/forbole/big-dipper). It extends the custom Juno behavior by adding different handlers and custom operations to make it easier for BigDipper showing the data inside the UI. All the chains' data that are queried from the RPC and gRPC endpoints are stored inside a [PostgreSQL](https://www.postgresql.org/) database on top of which [GraphQL](https://graphql.org/) APIs can then be created using [Hasura](https://hasura.io/). ## Usage To know how to setup and run BDJuno, please refer to the [docs website](https://docs.bigdipper.live/cosmos-based/parser/overview/). ## Testing If you want to test the code, you can do so by running ```shell $ make test-unit ``` **Note**: Requires [Docker](https://docker.com). This will: 1. Create a Docker container running a PostgreSQL database. 2. Run all the tests using that database as support. # Messages JSON formats This folder contains the example of all messages JSON contents that can be found inside a transaction's `msgs` field. **Note**. The contained messages are only related to the Cosmos SDK. Each custom chain, however, can define its own messages types containing arbitrary data. ### Index - [x/bank](bank.md) - [x/crisis](crisis.md) - [x/distribution](distribution.md) - [x/gov](gov.md) - [x/slashing](slashing.md) - [x/staking](staking.md)
PrinceDisant_Smart-Refrigerator
.history src simple assembly index_20220313164219.ts index_20220313165632.ts index_20220313165639.ts index_20220313165640.ts README.md as-pect.config.js asconfig.json package-lock.json package.json scripts 1.dev-deploy.sh 2.use-contract.sh 3.cleanup.sh README.md src as_types.d.ts simple __tests__ as-pect.d.ts index.unit.spec.ts asconfig.json assembly index.ts tsconfig.json utils.ts
# `near-sdk-as` Starter Kit This is a good project to use as a starting point for your AssemblyScript project. ## Samples This repository includes a complete project structure for AssemblyScript contracts targeting the NEAR platform. The example here is very basic. It's a simple contract demonstrating the following concepts: - a single contract - the difference between `view` vs. `change` methods - basic contract storage There are 2 AssemblyScript contracts in this project, each in their own folder: - **simple** in the `src/simple` folder - **singleton** in the `src/singleton` folder ### Simple We say that an AssemblyScript contract is written in the "simple style" when the `index.ts` file (the contract entry point) includes a series of exported functions. In this case, all exported functions become public contract methods. ```ts // return the string 'hello world' export function helloWorld(): string {} // read the given key from account (contract) storage export function read(key: string): string {} // write the given value at the given key to account (contract) storage export function write(key: string, value: string): string {} // private helper method used by read() and write() above private storageReport(): string {} ``` ### Singleton We say that an AssemblyScript contract is written in the "singleton style" when the `index.ts` file (the contract entry point) has a single exported class (the name of the class doesn't matter) that is decorated with `@nearBindgen`. In this case, all methods on the class become public contract methods unless marked `private`. Also, all instance variables are stored as a serialized instance of the class under a special storage key named `STATE`. AssemblyScript uses JSON for storage serialization (as opposed to Rust contracts which use a custom binary serialization format called borsh). ```ts @nearBindgen export class Contract { // return the string 'hello world' helloWorld(): string {} // read the given key from account (contract) storage read(key: string): string {} // write the given value at the given key to account (contract) storage @mutateState() write(key: string, value: string): string {} // private helper method used by read() and write() above private storageReport(): string {} } ``` ## Usage ### Getting started (see below for video recordings of each of the following steps) INSTALL `NEAR CLI` first like this: `npm i -g near-cli` 1. clone this repo to a local folder 2. run `yarn` 3. run `./scripts/1.dev-deploy.sh` 3. run `./scripts/2.use-contract.sh` 4. run `./scripts/2.use-contract.sh` (yes, run it to see changes) 5. run `./scripts/3.cleanup.sh` ### Videos **`1.dev-deploy.sh`** This video shows the build and deployment of the contract. [![asciicast](https://asciinema.org/a/409575.svg)](https://asciinema.org/a/409575) **`2.use-contract.sh`** This video shows contract methods being called. You should run the script twice to see the effect it has on contract state. [![asciicast](https://asciinema.org/a/409577.svg)](https://asciinema.org/a/409577) **`3.cleanup.sh`** This video shows the cleanup script running. Make sure you add the `BENEFICIARY` environment variable. The script will remind you if you forget. ```sh export BENEFICIARY=<your-account-here> # this account receives contract account balance ``` [![asciicast](https://asciinema.org/a/409580.svg)](https://asciinema.org/a/409580) ### Other documentation - See `./scripts/README.md` for documentation about the scripts - Watch this video where Willem Wyndham walks us through refactoring a simple example of a NEAR smart contract written in AssemblyScript https://youtu.be/QP7aveSqRPo ``` There are 2 "styles" of implementing AssemblyScript NEAR contracts: - the contract interface can either be a collection of exported functions - or the contract interface can be the methods of a an exported class We call the second style "Singleton" because there is only one instance of the class which is serialized to the blockchain storage. Rust contracts written for NEAR do this by default with the contract struct. 0:00 noise (to cut) 0:10 Welcome 0:59 Create project starting with "npm init" 2:20 Customize the project for AssemblyScript development 9:25 Import the Counter example and get unit tests passing 18:30 Adapt the Counter example to a Singleton style contract 21:49 Refactoring unit tests to access the new methods 24:45 Review and summary ``` ## The file system ```sh ├── README.md # this file ├── as-pect.config.js # configuration for as-pect (AssemblyScript unit testing) ├── asconfig.json # configuration for AssemblyScript compiler (supports multiple contracts) ├── package.json # NodeJS project manifest ├── scripts │   ├── 1.dev-deploy.sh # helper: build and deploy contracts │   ├── 2.use-contract.sh # helper: call methods on ContractPromise │   ├── 3.cleanup.sh # helper: delete build and deploy artifacts │   └── README.md # documentation for helper scripts ├── src │   ├── as_types.d.ts # AssemblyScript headers for type hints │   ├── simple # Contract 1: "Simple example" │   │   ├── __tests__ │   │   │   ├── as-pect.d.ts # as-pect unit testing headers for type hints │   │   │   └── index.unit.spec.ts # unit tests for contract 1 │   │   ├── asconfig.json # configuration for AssemblyScript compiler (one per contract) │   │   └── assembly │   │   └── index.ts # contract code for contract 1 │   ├── singleton # Contract 2: "Singleton-style example" │   │   ├── __tests__ │   │   │   ├── as-pect.d.ts # as-pect unit testing headers for type hints │   │   │   └── index.unit.spec.ts # unit tests for contract 2 │   │   ├── asconfig.json # configuration for AssemblyScript compiler (one per contract) │   │   └── assembly │   │   └── index.ts # contract code for contract 2 │   ├── tsconfig.json # Typescript configuration │   └── utils.ts # common contract utility functions └── yarn.lock # project manifest version lock ``` You may clone this repo to get started OR create everything from scratch. Please note that, in order to create the AssemblyScript and tests folder structure, you may use the command `asp --init` which will create the following folders and files: ``` ./assembly/ ./assembly/tests/ ./assembly/tests/example.spec.ts ./assembly/tests/as-pect.d.ts ``` ## Setting up your terminal The scripts in this folder are designed to help you demonstrate the behavior of the contract(s) in this project. It uses the following setup: ```sh # set your terminal up to have 2 windows, A and B like this: ┌─────────────────────────────────┬─────────────────────────────────┐ │ │ │ │ │ │ │ A │ B │ │ │ │ │ │ │ └─────────────────────────────────┴─────────────────────────────────┘ ``` ### Terminal **A** *This window is used to compile, deploy and control the contract* - Environment ```sh export CONTRACT= # depends on deployment export OWNER= # any account you control # for example # export CONTRACT=dev-1615190770786-2702449 # export OWNER=sherif.testnet ``` - Commands _helper scripts_ ```sh 1.dev-deploy.sh # helper: build and deploy contracts 2.use-contract.sh # helper: call methods on ContractPromise 3.cleanup.sh # helper: delete build and deploy artifacts ``` ### Terminal **B** *This window is used to render the contract account storage* - Environment ```sh export CONTRACT= # depends on deployment # for example # export CONTRACT=dev-1615190770786-2702449 ``` - Commands ```sh # monitor contract storage using near-account-utils # https://github.com/near-examples/near-account-utils watch -d -n 1 yarn storage $CONTRACT ``` --- ## OS Support ### Linux - The `watch` command is supported natively on Linux - To learn more about any of these shell commands take a look at [explainshell.com](https://explainshell.com) ### MacOS - Consider `brew info visionmedia-watch` (or `brew install watch`) ### Windows - Consider this article: [What is the Windows analog of the Linux watch command?](https://superuser.com/questions/191063/what-is-the-windows-analog-of-the-linuo-watch-command#191068)
laitsky_decentralized-social-media
README.md package.json public index.html manifest.json robots.txt src App.js App.test.js components posts.js config.js index.css index.js pages Account.js Explore.js FollowList.js Home.js Login.js PostDetail.js Profile.js Register.js reportWebVitals.js serviceWorker.js setupTests.js test-utils.js utils.js
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Decentralized Social Media Fully on-chain Twitter-like social media built with on NEAR Protocol and NEAR Rust SDK, deployed on mainnet. **Click [here](sosmed-client.vercel.app/) to visit deployed app. (mainnet)** **Smart contract repository could be visited through this [link](https://github.com/laitsky/near-sosmed-contracts/tree/main/main-contract)** Available features of this application is written on the smart contract repo. Some screenshots of the existing app: Home: [![home-ui.png](https://i.postimg.cc/fTCNpsJq/home-ui.png)](https://postimg.cc/GH4VTZPv) Explore: [![explore.png](https://i.postimg.cc/rFQBg9Pv/explore.png)](https://postimg.cc/GHTgmvrQ) Post details: [![post-detail.png](https://i.postimg.cc/rFHkMJN5/post-detail.png)](https://postimg.cc/F70qx0qK) My profile: [![my-profile.png](https://i.postimg.cc/RC8ffrM8/my-profile.png)](https://postimg.cc/grVnFTLq) Account settings: [![account.png](https://i.postimg.cc/yYcP86Fn/account.png)](https://postimg.cc/zVDWdr2R) Following: [![following.png](https://i.postimg.cc/k4yCCPT5/following.png)](https://postimg.cc/9RzKPK53) ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.<br /> Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.<br /> You will also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.<br /> See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `npm run build` Builds the app for production to the `build` folder.<br /> It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.<br /> Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting ### Analyzing the Bundle Size This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size ### Making a Progressive Web App This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app ### Advanced Configuration This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration ### Deployment This section has moved here: https://facebook.github.io/create-react-app/docs/deployment ### `npm run build` fails to minify This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
HAPIprotocol_near-proxy-contract
CHANGELOG.md README.md | contract Cargo.toml build_docker.sh build_local.sh neardev dev-account.env src lib.rs tests sim main.rs neardev dev-account.env
# HAPI Protocol [HAPI Protocol] is a one-of-a-kind decentralized security protocol that prevents and interrupts any potential malicious activity within the blockchain space. HAPI Protocol works by leveraging both external and off-chain data as well as on-chain data accrued directly by HAPI Protocol and is publicly available. ## HAPI NEAR Proxy The HAPI NEAR Proxy is a smart contract used for replicating data from [HAPI Protocol] main contract on the NEAR blockchain. It acts as an interface between the HAPI Protocol and the NEAR blockchain, allowing data to be replicated from the protocol by oracles. Reporters are entities added to the contract by the protocol authority which can report data to the protocol. To check an address of interest for security data, consumers should call the `get_address` method. ## Methods Each role can call its methods and the methods of roles below it. ### Owner methods - new - initialize contract. - change_owner - transfer ownership to new owner. ### Authority methods - create_reporter - add new reporter with corresponding permission level. - update_reporter - update permission level for reporter. ### Reporter methods - create_address - add new address with corresponding category and risk level - update_address - update address category and risk. ### User methods - get_address - return risk level and category. - get_reporter - return permission level. ## Integration Consumers can integrate the HAPI NEAR Proxy Contract using the [hapi-near-connector](https://github.com/HAPIProtocol/hapi-near-connector).This crate helps to implement [HAPI Protocol] in your smart contract on the NEAR blockchain. Alternatively, consumers can do it directly. As an example, [Jumbo Exchange](https://github.com/jumbo-exchange/contracts#hapi-protocol-integration) has integrated the HAPI NEAR Proxy Contract into their platform. ## For developers ### CLI installation You can install cli via this [tutorial](https://docs.near.org/docs/tools/near-cli#installation) ### Getting started For creating the new account for deploying contract use next command. Create variables ```bash export NEAR_ENV=testnet export CONTRACT_ID=contract.hapi-test.testnet export OWNER_ID=hapi-test.testnet export REPORTER_ID=reporter.hapi-test.testnet ``` ```bash near create-account $CONTRACT_ID --masterAccount $OWNER_ID --initialBalance 10 ``` First of all - you will need to compile the wasm file of contract. ```bash ./contract/build_docker.sh ``` Then deploy it. ```bash near deploy $CONTRACT_ID --wasmFile=contract/res/proxy_contract_release.wasm ``` Then initialize contract with command where OWNER_ID is your admin UI account. ```bash near call $CONTRACT_ID new '{"owner_id": "'$OWNER_ID'"}' --accountId $CONTRACT_ID ``` ## Useful commands - NEW ```bash near call $CONTRACT_ID new '{"owner_id": "'$OWNER_ID'"}' --account_id=$OWNER_ID ``` - CHANGE OWNER ```bash near call $CONTRACT_ID change_owner '{"owner_id": "NEW_OWNER_ID"}' --account_id=$OWNER_ID ``` - CREATE REPORTER - address - account_id of reporter - permission_level - permission level corresponding to the table | Role | permission_level | | ------ | ------ | | Reporter | 1 | | Authority | 2 | ```bash near call $CONTRACT_ID create_reporter '{"address": "'$REPORTER_ID'", "permission_level": 2}' --account_id=$OWNER_ID ``` - UPDATE REPORTER - address - account_id of reporter - permission_level - permission level corresponding to the table | Role | permission_level | | ------ | ------ | | Reporter | 1 | | Authority | 2 | ```bash near call $CONTRACT_ID update_reporter '{"address": "'$REPORTER_ID'", "permission_level": 1 }' --accountId=$OWNER_ID ``` - GET REPORTER Returns permission level of reporter | Role | permission_level | | ------ | ------ | | Reporter | 1 | | Authority | 2 | ```bash near call $CONTRACT_ID get_reporter '{"address": "'$REPORTER_ID'" }' --accountId=$OWNER_ID ``` - CREATE ADDRESS - address - address which should be updated - category - category from list of [Categories] - risk - risk level also described in [Categories] section ```bash near call $CONTRACT_ID create_address '{"address": "address.id", "category": "Scam", "risk": 6}' --accountId=$REPORTER_ID ``` - UPDATE ADDRESS - address - address which should be updated - category - category from list of [Categories] - risk - risk level also described in [Categories] section ```bash near call $CONTRACT_ID update_address '{"address": "address.id", "category": "WalletService", "risk": 6}' --accountId=$REPORTER_ID ``` - GET ADDRESS This method returns tuple of Category and u8 (risk level). List of [Categories]. ```bash near view $CONTRACT_ID get_address '{"address": "address.id"}' ``` ## Categories If the address belongs to some category, it will have a Risk score (on a scale from 0..10, i.e. max risk). | Category | Description | |----------|-------| | None | | | WalletService | Wallet service - custodial or mixed wallets | | MerchantService | Merchant service | | MiningPool | Mining pool | | LowRiskExchange | Low-risk exchange - Exchange with high KYC standards | | MediumRiskExchange | Medium risk exchange | | DeFi | DeFi application | | OTCBroker | OTC Broker | | ATM | Cryptocurrency ATM | | Gambling | Gambling | | IllicitOrganization | Illicit organization | | Mixer | Mixer | | DarknetService | Darknet market or service | | Scam | Scam | | Ransomware | Ransomware | | Theft | Theft - stolen funds | | Counterfeit | Counterfeit - fake assets | | TerroristFinancing | Terrorist financing | | ChildAbuse | Child abuse and porn materials | [HAPI Protocol]: https://hapi-one.gitbook.io/hapi-protocol/ [Categories]: (#categories)
NEAR-Edu_contract-registry
.vscode settings.json Cargo.toml build.sh contract Cargo.toml README.md src contract.rs lib.rs ownership.rs utils.rs deploy.sh dev-deploy.sh docker-compose.yml init-args.js model Cargo.toml src code_hash.rs lib.rs sequential_id.rs verification.rs prettier.config.js rustfmt.toml service Cargo.toml network mainnet.json testnet.json src circleci client.rs error.rs mod.rs signature.rs webhook.rs contract_interaction change.rs mod.rs view.rs watch.rs env.rs main.rs network_config.rs repository mod.rs
# NEAR Smart Contract Rust Template Project structure for writing smart contracts in Rust for NEAR Protocol # Dependencies - Rust 1.56 - Node.js 14 - NEAR CLI 3.1 # Authors - Jacob Lindahl <[email protected]> [@sudo_build](https://twitter.com/sudo_build)
On0n0k1_smart-contract-interaction
README.md lib db.js near_functions get_account.js get_block_hash.js get_fungible_tokens.js get_non_fungible_tokens.js get_transaction_from_hash.js get_transactions.js next.config.js package.json pages [network] [account].js _app.js api fungible_tokens [accountId].js non_fungible_tokens [accountId].js transactions [accountId].js index.js postcss.config.js public vercel.svg styles globals.css tailwind.config.js
# A simple NEAR Explorer ## About This is just a small webpage that loads information about a NEAR Account. Currently it only works for Testnet accounts. Intended for developers interested in learning how a wallet app works. ## How to run - Step 1: Install dependencies. ```bash yarn install ``` - Step 2: Run. ```bash npm run dev ``` - Step 3: Open a web browser and go for localhost:3000. - Step 4: Offer a testnet account name and select "Search". - Step 5: On the following page, you can press F12 to see all the loaded data. There will be **a lot**. ## Directory Structure - ```'/components'```: React components for account, transaction history, etc. - ```'/pages'```: Page structure. Index will be '/'. '/[network]/[account].js' will be '/[network]/[account]', where [] represents the value for each variable. ## More details Check My [blog post](https://hackmd.io/@9YrH7KebTM2T6vr9eFW7Qg/SyPT1ZiRc);
JobDAO_joba-MVP
.gitpod.yml README.md babel.config.js contract Cargo.toml README.md compile.js src lib.rs package.json src App.js __mocks__ fileMock.js assets logo-black.svg logo-white.svg config.js global.css index.html index.js jest.init.js main.test.js utils.js wallet login index.html
joba Smart Contract ================== A [smart contract] written in [Rust] for an app initialized with [create-near-app] Quick Start =========== Before you compile this code, you will need to install Rust with [correct target] Exploring The Code ================== 1. The main smart contract code lives in `src/lib.rs`. You can compile it with the `./compile` script. 2. Tests: You can run smart contract tests with the `./test` script. This runs standard Rust tests using [cargo] with a `--nocapture` flag so that you can see any debug info you print to the console. [smart contract]: https://docs.near.org/docs/develop/contracts/overview [Rust]: https://www.rust-lang.org/ [create-near-app]: https://github.com/near/create-near-app [correct target]: https://github.com/near/near-sdk-rs#pre-requisites [cargo]: https://doc.rust-lang.org/book/ch01-03-hello-cargo.html joba <a href="https://jobdao-jobamvp-rm87pb2gd03.ws-us47.gitpod.io/"> <img src="https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod" alt="Contribute with Gitpod" /> </a> ================== This [React] app was initialized with [create-near-app] Quick Start =========== To run this project locally: 1. Prerequisites: Make sure you've installed [Node.js] ≥ 12 2. Install dependencies: `yarn install` 3. Run the local development server: `yarn dev` (see `package.json` for a full list of `scripts` you can run with `yarn`) Now you'll have a local development environment backed by the NEAR TestNet! Go ahead and play with the app and the code. As you make code changes, the app will automatically reload. Exploring The Code ================== 1. The "backend" code lives in the `/contract` folder. See the README there for more info. 2. The frontend code lives in the `/src` folder. `/src/index.html` is a great place to start exploring. Note that it loads in `/src/index.js`, where you can learn how the frontend connects to the NEAR blockchain. 3. Tests: there are different kinds of tests for the frontend and the smart contract. See `contract/README` for info about how it's tested. The frontend code gets tested with [jest]. You can run both of these at once with `yarn run test`. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `yarn dev`, your smart contract gets deployed to the live NEAR TestNet with a throwaway account. When you're ready to make it permanent, here's how. Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `yarn install`, but for best ergonomics you may want to install it globally: yarn install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `joba.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `joba.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account joba.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: set contract name in code --------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'joba.YOUR-NAME.testnet' Step 3: deploy! --------------- One command: yarn deploy As you can see in `package.json`, this does two things: 1. builds & deploys smart contract to NEAR TestNet 2. builds & deploys frontend code to GitHub using [gh-pages]. This will only work if the project already has a repository set up on GitHub. Feel free to modify the `deploy` script in `package.json` to deploy elsewhere. Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [React]: https://reactjs.org/ [create-near-app]: https://github.com/near/create-near-app [Node.js]: https://nodejs.org/en/download/package-manager/ [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/docs/concepts/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli [gh-pages]: https://github.com/tschaub/gh-pages testing webhook for discord
NEARFoundation_near-java-api
.github workflows build.yml generate-pages.yml gh-docs.yml publish.yml .idea codeStyles codeStyleConfig.xml compiler.xml encodings.xml jarRepositories.xml misc.xml vcs.xml .mvn local-settings.xml wrapper MavenWrapperDownloader.java .vscode settings.json CONTRIBUTING.md README.md mvnw.cmd near-java-api-common pom.xml src main java com syntifi near api common exception NearErrorData.java NearException.java NoSuchTypeException.java helper Formats.java Network.java Strings.java json JsonHelper.java model common Base64String.java ChangeCause.java EncodedHash.java key KeySig.java KeyType.java PrivateKey.java PublicKey.java Signature.java Wallet.java service NearObjectMapper.java WalletService.java test java com syntifi near api common helper FormatsTest.java key AbstractKeyTest.java KeySigTest.java PrivateKeyTest.java PublicKeyTest.java SignatureTest.java WalletTest.java service WalletServiceTest.java resources testnet-wallets alice.json bob.json near-java-api-indexer pom.xml src main java com syntifi near api indexer NearIndexerClient.java exception NearIndexerException.java json deserializer NearValueDeserializer.java RecentActivityItemDeserializer.java model AccountIdList.java NearValue.java RecentActivity.java RecentActivityAccessKey.java RecentActivityArg.java RecentActivityArgAddKey.java RecentActivityArgCreateAccount.java RecentActivityArgDeleteAccount.java RecentActivityArgDeleteKey.java RecentActivityArgDeployContract.java RecentActivityArgFunctionCall.java RecentActivityArgStake.java RecentActivityArgTransfer.java RecentActivityItem.java RecentActivityPermission.java StakingDeposit.java test java com syntifi near api indexer service NearIndexerClientHelper.java NearIndexerClientTest.java near-java-api-rpc pom.xml src main java com syntifi near api rpc NearClient.java NearRpcObjectMapper.java json deserializer AbstractAnyOfDeserializer.java PermissionDeserializer.java resolver PermissionResolver.java serializer ByteArraySerializer.java jsonrpc4j exception NearExceptionResolver.java model accesskey AccessKey.java AccessKeyChange.java AccessKeyChangeDetails.java AccessKeyChanges.java AccessKeyList.java AccessKeyListItem.java Key.java permission FullAccessPermission.java FunctionCallPermission.java FunctionCallPermissionData.java Permission.java PermissionTypeData.java account Account.java AccountChange.java AccountChangeDetails.java AccountChanges.java block Block.java BlockChange.java BlockChanges.java BlockHeader.java Chunk.java ChunkHeader.java ValidatorProposal.java contract ContractCode.java ContractCodeChange.java ContractCodeChangeDetails.java ContractCodeChanges.java ContractFunctionCallResult.java ContractState.java ContractStateChange.java ContractStateChangeDetails.java ContractStateChanges.java ContractStateDetails.java gas GasPrice.java identifier Finality.java network CurrentProposal.java Fisherman.java NetworkInfo.java NodeStatus.java NotEnoughBlocksReason.java NotEnoughChunksReason.java Peer.java PrevEpochKickout.java Producer.java Reason.java SyncInfo.java ValidationStatus.java Validator.java Version.java protocol AccountCreationConfig.java ActionCreationConfig.java AddKeyCost.java Cost.java DataReceiptCreationConfig.java ExtCosts.java GenesisConfig.java LimitConfig.java ProtocolConfig.java RuntimeConfig.java ShardLayout.java SimpleNightShadeShardLayout.java StorageUsageConfig.java TransactionCosts.java WasmConfig.java transaction Action.java AddKeyAction.java CostType.java CreateAccountAction.java DeleteAccountAction.java DeleteKeyAction.java DeployContractAction.java FailureStatus.java FunctionCallAction.java GasProfile.java Metadata.java Outcome.java Proof.java Receipt.java ReceiptAction.java ReceiptData.java ReceiptOutcome.java SignedTransaction.java StakeAction.java Status.java SuccessReceiptIdStatus.java SuccessValueStatus.java Transaction.java TransactionAwait.java TransactionOutcome.java TransactionStatus.java TransferAction.java error ActionError.java TxExecutionError.java service AccountService.java BaseService.java KeyService.java TransferService.java contract common ContractClient.java ContractMethodProxy.java ContractMethodProxyClient.java ContractViewMethodCaller.java FunctionCall.java FunctionCallResult.java annotation ContractMethod.java ContractMethodType.java param AccountIdParam.java ContractMethodParams.java ConvertibleToBase64String.java ft FTService.java param FTTransferParam.java nft NFTService.java model NFTContract.java NFTContractMetadata.java NFTToken.java NFTTokenList.java NFTTokenMetadata.java param NFTTokensForOwnerParam.java NFTTokensParam.java staking StakingService.java test java com syntifi near api rpc NearClientArchivalNetHelper.java NearClientTest.java NearClientTestnetHelper.java model accesskey permission PermissionMethodTypeDataTest.java service AccountServiceTest.java TransferServiceTest.java ft FTServiceTest.java nft NFTServiceTest.java staking StakingServiceTest.java resources json-test-samples access-key example view-access-key-changes-all.json view-access-key-changes-single.json view-access-key-list.json view-access-key.json view-access-key-changes-all-invalid-permission-2.json view-access-key-changes-all-invalid-permission-property.json view-access-key-list-by-hash.json view-access-key-list-by-height.json view-access-key.json accounts-contracts call-a-contract-function.json example call-a-contract-function.json view-account-changes.json view-account.json view-contract-code-changes.json view-contract-code.json view-contract-state-changes.json view-contract-state.json view-account-changes.json view-account.json view-contract-code-changes.json view-contract-code.json view-contract-state-changes.json block-chunk block-details-by-hash.json block-details-by-height.json changes-in-block-by-hash.json changes-in-block-by-height.json chunk-details.json example block-details.json changes-in-block.json chunk-details.json error invalid-error.json valid-error.json gas example gas-price.json gas-price-by-block-hash.json gas-price-by-block-height.json gas-price-by-null.json network example network-info.json node-status.json validation-status.json node-status.json protocol example genesis-config.json protocol-config.json genesis-config.json protocol-config-final.json protocol-config.json transaction example receipt-by-id.json send-transaction-async.json send-transaction-await.json transaction-status-failure.json transaction-status-with-receipts.json transaction-status.json receipt.json send-transaction-await.json transaction-status-by-hash-with-receipt.json transaction-status-by-hash.json pom.xml
# NEAR Java 8+ API This project implements the API to interact with a NEAR Node. It wraps the Json-RPC requests and maps the results to Java objects. ## Dependencies - Java 8+ - Maven (via wrapper) ## Build instructions ``` ./mvnw package ``` ## Using the Maven Central repository ### Using Maven ``` xml <dependency> <groupId>com.syntifi.near</groupId> <artifactId>near-java-api</artifactId> <version>0.1.0</version> </dependency> ``` ### Using gradle ``` groovy implementation 'com.syntifi.near:near-java-api:0.1.0' ``` ## References This project used the following references: - Official docs @ [docs.near.org](https://docs.near.org/docs/api/rpc/) ## How to ### 1. [Set-up a connection](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceHelper.java#L21) ``` java nearClient = NearService.usingPeer("archival-rpc.testnet.near.org"); ``` ### 2. [Access Keys](https://docs.near.org/docs/api/rpc/access-keys#access-keys) #### 2.1 [View access key](https://docs.near.org/docs/api/rpc/access-keys#view-access-key) Returns information about a single access key for given account. If permission of the key is FunctionCall, it will return more details such as the allowance, receiver_id, and method_names. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L585-L588) ``` java String accountId = "client.chainlink.testnet"; String publicKey = "ed25519:H9k5eiU4xXS3M4z8HzKJSLaZdqGdGwBG49o7orNC4eZW"; AccessKey accessKey = nearClient.viewAccessKey(Finality.FINAL, accountId, publicKey); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L610-L613) ``` java String accountId = "client.chainlink.testnet"; String publicKey = "ed25519:H9k5eiU4xXS3M4z8HzKJSLaZdqGdGwBG49o7orNC4eZW"; AccessKey accessKey = nearClient.viewAccessKey(78443365, accountId, publicKey); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L595-L599) ``` java String accountId = "client.chainlink.testnet"; String publicKey = "ed25519:H9k5eiU4xXS3M4z8HzKJSLaZdqGdGwBG49o7orNC4eZW"; AccessKey accessKey = nearClient.viewAccessKey("8bVg8wugs2QHqXr42oEsCYyH7jvR9pLaAP35dFqx2evU", accountId, publicKey); ``` #### 2.2 [View access key list](https://docs.near.org/docs/api/rpc/access-keys#view-access-key-list) Returns all access keys for a given account. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L637-L639) ``` java String accountId = "client.chainlink.testnet"; AccessKeyList accessKeyList = nearClient.viewAccessKeyList(Finality.FINAL, accountId); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L660-L662) ``` java String accountId = "client.chainlink.testnet"; AccessKeyList accessKeyList = nearClient.viewAccessKeyList(78772585, accountId); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L646-L649) ``` java String accountId = "client.chainlink.testnet"; AccessKeyList accessKeyList = nearClient.viewAccessKeyList("DwFpDPiQXBaX6Vw3aKazQ4nXjgzw1uk6XpUkfTSJrbXf", accountId); ``` #### 2.3 [View access key changes (single)](https://docs.near.org/docs/api/rpc/access-keys#view-access-key-changes-single) Returns individual access key changes in a specific block. You can query multiple keys by passing an array of objects containing the account_id and public_key. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L688-L793) ``` java Key[] keys = new Key[1]; Key key0 = new Key("example-acct.testnet", "ed25519:25KEc7t7MQohAJ4EDThd2vkksKkwangnuJFzcoiXj9oM"); keys[0] = key0; AccessKeyChanges accessKeyChanges = nearClient.viewSingleAccessKeyChanges(Finality.FINAL, keys); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L718-L723) ``` java Key[] keys = new Key[1]; Key key0 = new Key("example-acct.testnet", "ed25519:25KEc7t7MQohAJ4EDThd2vkksKkwangnuJFzcoiXj9oM"); keys[0] = key0; AccessKeyChanges accessKeyChanges = nearClient.viewSingleAccessKeyChanges(78433961, keys); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L702-L709) ``` java Key[] keys = new Key[1]; Key key0 = new Key("example-acct.testnet", "ed25519:25KEc7t7MQohAJ4EDThd2vkksKkwangnuJFzcoiXj9oM"); keys[0] = key0; AccessKeyChanges accessKeyChanges = nearClient.viewSingleAccessKeyChanges("Cr82U81VqHgCz9LzZjPivh9t16e8es6aFCv9qvDMMH88", keys); ``` #### 2.4 [View access key changes (all)](https://docs.near.org/docs/api/rpc/access-keys#view-access-key-changes-all) Returns changes to all access keys of a specific block. Multiple accounts can be quereied by passing an array of account_ids. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L763-L767) ``` java String[] accountIds = new String[1]; accountIds[0] = "client.chainlink.testnet"; AccessKeyChanges accessKeyChanges = nearClient.viewAllAccessKeyChanges(Finality.FINAL, accountIds); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L791-L795) ``` java String[] accountIds = new String[1]; accountIds[0] = "client.chainlink.testnet"; AccessKeyChanges accessKeyChanges = nearClient.viewAllAccessKeyChanges(78433518, accountIds); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L776-L782) ``` java String[] accountIds = new String[1]; accountIds[0] = "client.chainlink.testnet"; AccessKeyChanges accessKeyChanges = nearClient.viewAllAccessKeyChanges("Ais9kPbHvk6XmEYptoEpBtyFW77V16TZNHHnYtmXWr1d",accountIds); ``` ### 3. [Accounts / Contracts](https://docs.near.org/docs/api/rpc/contracts) #### 3.1 [View account](https://docs.near.org/docs/api/rpc/contracts#view-account) Returns basic account information. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L815) ``` java Account account = nearClient.viewAccount(Finality.FINAL, "nearkat.testnet"); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L833) ``` java Account account = nearClient.viewAccount(78439658, "nearkat.testnet"); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L822) ``` java Account account = nearClient.viewAccount("5hyGx7LiGaeRiAN4RrKcGomi1QXHqZwKXFQf6xTmvUgb", "nearkat.testnet"); ``` #### 3.2 [View account changes](https://docs.near.org/docs/api/rpc/contracts#view-account-changes) Returns account changes from transactions in a given account. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L859-L863) ``` java String[] accountIds = new String[1]; accountIds[0] = "nearkat.testnet"; AccountChanges accountChanges = nearClient.viewAccountChanges(Finality.FINAL, accountIds); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L890-L894) ``` java String[] accountIds = new String[1]; accountIds[0] = "nearkat.testnet"; AccountChanges accountChanges = nearClient.viewAccountChanges(78440142, accountIds); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L872-L877) ``` java String[] accountIds = new String[1]; accountIds[0] = "nearkat.testnet"; AccountChanges accountChanges = nearClient.viewAccountChanges("7vWp2djKLoJ3RE1sr8RzSKQtyzKpe2wZ7NCcDuFNuL7j", accountIds); ``` #### 3.3 [View contract code](https://docs.near.org/docs/api/rpc/contracts#view-contract-code) Returns the contract code (Wasm binary) deployed to the account. Please note that the returned code will be encoded in base64. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L918) ``` java ContractCode contractCode = nearClient.viewContractCode(Finality.FINAL, "guest-book.testnet"); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L937) ``` java ContractCode contractCode = nearClient.viewContractCode(78440518, "guest-book.testnet"); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L925-L926) ``` java ContractCode contractCode = nearClient.viewContractCode("uLxyauKPhSk1tebYKi3k69pHSaT2ZLzWy4JwtGm52pu", "guest-book.testnet"); ``` #### 3.4 [View contract state](https://docs.near.org/docs/api/rpc/contracts#view-contract-state) Returns the state (key value pairs) of a contract based on the key prefix (base64 encoded). Pass an empty string for prefix_base64 if you would like to return the entire state. Please note that the returned state will be base64 encoded as well. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L963-L964) ``` java ContractState contractState = nearClient.viewContractState(Finality.FINAL, "guest-book.testnet", ""); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L990-L991) ``` java ContractState contractState = nearClient.viewContractState(78440679, "guest-book.testnet", ""); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L974-L975) ``` java ContractState contractState = nearClient.viewContractState("342bkjvnzoZ7FGRE5BwDVkzSRUYXAScTz3GsDB9sEHXg", "guest-book.testnet", ""); ``` #### 3.5 [View contract state changes](https://docs.near.org/docs/api/rpc/contracts#view-contract-state-changes) Returns the state change details of a contract based on the key prefix (encoded to base64). Pass an empty string for this param if you would like to return all state changes. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1019-L1024) ``` java String[] accountIds = new String[1]; accountIds[0] = "guest-book.testnet"; ContractStateChanges contractStateChanges = nearClient.viewContractStateChanges(Finality.FINAL, accountIds, ""); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1052-L1056) ``` java String[] accountIds = new String[1]; accountIds[0] = "guest-book.testnet"; ContractStateChanges contractStateChanges = nearClient.viewContractStateChanges(78441183, accountIds, ""); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1033-L1039) ``` java String[] accountIds = new String[1]; accountIds[0] = "guest-book.testnet"; ContractStateChanges contractStateChanges = nearClient.viewContractStateChanges("5KgQ8uu17bhUPnMUbkmciHxbpFvsbhwdkJu4ptRfR7Zn", accountIds, ""); ``` #### 3.6 [View contract code changes](https://docs.near.org/docs/api/rpc/contracts#view-contract-code-changes) Returns code changes made when deploying a contract. Change is returned is a base64 encoded WASM file. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1083-L1087) ``` java String[] accountIds = new String[1]; accountIds[0] = "dev-1602714453032-7566969"; ContractCodeChanges contractCodeChanges = nearClient.viewContractCodeChanges(Finality.FINAL, accountIds); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1115-L1119) ``` java String[] accountIds = new String[1]; accountIds[0] = "dev-1602714453032-7566969"; ContractCodeChanges contractCodeChanges = nearClient.viewContractCodeChanges(78441560, accountIds); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1096-L1102) ``` java String[] accountIds = new String[1]; accountIds[0] = "dev-1602714453032-7566969"; ContractCodeChanges contractCodeChanges = nearClient.viewContractCodeChanges("HpsjZvjtuxarKRsXGVrgB6qtuCcHRgx3Xof1gfT2Jfj7", accountIds); ``` #### 3.7 [Call a contract function](https://docs.near.org/docs/api/rpc/contracts#call-a-contract-function) Allows you to call a contract method as a [view function](https://docs.near.org/docs/develop/contracts/as/intro#view-and-change-functions). #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1145-L1150) ``` java ContractFunctionCallResult contractFunctionCallResult = nearClient .callContractFunction( Finality.FINAL, "guest-book.testnet", "getMessages", "e30="); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1189-L1193) ``` java ContractFunctionCallResult contractFunctionCallResult = nearClient .callContractFunction(79272492, "guest-book.testnet", "getMessages", "e30="); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L1157-L1162) ``` java ContractFunctionCallResult contractFunctionCallResult = nearClient .callContractFunction( "J5QTB4Stz3iwtHvgr5KnVzNUgzm4J1bE5Et6JWrJPC8o", "guest-book.testnet", "getMessages", "e30="); ``` ### 4. [Block / Chunk](https://docs.near.org/docs/api/rpc/block-chunk) #### 4.1 [Block details](https://docs.near.org/docs/api/rpc/block-chunk#block-details) Queries network and returns block for given height or hash. You can also use finality param to return latest block details. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L79) ``` java Block block = nearClient.getBlock(Finality.FINAL); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L110) ``` java Block block = nearClient.getBlock(78770817); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L86) ``` java Block block = nearClient.getBlock("FXTWzPjqWztjHfneqJb9cBDB2QLTY1Rja4GHrswAv1b9"); ``` #### 4.2 [Changes in Block](https://docs.near.org/docs/api/rpc/block-chunk#changes-in-block) Returns changes in block for given block height or hash. You can also use finality param to return latest block details. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L134) ``` java BlockChanges blockChanges = nearClient.getBlockChanges(Finality.FINAL); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L152) ``` java BlockChanges blockChanges = nearClient.getBlockChanges(78770674); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L141) ``` java BlockChanges blockChanges = nearClient.getBlockChanges("BmEZnrmov6h6rMPpWkMV2JtU1C5LP563V5Y5yXwUW2N5"); ``` #### 4.3 [Chunk Details](https://docs.near.org/docs/api/rpc/block-chunk#chunk-details) Returns details of a specific chunk. You can run a block details query to get a valid chunk hash. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L176) ``` java Chunk chunk = nearClient.getChunkDetails("9mdG2cRcV8Dsb1EoSjtya81NddjRB2stYCTVukZh7zzw"); ``` #### [By block height and shard id](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L198) ``` java Chunk chunk = nearClient.getChunkDetails(78567387, 0); ``` #### [By block hash and shard id](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L187) ``` java Chunk chunk = nearClient.getChunkDetails("F1HXTzeYgYq28rgsHuKUrRbo5QTBGKFYG7rbxXkRZWXN", 0); ``` ### 5. [Gas](https://docs.near.org/docs/api/rpc/gas) #### 5.1 [Gas Price](https://docs.near.org/docs/api/rpc/gas#gas-price) Returns gas price for a specific block_height or block_hash. - Using [null] will return the most recent block's gas price. ### [Null](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L306) ``` java GasPrice gasPrice = nearClient.getGasPrice(null); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L328) ``` java GasPrice gasPrice = nearClient.getGasPrice(78770817); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L317) ``` java GasPrice gasPrice = nearClient.getGasPrice("FXTWzPjqWztjHfneqJb9cBDB2QLTY1Rja4GHrswAv1b9"); ``` ### 6. [Protocol](https://docs.near.org/docs/api/rpc/protocol) #### 6.1 [Genesis Config](https://docs.near.org/docs/api/rpc/protocol#genesis-config) Returns current genesis configuration. ### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L352) ``` java GenesisConfig genesisConfig = nearClient.getGenesisConfig(); ``` #### 6.2 [Protocol Config](https://docs.near.org/docs/api/rpc/protocol#protocol-config) Returns most recent protocol configuration or a specific queried block. Useful for finding current storage and transaction costs. #### [By finality](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L376) ``` java ProtocolConfig protocolConfig = nearClient.getProtocolConfig(Finality.FINAL); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L398) ``` java ProtocolConfig protocolConfig = nearClient.getProtocolConfig(78770817); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L387) ``` java ProtocolConfig protocolConfig = nearClient.getProtocolConfig("FXTWzPjqWztjHfneqJb9cBDB2QLTY1Rja4GHrswAv1b9"); ``` ### 7. [Network](https://docs.near.org/docs/api/rpc/network) #### 7.1 [Node Status](https://docs.near.org/docs/api/rpc/network#node-status) Returns general status of a given node (sync status, nearcore node version, protocol version, etc), and the current set of validators. ### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L241) ``` java NodeStatus nodeStatus = nearClient.getNodeStatus(); ``` #### 7.2 [Network Info](https://docs.near.org/docs/api/rpc/network#network-info) Returns the current state of node network connections (active peers, transmitted data, etc.) ### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L222) ``` java NetworkInfo networkInfo = nearClient.getNetworkInfo(); ``` #### 7.3 [Validation Status](https://docs.near.org/docs/api/rpc/network#validation-status) Queries active validators on the network returning details and the state of validation on the blockchain. ### [Null](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L262) ``` java ValidationStatus networkValidationStatus = nearClient.getNetworkValidationStatus(null); ``` #### [By height](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L283-L286) ``` java Block lastBlock = nearClient.getBlock(Finality.OPTIMISTIC); ValidationStatus networkValidationStatus = nearClient.getNetworkValidationStatus(lastBlock.getHeader().getHeight()); ``` #### [By hash](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L271-L274) ``` java Block lastBlock = nearClient.getBlock(Finality.FINAL); ValidationStatus networkValidationStatus = nearClient.getNetworkValidationStatus(lastBlock.getHeader().getHash()); ``` ### 8. [Transactions](https://docs.near.org/docs/api/rpc/transactions) #### 8.1 [Send transaction (async)](https://docs.near.org/docs/api/rpc/transactions#send-transaction-async) Sends a transaction and immediately returns transaction hash. #### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/TransactionServiceTest.java#L132-L139) ``` java String signerId = "syntifi-bob.testnet"; String receiverId = "syntifi-alice.testnet"; BigInteger amount = new BigInteger("100", 10); EncodedHash transactionAsync = TransactionService .sendTransferActionAsync(nearClient, signerId, receiverId, bobNearPublicKey, bobNearPrivateKey, amount); ``` #### 8.2 [Send transaction (await)](https://docs.near.org/docs/api/rpc/transactions#send-transaction-await) Sends a transaction and waits until transaction is fully complete. (Has a 10 second timeout) #### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/TransactionServiceTest.java#L90-L97) ``` java String signerId = "syntifi-alice.testnet"; String receiverId = "syntifi-bob.testnet"; BigInteger amount = new BigInteger("100", 10); TransactionAwait transactionAwait = TransactionService .sendTransferActionAwait(nearClient, signerId, receiverId, aliceNearPublicKey, aliceNearPrivateKey, amount); ``` #### 8.3 [Transaction Status](https://docs.near.org/docs/api/rpc/transactions#transaction-status) Queries status of a transaction by hash and returns the final transaction result. #### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L479-L482) ``` java String transactionHash = "DwWUi6WbVHKTCDjVu4gmuQfryqjwTjrZ6ntRcKcGN6Gd"; String accountId = "isonar.testnet"; TransactionStatus transactionStatus = nearClient.getTransactionStatus(transactionHash, accountId); ``` #### 8.4 [Transaction Status with Receipts](https://docs.near.org/docs/api/rpc/transactions#transaction-status-with-receipts) Queries status of a transaction by hash, returning the final transaction result and details of all receipts. #### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L510-L514) ``` java String transactionHash = "DwWUi6WbVHKTCDjVu4gmuQfryqjwTjrZ6ntRcKcGN6Gd"; String accountId = "isonar.testnet"; TransactionStatus transactionStatusWithReceipts = nearClient.getTransactionStatusWithReceipts(transactionHash, accountId); ``` #### 8.5 [Receipt by ID](https://docs.near.org/docs/api/rpc/transactions#receipt-by-id) Fetches a receipt by it's ID (as is, without a status or execution outcome) #### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/NearServiceTest.java#L542-L544) ``` java String receiptId = "8b9Vt1xH8DZecMda1YqUcMWA41NvknUJJVd2XEQikPRs"; Receipt transactionReceipt = nearClient.getTransactionReceipt(receiptId); ``` ### 9. Json File Wallets #### 9.1 Loads a Wallet from a json file Loads a Wallet object from a json file. #### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/WalletServiceTest.java#L36) ``` java String fileName = "./my-wallet.json"; WalletService.writeWalletToFile(fileName, wallet) ``` #### 9.2 Writes a Wallet to a json file Writes a Wallet object to a json file. #### [Example](https://github.com/syntifi/near-java-api/blob/main/src/test/java/com/syntifi/near/api/service/WalletServiceTest.java#L53) ``` java String fileName = "./my-wallet.json"; Wallet wallet = WalletService.loadWalletFromFile(fileName); ```
near_boilerplate-template-rs-dev
.github ISSUE_TEMPLATE 01_BUG_REPORT.md 02_FEATURE_REQUEST.md 03_CODEBASE_IMPROVEMENT.md 04_SUPPORT_QUESTION.md BOUNTY.yml config.yml PULL_REQUEST_TEMPLATE.md labels.yml workflows build.yml deploy-to-console.yml labels.yml lock.yml pr-labels.yml stale.yml README.md contract Cargo.toml README.md build.sh deploy.sh src lib.rs docs CODE_OF_CONDUCT.md CONTRIBUTING.md SECURITY.md frontend .eslintrc.json .prettierrc.json hooks wallet-selector.ts next.config.js package-lock.json package.json pages api hello.ts postcss.config.js public next.svg thirteen.svg vercel.svg start.sh styles globals.css tailwind.config.js tsconfig.json integration-tests Cargo.toml src tests.rs package-lock.json package.json
<h1 align="center"> <a href="https://github.com/near/boilerplate-template-rs"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/near/boilerplate-template-rs/main/docs/images/pagoda_logo_light.png"> <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/near/boilerplate-template-rs/main/docs/images/pagoda_logo_dark.png"> <img alt="" src="https://raw.githubusercontent.com/near/boilerplate-template-rs/main/docs/images/pagoda_logo_dark.png"> </picture> </a> </h1> <div align="center"> Rust Boilerplate Template <br /> <br /> <a href="https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=bug&template=01_BUG_REPORT.md&title=bug%3A+">Report a Bug</a> · <a href="https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=enhancement&template=02_FEATURE_REQUEST.md&title=feat%3A+">Request a Feature</a> . <a href="https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=question&template=04_SUPPORT_QUESTION.md&title=support%3A+">Ask a Question</a> </div> <div align="center"> <br /> [![Pull Requests welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg?style=flat-square)](https://github.com/near/boilerplate-template-rs/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) [![code with love by near](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-near-ff1414.svg?style=flat-square)](https://github.com/near) </div> <details open="open"> <summary>Table of Contents</summary> - [About](#about) - [Built With](#built-with) - [Getting Started](#getting-started) - [Prerequisites](#prerequisites) - [Installation](#installation) - [Usage](#usage) - [Deploy on Vercel](#deploy-on-vercel) - [Roadmap](#roadmap) - [Support](#support) - [Project assistance](#project-assistance) - [Contributing](#contributing) - [Authors & contributors](#authors--contributors) - [Security](#security) </details> --- ## About This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) and [`tailwindcss`](https://tailwindcss.com/docs/guides/nextjs) created for easy-to-start as a React + Rust skeleton template in the Pagoda Gallery. Smart-contract was initialized with [create-near-app]. Use this template and start to build your own gallery project! ### Built With [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app), [`tailwindcss`](https://tailwindcss.com/docs/guides/nextjs), [`tailwindui`](https://tailwindui.com/), [`@headlessui/react`](https://headlessui.com/), [`@heroicons/react`](https://heroicons.com/), [create-near-app], [`amazing-github-template`](https://github.com/dec0dOS/amazing-github-template) Getting Started ================== ### Prerequisites Make sure you have a [current version of Node.js](https://nodejs.org/en/about/releases/) installed – we are targeting versions `18>`. Read about other [prerequisites](https://docs.near.org/develop/prerequisites) in our docs. ### Installation Install all dependencies: npm install Build your contract: npm run build Deploy your contract to TestNet with a temporary dev account: npm run deploy Usage ===== Start your frontend: npm run start Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. Test your contract: npm run test Exploring The Code ================== 1. The smart-contract code lives in the `/contract` folder. See the README there for more info. In blockchain apps the smart contract is the "backend" of your app. 2. The frontend code lives in the `/frontend` folder. You can start editing the page by modifying `frontend/pages/index.tsx`. The page auto-updates as you edit the file. This is your entrypoint to learn how the frontend connects to the NEAR blockchain. 3. Test your contract: `npm test`, this will run the tests in `integration-tests` directory. 4. [API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `frontend/pages/api/hello.ts`. 5. The `frontend/pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. 6. This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `npm run deploy`, your smart contract gets deployed to the live NEAR TestNet with a temporary dev account. When you're ready to make it permanent, here's how: Step 0: Install near-cli (optional) ------------------------------------- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local `node_modules` folder when you ran `npm install`, but for best ergonomics you may want to install it globally: npm install --global near-cli Or, if you'd rather use the locally-installed version, you can prefix all `near` commands with `npx` Ensure that it's installed with `near --version` (or `npx near --version`) Step 1: Create an account for the contract ------------------------------------------ Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as `your-name.testnet`, you can deploy your contract to `near-blank-project.your-name.testnet`. Assuming you've already created an account on [NEAR Wallet], here's how to create `near-blank-project.your-name.testnet`: 1. Authorize NEAR CLI, following the commands it gives you: near login 2. Create a subaccount (replace `YOUR-NAME` below with your actual account name): near create-account near-blank-project.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet Step 2: deploy the contract --------------------------- Use the CLI to deploy the contract to TestNet with your account ID. Replace `PATH_TO_WASM_FILE` with the `wasm` that was generated in `contract` build directory. near deploy --accountId near-blank-project.YOUR-NAME.testnet --wasmFile PATH_TO_WASM_FILE Step 3: set contract name in your frontend code ----------------------------------------------- Modify the line in `contract/neardev/dev-account.env` that sets the account name of the contract. Set it to the account id you used above. CONTRACT_NAME=near-blank-project.YOUR-NAME.testnet Troubleshooting =============== On Windows, if you're seeing an error containing `EPERM` it may be related to spaces in your path. Please see [this issue](https://github.com/zkat/npx/issues/209) for more details. [create-next-app]: https://github.com/vercel/next.js/tree/canary/packages/create-next-app [Node.js]: https://nodejs.org/en/download/package-manager [tailwindcss]: https://tailwindcss.com/docs/guides/nextjs [create-near-app]: https://github.com/near/create-near-app [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.near.org/concepts/basics/account [NEAR Wallet]: https://wallet.testnet.near.org/ [near-cli]: https://github.com/near/near-cli You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! ## Deploy on Vercel The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. ## Roadmap See the [open issues](https://github.com/near/boilerplate-template-rs/issues) for a list of proposed features (and known issues). - [Top Feature Requests](https://github.com/near/boilerplate-template-rs/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc) (Add your votes using the 👍 reaction) - [Top Bugs](https://github.com/near/boilerplate-template-rs/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc) (Add your votes using the 👍 reaction) - [Newest Bugs](https://github.com/near/boilerplate-template-rs/issues?q=is%3Aopen+is%3Aissue+label%3Abug) ## Support Reach out to the maintainer: - [GitHub issues](https://github.com/near/boilerplate-template-rs/issues/new?assignees=&labels=question&template=04_SUPPORT_QUESTION.md&title=support%3A+) ## Project assistance If you want to say **thank you** or/and support active development of Rust Boilerplate Template: - Add a [GitHub Star](https://github.com/near/boilerplate-template-rs) to the project. - Tweet about the Rust Boilerplate Template. - Write interesting articles about the project on [Dev.to](https://dev.to/), [Medium](https://medium.com/) or your personal blog. Together, we can make Rust Boilerplate Template **better**! ## Contributing First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are **greatly appreciated**. Please read [our contribution guidelines](docs/CONTRIBUTING.md), and thank you for being involved! ## Authors & contributors The original setup of this repository is by [Dmitriy Sheleg](https://github.com/shelegdmitriy). For a full list of all authors and contributors, see [the contributors page](https://github.com/near/boilerplate-template-rs/contributors). ## Security Rust Boilerplate Template follows good practices of security, but 100% security cannot be assured. Rust Boilerplate Template is provided **"as is"** without any **warranty**. Use at your own risk. _For more information and to report security issues, please refer to our [security documentation](docs/SECURITY.md)._ # Hello NEAR Contract The smart contract exposes two methods to enable storing and retrieving a greeting in the NEAR network. ```rust const DEFAULT_GREETING: &str = "Hello"; #[near_bindgen] #[derive(BorshDeserialize, BorshSerialize)] pub struct Contract { greeting: String, } impl Default for Contract { fn default() -> Self { Self{greeting: DEFAULT_GREETING.to_string()} } } #[near_bindgen] impl Contract { // Public: Returns the stored greeting, defaulting to 'Hello' pub fn get_greeting(&self) -> String { return self.greeting.clone(); } // Public: Takes a greeting, such as 'howdy', and records it pub fn set_greeting(&mut self, greeting: String) { // Record a log permanently to the blockchain! log!("Saving greeting {}", greeting); self.greeting = greeting; } } ``` <br /> # Quickstart 1. Make sure you have installed [rust](https://rust.org/). 2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup) <br /> ## 1. Build and Deploy the Contract You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash ./deploy.sh ``` Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: ```bash cat ./neardev/dev-account # e.g. dev-1659899566943-21539992274727 ``` <br /> ## 2. Retrieve the Greeting `get_greeting` is a read-only method (aka `view` method). `View` methods can be called for **free** by anyone, even people **without a NEAR account**! ```bash # Use near-cli to get the greeting near view <dev-account> get_greeting ``` <br /> ## 3. Store a New Greeting `set_greeting` changes the contract's state, for which it is a `change` method. `Change` methods can only be invoked using a NEAR account, since the account needs to pay GAS for the transaction. ```bash # Use near-cli to set a new greeting near call <dev-account> set_greeting '{"message":"howdy"}' --accountId <dev-account> ``` **Tip:** If you would like to call `set_greeting` using your own account, first login into NEAR using: ```bash # Use near-cli to login your NEAR account near login ``` and then use the logged account to sign the transaction: `--accountId <your-account>`.
N1ghtSe7en_NSevenChallenge-5
babel.config.js contract Cargo.toml compile.js src lib.rs package.json src App.js __mocks__ fileMock.js assets logo-black.svg logo-white.svg config.js global.css index.html index.js jest.init.js main.test.js utils.js wallet login index.html
NearNet_nearapps-contracts
.cargo config.toml .github workflows build.yml Cargo.toml README.md app-counter Cargo.toml README.md build.sh src lib.rs tests test_counter.rs app-exec Cargo.toml build.sh src crypto.rs crypto ecdsa_secp256k1.rs ecdsa_secp256k1 sign.rs types.rs verify.rs eddsa_ed25519.rs eddsa_ed25519 sign.rs types.rs verify.rs error.rs exec.rs hash.rs lib.rs tests test_ecdsa_secp256k1.rs test_eddsa_ed25519.rs test_exec.rs utils _secp256k1.rs mod.rs app-nft Cargo.toml build.sh src error.rs lib.rs series.rs utils.rs tests test_nft.rs test_nft.sh utils mod.rs app-wallet Cargo.toml README.md build.sh src error.rs lib.rs tests test_wallet.rs utils mod.rs build.sh res scripts test_simultaneous_calls.sh
# Wallet App Creates near accounts, logging on success. # Nearapps Contracts ## Execute Contract - `testnet`: `v0.naps.testnet` https://explorer.testnet.near.org/accounts/naps.testnet - `mainnet`: `naps.near` https://explorer.mainnet.near.org/accounts/naps.near ### Interface methods: - `new` - `execute` - `add_owner` - `remove_owner` - `is_owner` - `get_owners` - `verify_msg` - `verify_hashed_msg` #### Initialization method: `new` ###### Parameters - `owner_id`: string - the account_id of who will own the contract ###### Returns Has no returns. ###### Sample <!-- TODO: update --> ```json { } ``` #### Execution of a Proxied Contract Call method: `execute` ###### Parameters - `context`: the call context. - `contract_call`: the contract call context. - `contract_id`: string - the contract's AccountId that is being called. - `method_name`: string - the name of the method being called. - `args`: string - the arguments for the method that is being called. - `tag_info`: the tags information. - `app_id`: string - app tag. - `action_id`: string - action number. - `user_id`: string - user account_id tag. <!-- - `public_key`: string - the public key, in base58 which an optional `{header}:` as prefix. Can be a `Ed25519` or a `Secp256k1` public key. Note: currently disabled as the message still needs to be specified. A placeholder value is being used. --> <!-- - `signature`: string - the signature, in base58. Can be a `Ed25519` or a `Secp256k1` signature. Note: currently disabled as the message still needs to be specified. A placeholder value is being used. --> ###### Returns - `result` - the same return that `contract_id`'s method `method_name` with `args` would return. ###### Sample <!-- TODO: update --> ```json { "context": { "contract_call": { "contract_id": "nft.naps.testnet", "method_name": "nft_transfer_from", "args": "\"token_id\": \"1\", \"sender_id\": \"my-account.testnet\", \"receiver_id\": \"my-friend.testnet\", \"approval_id\": \"4711\"" } } } ``` #### Owners Management methods: - `add_owner` - `remove_owner` - `is_owner` - `get_owners` ##### Add Owner method: `add_owner` ###### Parameters - `owner_id`: string - the account_id of who will also own the contract ###### Returns - `added`: boolean - whether the account was newly added as an owner. ###### Sample <!-- TODO: update --> ```json { } ``` ##### Remove Owner method: `remove_owner` ###### Parameters - `owner_id`: string - the account_id of who will stop owning the contract ###### Returns - `removed`: boolean - whether the account was just removed as an owner. ###### Sample <!-- TODO: update --> ```json { } ``` ##### Check Owner method: `is_owner` ###### Parameters - `owner_id`: string - the account_id which the owning status is being checked ###### Returns - `is_owner`: boolean - whether the account is an owner. ###### Sample <!-- TODO: update --> ```json { } ``` ##### Get Owners method: `get_owner` ###### Parameters No parameters required. ###### Returns - `owners`: string[] - list of account_ids of the owners. ###### Sample <!-- TODO: update --> ```json { } ``` #### Verification of a Message method: `verify_msg` ###### Parameters - `sign`: string - the signature, in base58. Can be a `Ed25519` or a `Secp256k1` signature. - `pubkey`: string - the public key, in base58 with an optional `{header}:` as prefix. Can be a `Ed25519` or a `Secp256k1` public key. On a missing prefix, `ed25519:` is assumed. - `msg`: string - the message. It will be hashed internally by the contract. ###### Returns - `is_match`: boolean - whether the sha256 hash of the `msg` matched the `pubkey` on the `sign`. ###### Sample ```json { "sign": "26gFr4xth7W9K7HPWAxq3BLsua8oTy378mC1MYFiEXHBBpeBjP8WmJEJo8XTBowetvqbRshcQEtBUdwQcAqDyP8T", "pubkey": "ed25519:AYWv9RAN1hpSQA4p1DLhCNnpnNXwxhfH9qeHN8B4nJ59", "msg": "message" } ``` #### Verification of a Prehashed Message method: `verify_hashed_msg` ###### Parameters - `sign`: string - the signature, in base58. Can be a `Ed25519` or a `Secp256k1` signature. - `pubkey`: string - the public key, in base58 with an optional `{header}:` as prefix. Can be a `Ed25519` or a `Secp256k1` public key. On a missing prefix, `ed25519:` is assumed. - `msg_hash`: number[] - the message hash, in a 32-sized array of bytes, resulted from a sha256 hash of them message. ###### Returns - `is_match`: boolean - whether the `msg_hash` matched the `pubkey` on the `sign`. ###### Sample ```json { "sign": "26gFr4xth7W9K7HPWAxq3BLsua8oTy378mC1MYFiEXHBBpeBjP8WmJEJo8XTBowetvqbRshcQEtBUdwQcAqDyP8T", "pubkey": "ed25519:AYWv9RAN1hpSQA4p1DLhCNnpnNXwxhfH9qeHN8B4nJ59", "msg_hash": [171, 83, 10, 19, 228, 89, 20, 152, 43, 121, 249, 183, 227, 251, 169, 148, 207, 209, 243, 251, 34, 247, 28, 234, 26, 251, 240, 43, 70, 12, 109, 29] } ``` ## Wallet Creation <!-- TODO: update --> - `testnet`: `` - `mainnet`: `` ### Interface methods: - `new` - `create_account` <!-- - `create_subaccount` --> #### Initialization method: `new` ###### Parameters - `owner_id`: string - owner account id that will be allowed to make other calls into this contract <!-- - `defaults`: Object - the default parameters to be used during account creation. - `initial_amount`: string - the default initial amount to attach to created accounts, in yoctoNear. - `allowance`: string - the default allowance to attach to allowed calls on created accounts, in yoctoNear. - `allowed_calls`: Object[] - the default allowed calls that new accounts are able to make. - `allowance`: optional string - the user's allowance for when calling a contract. If missing, defaults to the `defaults.allowance`. - `receiver_id`: string - the contract address that the user is allowed to call into. - `method_names`: string[] - list of method names (eg. `["method_a", "method_b"]`) that the user is allowed to call on `receiver_id` contract. An empty list means all methods. --> ###### Returns Has no returns. ###### Sample <!-- TODO: update --> ```json { } ``` #### Account Creation <!-- TODO: update --> note: not tested. method: `create_account` ###### Parameters - `new_account_id`: string - the account_id that is being created - `new_public_key`: optional string - the new account owner public key, in base58 with an optional `{header}:` as prefix. Can be a `Ed25519` or a `Secp256k1` public key. On a missing prefix, `ed25519:` is assumed. This value may be generated by the user. If missing, defaults to the transaction signer's public key. <!-- - `config`: Object - account configuration for the user that is being created. - `account_id`: string - the sub-account that is being created. Expected to be a sub-account on `.testnet` or `.near`. - `user_public_key`: string - the user/sub-account public key, in base58 with an optional `{header}:` as prefix. Can be a `Ed25519` or a `Secp256k1` public key. On a missing prefix, `ed25519:` is assumed. This value may be generated by the user. - `initial_amount`: optional string - the initial amount of deposit that the user should receive. If missing, defaults to `defaults.initial_amount`. - `allowed_calls`: optional Object[] - call information that the user is allowed to make. If missing, defaults to `defaults.allowed_calls`. If is an empty list, the user will not be allowed to call any contract. - `allowance`: optional string - the user's allowance for when calling a contract. If missing, defaults to the `defaults.allowance`. - `receiver_id`: string - the contract address that the user is allowed to call into. - `method_names`: string[] - list of method names (eg. `["method_a", "method_b"]`) that the user is allowed to call on `receiver_id` contract. An empty list means all methods. --> ###### Returns - `account_created`: boolean - whether the account was successfully created. ###### Sample <!-- TODO: update --> ```json { } ``` <!-- #### Sub-Account Creation note: not tested. method: `create_subaccount` ###### Parameters - `config`: Object - account configuration for the user that is being created. - `account_id`: string - the sub-account that is being created. It will be postfixed with the wallet's account automatically. - `user_public_key`: string - the user/sub-account public key, in base58 with an optional `{header}:` as prefix. Can be a `Ed25519` or a `Secp256k1` public key. On a missing prefix, `ed25519:` is assumed. This value may be generated by the user. - `initial_amount`: optional string - the initial amount of deposit that the user should receive. If missing, defaults to `defaults.initial_amount`. - `allowed_calls`: optional Object[] - call information that the user is allowed to make. If missing, defaults to `defaults.allowed_calls`. If is an empty list, the user will not be allowed to call any contract. - `allowance`: optional string - the user's allowance for when calling a contract. If missing, defaults to the `defaults.allowance`. - `receiver_id`: string - the contract address that the user is allowed to call into. - `method_names`: string[] - list of method names (eg. `["method_a", "method_b"]`) that the user is allowed to call on `receiver_id` contract. An empty list means all methods. ###### Returns - `account_created`: boolean - whether the accoutn was successfully created. ###### Sample ```json { } ``` --> ## NFT Contract Address: - `testnet`: `nft.naps.testnet` https://explorer.testnet.near.org/accounts/nft.naps.testnet - `mainnet`: `nft.naps.near` not yet deployed ### Interface methods: - `new` - `new_default_meta` - `nft_mint` - `nft_transfer` - `nft_transfer_call` - `nft_token` - `nft_approve` - `nft_revoke` - `nft_revoke_all` - `nft_is_approved` - `nft_total_supply` - `nft_tokens` - `nft_supply_for_owner` - `nft_tokens_for_owner` - `nft_metadata` - `nft_series_create` - `nft_series_mint` - `nft_series_get` - `nft_series_get_minted_tokens_vec` - `nft_series_set_mintable` - `nft_series_set_capacity` #### Initialization method: `new` ###### Parameters - `owner_id`: string - the account_id of who will own the contract - `metadata`: object - the standard nft metadata - `spec`: stirng - eg. "nft-1.0.0" - `name`: string - eg. "Mosaics" - `symbol`: string - eg. "MOSIAC" - `icon`: optional string - data URL - `base_uri`: optional string - centralized gateway known to have reliable access to decentralized storage assets referenced by `reference` or `media` URLs - `reference`: optional string - URL to a JSON file with more info - `reference_hash`: optional string - base64-encoded sha256 hash of JSON from reference field. Required if `reference` is included. ###### Returns Has no returns. ###### Sample <!-- TODO: update --> ```json { } ``` ###### Reference Metadata JSON Sample <!-- TODO: update --> ```json { } ``` ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` #### Initialization with a default Meta method: `new_default_meta` ###### Parameters - `owner_id`: string - the account_id of who will own the contract ###### Returns Has no returns. ###### Sample <!-- TODO: update --> ```json { } ``` ###### Reference Metadata JSON Sample <!-- TODO: update --> ```json { } ``` ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` #### NFT Minting method: `nft_mint` ###### Parameters - `token_id`: string - the name of the token. Cannot contain the series delimiter (`:`). - `token_owner_id`: string - the account_id of who will receive the token. - `token_metadata`: object - the standard nft token metadata. - `title`: optional string - the title of the token, eg. "Arch Nemesis: Mail Carrier" or "Parcel #5055". - `description`: optional string - free-form description. - `media`: optional string - URL to associated media, preferably to decentralized, content-addressed storage. - `media_hash`: optional stirng - Base64-encoded sha256 hash of content referenced by the `media` field. Required if `media` is included. - `copies`: optional string - number of copies of this set of metadata in existence when token was minted. - `issued_at`: optional string - ISO 8601 datetime when token was issued or minted. - `expires_at`: optional string - ISO 8601 datetime when token expires. - `starts_at`: optional string - ISO 8601 datetime when token starts being valid. -`updated_at`: optional string - ISO 8601 datetime when token was last updated. - `extra`: optional string - anything extra the NFT wants to store on-chain. Can be stringified JSON. - `reference`: optional string - URL to an off-chain JSON file with more info. - `reference_hash`: optional string - Base64-encoded sha256 hash of JSON from reference field. Required if `reference` is included. ###### Returns - `token`: object - the standard nft token information. ###### Sample <!-- TODO: update --> ```json { } ``` ###### Reference Metadata JSON Sample <!-- TODO: update --> ```json { } ``` ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` #### Standard NFT Operations methods: - `nft_transfer` - `nft_transfer_call` - `nft_token` - `nft_resolve_transfer` - `nft_approve` - `nft_revoke` - `nft_revoke_all` - `nft_is_approved` - `nft_total_supply` - `nft_tokens` - `nft_supply_for_owner` - `nft_tokens_for_owner` - `nft_metadata` ##### Transfer method: `nft_transfer` ###### Parameters - `token_id`: string - the token id to give allowance on. - `receiver_id`: string - the account to allow token transfer. - `approval_id`: optional number - the approval id from `nft_approve_from`. - `memo`: optional string. ###### Sample ```json { "token_id": "1", "receiver_id": "my-friend.testnet" } ``` ###### Returns - `success`: bool - was the transfer successful or not ###### Nearapps API Sample <!-- TODO: update --> ```bash curl --location --request POST 'https://api.nearapps.net/testnet/v1/execute' \ --header 'x-api-key: <api key>' \ --header 'Content-Type: application/json' \ --data-raw '{ "message": "{\"contract_id\":\"nft.naps.testnet\",\"method_name\":\"nft_transfer_from\",\"args\": \"{\"token_id\":\"1\",\"sender_id\":\"my-account.testnet\", \"receiver_id\":\"my-friend.testnet\"}\", "signed": { "signature": "4FJecZiY22ReWiJHxCSjDw71Jyd8WVgkkeNfH1Zj21uhQEV1c7QQ4bQYc7QMgH3Tcz5LxYJMxPYuHoETN8i4sQNq", "publicKey": "ed25519:D5d84XpgHtTUHwg1hbvT3Ljy6LpeLnJhU34scBC1TNKp" } }' ``` ##### Transfer Call method: `nft_transfer_call` ###### Parameters - `token_id`: string - the token id to give allowance on - `receiver_id`: string - the account to allow token transfer ###### Sample ```json { "token_id": "1", "receiver_id": "my-friend.testnet" } ``` ###### Returns - `success`: bool - was the transfer successful or not ###### Nearapps API Sample <!-- TODO: update --> ```bash curl --location --request POST 'https://api.nearapps.net/testnet/v1/execute' \ --header 'x-api-key: <api key>' \ --header 'Content-Type: application/json' \ --data-raw '{ "message": "{\"contract_id\":\"nft.naps.testnet\",\"method_name\":\"nft_transfer_from\",\"args\": \"{\"token_id\":\"1\",\"sender_id\":\"my-account.testnet\", \"receiver_id\":\"my-friend.testnet\"}\", "signed": { "signature": "4FJecZiY22ReWiJHxCSjDw71Jyd8WVgkkeNfH1Zj21uhQEV1c7QQ4bQYc7QMgH3Tcz5LxYJMxPYuHoETN8i4sQNq", "publicKey": "ed25519:D5d84XpgHtTUHwg1hbvT3Ljy6LpeLnJhU34scBC1TNKp" } }' ``` ##### Approval method: `nft_approve` ###### Parameters - `token_id`: string - the token id to give allowance on - `account_id`: string - the account to allow token transfer - `msg`: optional string. ###### Sample ```json { "token_id": "1", "account_id": "my-friend.testnet" } ``` ###### Returns - `approval_id`: the id of the approval ###### Nearapps API Sample <!-- TODO: update --> ```bash curl --location --request POST 'https://api.nearapps.net/testnet/v1/execute' \ --header 'x-api-key: <api key>' \ --header 'Content-Type: application/json' \ --data-raw '{ "message": "{\"contract_id\":\"nft.naps.testnet\",\"method_name\":\"nft_approve_from\",\"args\": \"{\"token_id\":\"1\",\"account_id\":\"my-friend.testnet\"}\"}", "sender": "my-account.testnet", "signed": { "signature": "4FJecZiY22ReWiJHxCSjDw71Jyd8WVgkkeNfH1Zj21uhQEV1c7QQ4bQYc7QMgH3Tcz5LxYJMxPYuHoETN8i4sQNq", "publicKey": "ed25519:D5d84XpgHtTUHwg1hbvT3Ljy6LpeLnJhU34scBC1TNKp" } }' ``` ##### Check Approval method: `nft_is_approved` ###### Parameters - `token_id`: string - the token id to check allowance on - `approved_account_id`: string. - `approval_id`: optional number. ###### Sample <!-- TODO: update --> ```json { } ``` ###### Returns - `is_approved`: boolean - whether it is approved. ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` ##### Revoke method: `nft_revoke` ###### Parameters - `token_id`: string - the token id to revoke allowance on - `account_id`: string - the account to disallow token transfer ###### Sample ```json { "token_id": "1", "account_id": "my-friend.testnet" } ``` ###### Returns Has no returns. ###### Nearapps API Sample <!-- TODO: update --> ```bash curl --location --request POST 'https://api.nearapps.net/testnet/v1/execute' \ --header 'x-api-key: <api key>' \ --header 'Content-Type: application/json' \ --data-raw '{ "message": "{\"contract_id\":\"nft.naps.testnet\",\"method_name\":\"nft_revoke_from\",\"args\": \"{\"token_id\":\"1\",\"account_id\":\"my-friend.testnet\"}\"}", "sender": "my-account.testnet", "signed": { "signature": "4FJecZiY22ReWiJHxCSjDw71Jyd8WVgkkeNfH1Zj21uhQEV1c7QQ4bQYc7QMgH3Tcz5LxYJMxPYuHoETN8i4sQNq", "publicKey": "ed25519:D5d84XpgHtTUHwg1hbvT3Ljy6LpeLnJhU34scBC1TNKp" } }' ``` ##### Revoke All method: `nft_revoke` ###### Parameters - `token_id`: string - the token id to revoke allowance on ###### Sample ```json { "token_id": "1" } ``` ###### Returns Has no return. ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` #### NFT Series Operations methods: - `nft_series_create` - `nft_series_mint` - `nft_series_get` - `nft_series_get_minted_tokens_vec` - `nft_series_set_mintable` - `nft_series_set_capacity` ##### NFT Series Creation method: `nft_series_create` ###### Parameters - `name`: string - the name of the token series - `capacity`: string - the maximum number of the of tokens that can be minted - `creator`: string - the account_id of the creator, used for informing ###### Returns - `series_id`: string - a number representing the id of the created series. ###### Sample <!-- TODO: update --> ```json { } ``` ###### Reference Metadata JSON Sample <!-- TODO: update --> ```json { } ``` ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` ##### NFT Series Token Minting method: `nft_series_mint` ###### Parameters - `series_id`: string - the series id number - `token_owner_id`: string - the account_id of who will receive the token. - `token_metadata`: optional object - the standard nft token metadata. ###### Returns - `token`: object - the standard nft token information. ###### Sample <!-- TODO: update --> ```json { } ``` ###### Reference Metadata JSON Sample <!-- TODO: update --> ```json { } ``` ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` ##### NFT Series Query method: `nft_series_get` ###### Parameters - `series_id`: string - the series id number ###### Returns - `series`: object - nft series information. - `id`: string - the series id number, - `name`: string - `creator`: string - the account_id of the creator - `len`: string - the number of minted tokens - `capacity`: string - the number of how many tokens can be minted - `is_mintable`: boolean - whether the series can be minted ###### Sample <!-- TODO: update --> ```json { } ``` ###### Reference Metadata JSON Sample <!-- TODO: update --> ```json { } ``` ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` ##### NFT Series Token List method: `nft_series_get_minted_tokens_vec` ###### Parameters - `series_id`: string - the series id number ###### Returns - `token_ids`: string[] - a list containing the token_id number that were minted under the series. ###### Sample <!-- TODO: update --> ```json { } ``` ###### Reference Metadata JSON Sample <!-- TODO: update --> ```json { } ``` ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` ##### NFT Series Set Mintable method: `nft_series_set_mintable` ###### Parameters - `series_id`: string - the series id number. - `is_mintable`: boolean - choose whether it will be mintable or not. ###### Returns Has no returns. ###### Sample <!-- TODO: update --> ```json { } ``` ###### Reference Metadata JSON Sample <!-- TODO: update --> ```json { } ``` ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` ##### NFT Series Set Capacity method: `nft_series_set_capacity` ###### Parameters - `series_id`: string - the series id number. - `capacity`: string - choose the number of what the capacity will be. ###### Returns Has no returns. ###### Sample <!-- TODO: update --> ```json { } ``` ###### Reference Metadata JSON Sample <!-- TODO: update --> ```json { } ``` ###### Nearapps API Sample <!-- TODO: update --> ```bash ``` # Counter App Based on [near-examples/rust-counter](https://github.com/near-examples/rust-counter), this is a dummy project to be used during tests. Has an internal counter that can be incremented, decremented, and so on.
Graate-Org_NEAR-rock-paper-scissor-ui
README.md netlify.toml package-lock.json package.json public game-bg.svg index.html manifest.json robots.txt room-bg.svg src components JSS.ts Spacing.ts config.ts config theme.ts types.ts icons index.ts index.css interfaces IApp.interface.ts IGame.interface.ts IRoom.interface.ts modals utils.ts react-app-env.d.ts reportWebVitals.ts setupTests.ts utils helperFunctions.ts tsconfig.json
# Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `yarn start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.\ You will also see any lint errors in the console. ### `yarn test` Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `yarn build` Builds the app for production to the `build` folder.\ It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.\ Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `yarn eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/).
nmharmon8_TestNear
.eslintrc.js .github workflows deploy.yml .gitpod.yml .travis.yml README-Gitpod.md README.md as-pect.config.js asconfig.json assembly __tests__ as-pect.d.ts guestbook.spec.ts as_types.d.ts main.ts model.ts tsconfig.json babel.config.js neardev shared-test-staging test.near.json shared-test test.near.json package.json src App.js config.js index.html index.js tests integration App-integration.test.js ui App-ui.test.js
Guest Book ========== [![Build Status](https://travis-ci.com/near-examples/guest-book.svg?branch=master)](https://travis-ci.com/near-examples/guest-book) [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/near-examples/guest-book) <!-- MAGIC COMMENT: DO NOT DELETE! Everything above this line is hidden on NEAR Examples page --> Sign in with [NEAR] and add a message to the guest book! A starter app built with an [AssemblyScript] backend and a [React] frontend. Quick Start =========== To run this project locally: 1. Prerequisites: Make sure you have Node.js ≥ 12 installed (https://nodejs.org), then use it to install [yarn]: `npm install --global yarn` (or just `npm i -g yarn`) 2. Install dependencies: `yarn install` (or just `yarn`) 3. Run the local development server: `yarn dev` (see `package.json` for a full list of `scripts` you can run with `yarn`) Now you'll have a local development environment backed by the NEAR TestNet! Running `yarn dev` will tell you the URL you can visit in your browser to see the app. Exploring The Code ================== 1. The backend code lives in the `/assembly` folder. This code gets deployed to the NEAR blockchain when you run `yarn deploy:contract`. This sort of code-that-runs-on-a-blockchain is called a "smart contract" – [learn more about NEAR smart contracts][smart contract docs]. 2. The frontend code lives in the `/src` folder. [/src/index.html](/src/index.html) is a great place to start exploring. Note that it loads in `/src/index.js`, where you can learn how the frontend connects to the NEAR blockchain. 3. Tests: there are different kinds of tests for the frontend and backend. The backend code gets tested with the [asp] command for running the backend AssemblyScript tests, and [jest] for running frontend tests. You can run both of these at once with `yarn test`. Both contract and client-side code will auto-reload as you change source files. Deploy ====== Every smart contract in NEAR has its [own associated account][NEAR accounts]. When you run `yarn dev`, your smart contracts get deployed to the live NEAR TestNet with a throwaway account. When you're ready to make it permanent, here's how. Step 0: Install near-shell -------------------------- You need near-shell installed globally. Here's how: npm install --global near-shell This will give you the `near` [CLI] tool. Ensure that it's installed with: near --version Step 1: Create an account for the contract ------------------------------------------ Visit [NEAR Wallet] and make a new account. You'll be deploying these smart contracts to this new account. Now authorize NEAR CLI for this new account, and follow the instructions it gives you: near login Step 2: set contract name in code --------------------------------- Modify the line in `src/config.js` that sets the account name of the contract. Set it to the account id you used above. const CONTRACT_NAME = process.env.CONTRACT_NAME || 'your-account-here!' Step 3: change remote URL if you cloned this repo ------------------------- Unless you forked this repository you will need to change the remote URL to a repo that you have commit access to. This will allow auto deployment to Github Pages from the command line. 1) go to GitHub and create a new repository for this project 2) open your terminal and in the root of this project enter the following: $ `git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.git` Step 4: deploy! --------------- One command: yarn deploy As you can see in `package.json`, this does two things: 1. builds & deploys smart contracts to NEAR TestNet 2. builds & deploys frontend code to GitHub using [gh-pages]. This will only work if the project already has a repository set up on GitHub. Feel free to modify the `deploy` script in `package.json` to deploy elsewhere. [NEAR]: https://nearprotocol.com/ [yarn]: https://yarnpkg.com/ [AssemblyScript]: https://docs.assemblyscript.org/ [React]: https://reactjs.org [smart contract docs]: https://docs.nearprotocol.com/docs/roles/developer/contracts/assemblyscript [asp]: https://www.npmjs.com/package/@as-pect/cli [jest]: https://jestjs.io/ [NEAR accounts]: https://docs.nearprotocol.com/docs/concepts/account [NEAR Wallet]: https://wallet.nearprotocol.com [near-shell]: https://github.com/nearprotocol/near-shell [CLI]: https://www.w3schools.com/whatis/whatis_cli.asp [create-near-app]: https://github.com/nearprotocol/create-near-app [gh-pages]: https://github.com/tschaub/gh-pages
grv07_blockchain-poc
rust-counter-tutorial Cargo.toml src lib.rs
open-web-academy_Components-BOS
Contracts ToDoListAbi.txt README.md mpETH.css
# Components BOS This repository contains the codes used to implement BOS widgets in Near Protocol ## GuestBook Guestbook where you can add a new message. ## BookStore Book Store where you can register new books or buy books published by the community. ## TicTacToe Game of tic-tac-toe Player vs CPU. ## BurritoPetsMint Virtual pet minting over the Aurora network. ## BurritoPetsInteract Virtual pets interaction over the Aurora network. ## TokenFactory Component that allows the creation of tokens on the Aurora network. ## TokenVesting Component that allows vesting of tokens on the Aurora network. ## TokenFactoryVestingTabs Component with tab implementation for Token Factory and Vesting. ## MaverickSwap Component that allows you to swap tokens on the zkSync Era network. ## MaverickSwapTransactions Component that allows check token swap transactions on the zkSync Era network.
famemonsterx_near-test-task
README.md config-overrides.js config env.js getHttpsConfig.js jest babelTransform.js cssTransform.js fileTransform.js modules.js paths.js webpack.config.js webpack persistentCache createEnvironmentHash.js webpackDevServer.config.js package.json public index.html manifest.json robots.txt scripts build.js start.js test.js src common connectionConfig.ts index.ts keyStore.ts components form index.ts index.ts constants ActionTypes ActionTypes.ts index.ts wallet.ts FrontUrls.ts index.ts contracts MainContract.ts index.ts models Markets.ts PayloadAction.ts ViewMarket.ts index.ts routes index.ts screens Auth index.ts utils useAuth.ts Home components MarketsSelect index.ts index.ts hooks useHome.ts useMarkets.ts useViewMarket.ts index.ts index.ts types index.d.ts utils index.ts useWalletConnect.ts wrappers Wallet actions index.ts wallet.actions.ts index.ts reducers index.ts wallet.reducer.ts index.ts tsconfig.json
# Test task for Spin Used packages: create-react-app typescript near-api-js This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
han0110_evilink
.chainlink secret api.txt passphrase.txt .postgres initdb.d create-database-chainlink.sh create-database-the-graph.sh .solhint.json .yarnrc.yml README.md | contracts chainlink package.json src artifact.ts chainlink-stack.ts index.ts test MockLinkToken.test.ts ThresholdVRFConsumer.test.ts UpgradeableVRFConsumer.test.ts artifact.ts util.ts tsconfig.json faucet package.json src artifact.ts index.ts test Faucet.test.ts tsconfig.json flipcoin generated FlipCoin FlipCoin.ts schema.ts package.json src artifact.ts index.ts subgraph mapping.ts test FlipCoin.test.ts tsconfig.json waffle-0.4.js waffle-0.6.js waffle-0.8.js waffle.js package.json packages artifact-util package.json src index.ts tsconfig.json chainlink-client package.json src helper.ts index.ts type.ts tsconfig.json chainlink-orm package.json src index.ts prepared-statement.ts type.ts tsconfig.json chainlink-vrf README.md go main.go pkg vrf vrf.go vrf_test.go package.json src index.ts test index.test.ts tsconfig.json constant package.json src contract-address.ts index.ts tsconfig.json evilthereum README.md package.json src command index.ts serve.ts core blockchain.ts chainlink index.ts mocker.ts type.ts migration.ts randomness-hacker flipcoin.ts index.ts type.ts server.ts state-manager.ts index.ts util ethereum.ts logger.ts retry.ts tsconfig.json playground README.md config index.ts publicRuntime.js constant index.ts context apollo client.ts index.ts query flipcoin.ts theme colors.ts components button.ts heading.ts index.ts index.ts styles.ts theme.ts web3 connector.ts index.ts util.ts graphql-config.yml hook useBool.ts useWeb3.ts next-env.d.ts next.config.js package.json tsconfig.json type flipcoin.d.ts next-env.d.ts react-jazzicon.d.ts util env.ts scroll-control.ts string.ts script deploy-subgraph.sh docker-compose.sample.env docker-compose.yml run.sh util.sh tsconfig.json
# @evilink/evilthereum EVILthereum (base on [trufflesuite/ganache-core](https://github.com/trufflesuite/ganache-core)) implements the attack to steal Chainlink node's `vrf_key` and tamper the randomenss by changing block extra data for favorable result. ## Development ### Start with Chainlink Mocker ```bash yarn dev serve --chainlink-mocker-key 0x$(openssl rand -hex 32) ``` ### Create [`ResultChecker`](./src/core/randomness-hacker/type.ts#L11) for [`RandomnessHacker`](./src/core/randomness-hacker/index.ts#L22) 1. Design your victim contract in [`contracts`](../../contracts) and build artifact. 2. Add migration of victim contract in [`migration.ts`](src/core/migration.ts). 3. Add victim contract's address to [`contract-address.ts`](../constant/src/contract-address.ts) for future usage. 4. Implement `ResultChecker` and [register it as well-known victim](./src/core/randomness-hacker/index.ts#L73). # EVILink ![CI](https://github.com/han0110/evilink/workflows/CI/badge.svg) EVILink shows that a malicious miner still has a slim chance to tamper randomness provided by Chainlink's [VRF](https://blog.chain.link/verifiable-random-functions-vrf-random-number-generation-rng-feature) solution. - [EVILink](#evilink) - [Concept](#concept) - [What a Slim Chance](#what-a-slim-chance) - [Proof of Concept](#proof-of-concept) - [Rethink](#rethink) - [Take Away](#take-away) - [Packages](#packages) - [Contracts](#contracts) - [Common Utilities](#common-utilities) - [Chainlink Utilities](#chainlink-utilities) - [Applications](#applications) - [Development](#development) - [Prerequisite](#prerequisite) - [Prepare](#prepare) - [Build Docker Image](#build-docker-image) - [Start Docker Container](#start-docker-container) - [Reference](#reference) ## Concept ### What a Slim Chance Chainlink VRF is an awesome solution for **NEARLY tamper-proof randomness**. Why say **NEARLY tamper-proof**? For a verifiable randomness implemented by Chainlink, it is composed by these parameters ordered by their generation time: 1. `vrf_key` - generated before the corresponding public key registered as VRF service 2. `user_seed` - provided when user interact with the contract 3. `block_hash` and `block_number` - block containing the event `RandomnessRequest` The only parameter tamperable after transaction sent is the `block_hash`, which can be easily tuned by change the block head extra data, but miner still has no way to predict randomness if it does not have `vrf_key`. However, there exists these situations for randomenss to be tamperable: 1. `vrf_key` is leaked to miner 2. `vrf_key` is held by miner from the beginning 3. miner conspires with the malicious `vrf_key` holder So miner can tune the `block_hash` to get the favorable result before mining. | Condition | Diagram | | ---------- | ------------------------------------------------- | | Normal | ![VRF Tamper Proof](./asset/vrf-tamper-proof.png) | | Key Leaked | ![VRF Tamperable](./asset/vrf-tamperable.png) | ### Proof of Concept Here I present the first situation of randomenss to be tamperable to hack a coin tossing game. When malicious miner steals the `vrf_key`, it can make owner of the contract [`FlipCoin.sol`](./contracts/flipcoin/contract/FlipCoin.sol) always win and others always lose. | Owner | Others | | ------------------------------------ | -------------------------------------- | | ![owner](./asset/flipcoin-owner.gif) | ![others](./asset/flipcoin-others.gif) | ### Rethink So why Chainlink includes the manipulatable block information to be part of randomness? The reason is because the randomness will be fully manipulatable by `vrf_key` holder if it is only composed by `vrf_key` and `user_seed` (when holder is the user). The design to include block information prevents the **single-point-malicious** in most time. ### Take Away From Chainlink's awesome [blog](https://blog.chain.link/verifiable-random-functions-vrf-random-number-generation-rng-feature/#the-planned-evolution-of-chainlink-vrf), they are already integrating [threshold signatures](https://blog.chain.link/threshold-signatures-in-chainlink) with VRF to prevent **single-key-leaked-failure**, which is not only cost-effective and high-availability, but also is almost a tamper-proof randomness solution (in theory we still have very slim change to collect enough key shares, but extremely hard). Super looking forward to the approach. But before the upcoming approach, we can still use current version VRF with some good practices: 1. Contract should have a mechanism (by voting or by admin) to change the VRF service in case current one is thought malicious or key leaked. 2. Contract could request multiple randomness in **one transaction** and combine incoming randomnesses to be final randomness for a safer approach, it will be tamper-proof when **at least one secret key holder is safe and honest**. However, it costs much more both time and LINK. Implementation can be found [here](/contracts/chainlink/contract-0.6/ThresholdVRFConsumer.sol). ![Threshold VRF](./asset/threshold-vrf.png) ## Packages ### Contracts | Package | Description | | -------------------------------------------------------------- | ----------------------------------- | | [`@evilink/contracts-chainlink`](contracts/chainlink) | Chainlink related contracts | | [`@evilink/contracts-faucet`](contracts/faucet) | Faucet contract for ether | | [`@evilink/contracts-flipcoin`](contracts/flipcoin) | Coin tossing game using VRFConsumer | ### Common Utilities | Package | Description | | --------------------------------------------------- | -------------------------------------------------------- | | [`@evilink/artifact-util`](packages/artifact-util) | Artifact util for contract factory | | [`@evilink/constant`](packages/constant) | Constant including contract address, genesis private key | ### Chainlink Utilities | Package | Description | | --------------------------------------------------------- | ----------------------------------------------------- | | [`@evilink/chainlink-client`](packages/chainlink-client) | Chainlink API client | | [`@evilink/chainlink-orm`](packages/chainlink-orm) | Chainlink ORM client | | [`@evilink/chainlink-vrf`](packages/chainlink-vrf) | Chainlink VRF implementation in golang as gyp binding | ### Applications | Package | Description | | ----------------------------------------------- | --------------------------------------------------------- | | [`@evilink/evilthereum`](packages/evilthereum) | Malicious miner with VRF key hacking VRFConsumers | | [`@evilink/playground`](packages/playground) | Frontend for interaction with hacked contracts | ## Development ### Prerequisite - go1.15 - yarn2 ### Prepare ```bash # build chainlink vrf for gyp binding pushd packages/chainlink-vrf/go && make && popd yarn --immutable yarn build ``` ### Build Docker Image ```bash bash script/run.sh build ``` ### Start Docker Container ```bash cp docker-compose.sample.env docker-compose.env # after update the values in docker-compose.env bash script/run.sh up # wait for ipfs and graph-node ready bash script/run.sh deploy_subgraph flipcoin ``` ## Reference - [Chainlink VRF: On-chain Verifiable Randomness](https://blog.chain.link/verifiable-random-functions-vrf-random-number-generation-rng-feature) - [Making NSEC5 Practical for DNSSEC](https://eprint.iacr.org/2017/099.pdf) # @evilink/playground ## Development ### Prepare Dependencies Playground depends on a running graph-node serving GQL api, we can use [`script/docker-compose.yml`](/script/docker-compose.yml) for help ```bash bash ../../script/run.sh up \ postgres \ ipfs \ evilthereum \ # port 8577 is needed for rpc chainlink \ graph-node # port 8000, 8001 is needed for gql api ``` Then deploy subgraph ```bash VICTIM_CONTRACT=TODO bash ../../script/run.sh deploy_subgraph ${VICTIM_CONTRACT} ``` Finally ```bash yarn dev ``` ## Credit - The awesome flipping coin logo in pure css is made by [Hoonseok Park](https://codepen.io/parcon) in [codepen](https://codepen.io/parcon/pen/oxbLVd?editors=1100) # @evilink/chainlink-vrf NodeJS binding for [Chainlink VRF Adapter](https://github.com/smartcontractkit/chainlink/blob/develop/core/adapters/random.go) to generate randomness. ## TODO - [ ] Test on - [x] MacOS - [ ] Linux - [ ] Win - [ ] Remove go dependency and implement by [secp256k1](https://github.com/cryptocoinjs/secp256k1-node)