├── 6. 单元测试与集成测试 ├── .prettierrc.json ├── jest.config.json ├── .eslintrc.json ├── Cargo.toml ├── package.json ├── makefile ├── README.md ├── test │ ├── hello_test.spec.ts │ └── context.ts ├── src │ └── lib.rs └── tsconfig.json ├── 3. 合约的编译与部署 ├── near-cli-rs.png ├── macOS Keychain.png ├── Legacy Keychain.png └── README.md ├── 1. NEAR 区块链核心概念 ├── master key path.png └── README.md ├── 5. 跨合约调用与回调函数 ├── makefile ├── src │ ├── cross.rs │ └── lib.rs ├── Cargo.toml ├── README.md └── Cargo.lock ├── 2. 认识 NEAR 智能合约 ├── makefile ├── Cargo.toml ├── src │ └── lib.rs ├── README.md └── Cargo.lock ├── 4. 状态存储与容器 ├── makefile ├── Cargo.toml ├── src │ └── lib.rs ├── README.md └── Cargo.lock ├── 7. 编写一个 FT 合约 ├── makefile ├── Cargo.toml ├── README.md └── src │ └── lib.rs ├── 8. 编写一个 NFT 合约 ├── makefile ├── Cargo.toml ├── README.md └── src │ └── lib.rs ├── README.md └── .gitignore /6. 单元测试与集成测试/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /6. 单元测试与集成测试/jest.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "preset": "ts-jest", 3 | "detectOpenHandles": true, 4 | "testTimeout": 60000 5 | } 6 | -------------------------------------------------------------------------------- /3. 合约的编译与部署/near-cli-rs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanakannzashi/near-contract-course-basics/HEAD/3. 合约的编译与部署/near-cli-rs.png -------------------------------------------------------------------------------- /3. 合约的编译与部署/macOS Keychain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanakannzashi/near-contract-course-basics/HEAD/3. 合约的编译与部署/macOS Keychain.png -------------------------------------------------------------------------------- /3. 合约的编译与部署/Legacy Keychain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanakannzashi/near-contract-course-basics/HEAD/3. 合约的编译与部署/Legacy Keychain.png -------------------------------------------------------------------------------- /1. NEAR 区块链核心概念/master key path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanakannzashi/near-contract-course-basics/HEAD/1. NEAR 区块链核心概念/master key path.png -------------------------------------------------------------------------------- /6. 单元测试与集成测试/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "plugins": [ 5 | "@typescript-eslint" 6 | ], 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/recommended" 10 | ], 11 | "rules": { 12 | "eol-last": "error" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /5. 跨合约调用与回调函数/makefile: -------------------------------------------------------------------------------- 1 | RUSTFLAGS = "-C link-arg=-s" 2 | PACKAGE_NAME = "hello_cross" 3 | 4 | lint: 5 | @cargo fmt --all 6 | @cargo clippy --fix --allow-dirty --allow-staged 7 | 8 | build: 9 | @rustup target add wasm32-unknown-unknown 10 | RUSTFLAGS=$(RUSTFLAGS) cargo build --target wasm32-unknown-unknown --release 11 | @mkdir -p res 12 | @cp target/wasm32-unknown-unknown/release/$(PACKAGE_NAME).wasm ./res/ 13 | 14 | all: lint build 15 | -------------------------------------------------------------------------------- /2. 认识 NEAR 智能合约/makefile: -------------------------------------------------------------------------------- 1 | RUSTFLAGS = "-C link-arg=-s" 2 | PACKAGE_NAME = "hello_near" 3 | 4 | lint: 5 | @cargo fmt --all 6 | @cargo clippy --fix --allow-dirty --allow-staged 7 | 8 | build: 9 | @rustup target add wasm32-unknown-unknown 10 | RUSTFLAGS=$(RUSTFLAGS) cargo build --target wasm32-unknown-unknown --release 11 | @mkdir -p res 12 | @cp target/wasm32-unknown-unknown/release/$(PACKAGE_NAME).wasm ./res/ 13 | 14 | all: lint build 15 | -------------------------------------------------------------------------------- /4. 状态存储与容器/makefile: -------------------------------------------------------------------------------- 1 | RUSTFLAGS = "-C link-arg=-s" 2 | PACKAGE_NAME = "hello_collections" 3 | 4 | lint: 5 | @cargo fmt --all 6 | @cargo clippy --fix --allow-dirty --allow-staged 7 | 8 | build: 9 | @rustup target add wasm32-unknown-unknown 10 | RUSTFLAGS=$(RUSTFLAGS) cargo build --target wasm32-unknown-unknown --release 11 | @mkdir -p res 12 | @cp target/wasm32-unknown-unknown/release/$(PACKAGE_NAME).wasm ./res/ 13 | 14 | all: lint build 15 | -------------------------------------------------------------------------------- /7. 编写一个 FT 合约/makefile: -------------------------------------------------------------------------------- 1 | RUSTFLAGS = "-C link-arg=-s" 2 | PACKAGE_NAME = "hello_ft" 3 | 4 | lint: 5 | @cargo fmt --all 6 | @cargo clippy --fix --allow-dirty --allow-staged 7 | 8 | build: 9 | @rustup target add wasm32-unknown-unknown 10 | RUSTFLAGS=$(RUSTFLAGS) cargo build --target wasm32-unknown-unknown --release 11 | @mkdir -p res 12 | @cp target/wasm32-unknown-unknown/release/$(PACKAGE_NAME).wasm ./res/ 13 | 14 | test: 15 | @cargo test 16 | 17 | all: lint build test 18 | -------------------------------------------------------------------------------- /8. 编写一个 NFT 合约/makefile: -------------------------------------------------------------------------------- 1 | RUSTFLAGS = "-C link-arg=-s" 2 | PACKAGE_NAME = "hello_nft" 3 | 4 | lint: 5 | @cargo fmt --all 6 | @cargo clippy --fix --allow-dirty --allow-staged 7 | 8 | build: 9 | @rustup target add wasm32-unknown-unknown 10 | RUSTFLAGS=$(RUSTFLAGS) cargo build --target wasm32-unknown-unknown --release 11 | @mkdir -p res 12 | @cp target/wasm32-unknown-unknown/release/$(PACKAGE_NAME).wasm ./res/ 13 | 14 | test: 15 | @cargo test 16 | 17 | all: lint build test 18 | -------------------------------------------------------------------------------- /5. 跨合约调用与回调函数/src/cross.rs: -------------------------------------------------------------------------------- 1 | use near_sdk::{ext_contract, AccountId, PromiseOrValue, PublicKey}; 2 | 3 | // 声明 Linkdrop 合约的接口 4 | #[ext_contract(linkdrop_contract)] 5 | pub trait LinkdropContract { 6 | fn create_account( 7 | &mut self, 8 | new_account_id: AccountId, 9 | new_public_key: PublicKey, 10 | ) -> PromiseOrValue; 11 | } 12 | 13 | // 宏展开后会生成一个 `pub mod linkdrop_contract`, 包含对 `Promise` 的封装 14 | // 该代码自动生成, 无需编写 15 | // pub mod linkdrop_contract { 16 | // 17 | // } 18 | -------------------------------------------------------------------------------- /2. 认识 NEAR 智能合约/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_near" 3 | version = "1.0.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [lib] 9 | crate-type = ["cdylib"] 10 | 11 | [dependencies] 12 | near-sdk = "4.1.1" 13 | 14 | [patch.crates-io] 15 | parity-secp256k1 = { git = 'https://github.com/paritytech/rust-secp256k1.git' } 16 | 17 | [profile.release] 18 | codegen-units = 1 19 | opt-level = "z" 20 | lto = true 21 | debug = false 22 | panic = "abort" 23 | overflow-checks = true 24 | -------------------------------------------------------------------------------- /5. 跨合约调用与回调函数/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_cross" 3 | version = "1.0.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [lib] 9 | crate-type = ["cdylib"] 10 | 11 | [dependencies] 12 | near-sdk = "4.1.1" 13 | 14 | [patch.crates-io] 15 | parity-secp256k1 = { git = 'https://github.com/paritytech/rust-secp256k1.git' } 16 | 17 | [profile.release] 18 | codegen-units = 1 19 | opt-level = "z" 20 | lto = true 21 | debug = false 22 | panic = "abort" 23 | overflow-checks = true 24 | -------------------------------------------------------------------------------- /6. 单元测试与集成测试/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_test" 3 | version = "1.0.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [lib] 9 | crate-type = ["cdylib"] 10 | 11 | [dependencies] 12 | near-sdk = "4.1.1" 13 | 14 | [patch.crates-io] 15 | parity-secp256k1 = { git = 'https://github.com/paritytech/rust-secp256k1.git' } 16 | 17 | [profile.release] 18 | codegen-units = 1 19 | opt-level = "z" 20 | lto = true 21 | debug = false 22 | panic = "abort" 23 | overflow-checks = true 24 | -------------------------------------------------------------------------------- /4. 状态存储与容器/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_collections" 3 | version = "1.0.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [lib] 9 | crate-type = ["cdylib"] 10 | 11 | [dependencies] 12 | near-sdk = "4.1.1" 13 | 14 | [patch.crates-io] 15 | parity-secp256k1 = { git = 'https://github.com/paritytech/rust-secp256k1.git' } 16 | 17 | [profile.release] 18 | codegen-units = 1 19 | opt-level = "z" 20 | lto = true 21 | debug = false 22 | panic = "abort" 23 | overflow-checks = true 24 | -------------------------------------------------------------------------------- /7. 编写一个 FT 合约/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_ft" 3 | version = "1.0.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [lib] 9 | crate-type = ["cdylib"] 10 | 11 | [dependencies] 12 | near-sdk = "4.1.1" 13 | near-contract-standards = "4.1.1" 14 | 15 | [patch.crates-io] 16 | parity-secp256k1 = { git = 'https://github.com/paritytech/rust-secp256k1.git' } 17 | 18 | [profile.release] 19 | codegen-units = 1 20 | opt-level = "z" 21 | lto = true 22 | debug = false 23 | panic = "abort" 24 | overflow-checks = true 25 | -------------------------------------------------------------------------------- /8. 编写一个 NFT 合约/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_nft" 3 | version = "1.0.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [lib] 9 | crate-type = ["cdylib"] 10 | 11 | [dependencies] 12 | near-sdk = "4.1.1" 13 | near-contract-standards = "4.1.1" 14 | 15 | [patch.crates-io] 16 | parity-secp256k1 = { git = 'https://github.com/paritytech/rust-secp256k1.git' } 17 | 18 | [profile.release] 19 | codegen-units = 1 20 | opt-level = "z" 21 | lto = true 22 | debug = false 23 | panic = "abort" 24 | overflow-checks = true 25 | -------------------------------------------------------------------------------- /6. 单元测试与集成测试/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "commonjs", 4 | "scripts": { 5 | "test": "jest", 6 | "lint": "eslint 'test/**/*.ts' --fix", 7 | "prettier": "prettier 'test/**/*.ts' --write --list-different" 8 | }, 9 | "devDependencies": { 10 | "@types/jest": "^29.5.12", 11 | "@types/node": "^20.12.0", 12 | "@typescript-eslint/eslint-plugin": "^7.3.1", 13 | "@typescript-eslint/parser": "^7.3.1", 14 | "eslint": "^8.57.0", 15 | "jest": "^29.7.0", 16 | "near-workspaces": "^3.5.0", 17 | "prettier": "^3.0.1", 18 | "ts-jest": "^29.1.2", 19 | "typescript": "5.4.3" 20 | }, 21 | "engines": { 22 | "node": ">=20" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /6. 单元测试与集成测试/makefile: -------------------------------------------------------------------------------- 1 | RUSTFLAGS = "-C link-arg=-s" 2 | PACKAGE_NAME = "hello_test" 3 | 4 | lint-contract: 5 | @cargo fmt --all 6 | @cargo clippy --fix --allow-dirty --allow-staged 7 | 8 | lint-integration: 9 | @pnpm install 10 | @pnpm lint 11 | @pnpm prettier 12 | 13 | lint: lint-contract lint-integration 14 | 15 | build: 16 | @rustup target add wasm32-unknown-unknown 17 | RUSTFLAGS=$(RUSTFLAGS) cargo build --target wasm32-unknown-unknown --release 18 | @mkdir -p res 19 | @cp target/wasm32-unknown-unknown/release/$(PACKAGE_NAME).wasm ./res/ 20 | 21 | test-unit: 22 | @cargo test 23 | 24 | test-integration: 25 | @pnpm test 26 | 27 | test: test-unit test-integration 28 | 29 | all: lint build test 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NEAR 智能合约开发教程 (基础篇) 2 | 3 | 本篇是 [NEAR](https://docs.near.org/concepts/basics/protocol) 智能合约 (以下简称合约) 开发教程 (基础篇), 适合刚接触合约发开的新人开发者 4 | 5 | 通过本篇的学习, 你将了解合约开发的基本知识, 学会编写和测试合约代码, 学会部署合约并与之进行交互. 在本篇的最后还会带你了解 NEAR 协议标准 6 | [NEPs](https://github.com/near/neps) 并带你实现其中的两个标准合约 7 | 8 | 学习本篇之前, 希望你拥有以下前置知识 9 | * [Rust](https://www.rust-lang.org/zh-CN) 编程语言基础 10 | 11 | ## 章节列表 12 | 1. [NEAR 区块链核心概念](1.%20NEAR%20区块链核心概念/README.md) 13 | 2. [认识 NEAR 智能合约](2.%20认识%20NEAR%20智能合约/README.md) 14 | 3. [合约的编译与部署](3.%20合约的编译与部署/README.md) 15 | 4. [状态存储与容器](4.%20状态存储与容器/README.md) 16 | 5. [跨合约调用与回调函数](5.%20跨合约调用与回调函数/README.md) 17 | 6. [单元测试与集成测试](6.%20单元测试与集成测试/README.md) 18 | 7. [编写一个 FT 合约](7.%20编写一个%20FT%20合约/README.md) 19 | 8. [编写一个 NFT 合约](8.%20编写一个%20NFT%20合约/README.md) 20 | -------------------------------------------------------------------------------- /5. 跨合约调用与回调函数/README.md: -------------------------------------------------------------------------------- 1 | # 跨合约调用与回调函数 2 | NEAR 是一条异步链, 一笔交易会被拆分为一个或多个 Receipt 在不同的区块执行. 3 | Receipt 在 NEAR SDK 中被抽象为 `Promsie`, 发起跨合约调用就是创建一个包含 `FunctionCall` 的 `Promise`, 调用逻辑在当前方法执行的区块不会执行, 而是在之后的区块中异步执行 4 | 5 | 由于 Receipt 跨了区块, 当交易失败时无法完全回滚, 只会回滚发生错误的那个 Receipt, 因此我们往往需要对调用结果进行回调, 以保证合约状态一致性 6 | 7 | NEAR SDK 针对跨合约调用提供了高级 API, 该 API 本质上是对 Promise 的封装 8 | 9 | ## 跨合约调用示例 (使用高级 API) 10 | 该合约可以通过调用 [Linkdrop](https://github.com/near/near-linkdrop) 合约提供的 `create_account` 方法创建一个该合约账户的子账户, 用户需要支付一定的 NEAR 作为初始余额, 如果创建失败, 则退回这笔费用 11 | 12 | 1. 在 [cross.rs](./src/cross.rs) 中声明 Linkdrop 合约方法的接口 13 | 2. 在 [lib.rs](./src/lib.rs) 中实现回调函数 `resolve_create_account`, 主要实现账户创建失败后的退款逻辑 14 | 3. 在 [lib.rs](./src/lib.rs) 中编写完整的跨合约调用逻辑 `create_account_by_linkdrop` 15 | 16 | ## 手动分配 gas 17 | 跨合约调用时默认将剩余 gas 平均分配给所有调用, 高级 API 中可以通过 `with_static_gas` 和 `with_unused_gas_weight` 手动分配 gas 18 | -------------------------------------------------------------------------------- /6. 单元测试与集成测试/README.md: -------------------------------------------------------------------------------- 1 | # 单元测试与集成测试 2 | 3 | ## 单元测试 4 | 单元测试用于检测单元模块的代码逻辑, 从内部测试合约代码, 无法检测一些外部 API 和宏 5 | 6 | 如 [lib.rs](./src/lib.rs) 所示, 用 `#[cfg(test)]` 标注测试模块, 用 `#[test]` 标注测试任务, 测试主要使用 `near_sdk::test_utils` 模块 7 | 8 | ### 运行单元测试 9 | 运行单元测试 10 | ```shell 11 | cargo test 12 | ``` 13 | 14 | ## 集成测试 15 | 集成测试需要使用 workspaces, 会在本地起一个 sandbox, 模拟链上环境, 可以进行外部测试. 有 [workspaces-rs](https://github.com/near/workspaces-rs) 和 [workspaces-js](https://github.com/near/workspaces-js) 两种版本. 16 | 其中 JS 版本更加契合外部调用合约的习惯, 因此本教程选择 JS 版本 17 | 18 | ### 安装 workspaces 19 | ```shell 20 | pnpm add near-workspaces -D 21 | ``` 22 | 23 | ### 安装 jest 24 | workspaces 并不具备测试能力, 因此需要配合测试框架使用, 本教程使用 [jest](https://github.com/jestjs/jest) 作为测试框架 25 | ```shell 26 | pnpm add ts-jest jest @types/jest -D 27 | ``` 28 | 29 | 在 [jest.config.json](./jest.config.json) 中配置 jest 30 | ```json 31 | { 32 | "preset": "ts-jest", 33 | "detectOpenHandles": true, 34 | "testTimeout": 60000 35 | } 36 | ``` 37 | 38 | ### 运行集成测试 39 | jest 会自动寻找后缀为 `.sepc.ts` 或 `.test.ts` 的文件并执行测试代码 40 | ```shell 41 | pnpm test 42 | ``` 43 | 44 | ## 运行示例测试代码 45 | ```shell 46 | make all 47 | ``` 48 | -------------------------------------------------------------------------------- /6. 单元测试与集成测试/test/hello_test.spec.ts: -------------------------------------------------------------------------------- 1 | import { initContext, Context } from './context'; 2 | 3 | let context: Context; 4 | 5 | beforeAll(async () => { 6 | // 初始化全局上下文 7 | context = await initContext(); 8 | }); 9 | 10 | afterAll(async () => { 11 | const { worker } = context; 12 | // 记得关 sandbox, 不然多跑几次内存就满了 13 | await worker.tearDown(); 14 | }); 15 | 16 | test('Test setter without permission', async () => { 17 | const { contract, root } = context; 18 | 19 | const promise = root.call(contract, 'set_account_description', { 20 | account_id: 'bob.near', 21 | description: 'Nice Bob', 22 | }); 23 | 24 | await expect(promise).rejects.toThrow( 25 | 'Only contract owner can call this method.', 26 | ); 27 | }); 28 | 29 | test('Test setter getter', async () => { 30 | const { contract, alice } = context; 31 | 32 | await alice.call(contract, 'set_account_description', { 33 | account_id: 'bob.near', 34 | description: 'Nice Bob', 35 | }); 36 | 37 | const description = await contract.view('get_account_description', { 38 | account_id: 'bob.near', 39 | }); 40 | 41 | expect(description).toEqual('Nice Bob'); 42 | }); 43 | -------------------------------------------------------------------------------- /6. 单元测试与集成测试/test/context.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import { NearAccount, Worker } from 'near-workspaces'; 3 | 4 | export interface Context { 5 | worker: Worker; 6 | root: NearAccount; 7 | contract: NearAccount; 8 | alice: NearAccount; 9 | } 10 | 11 | export async function initContext(): Promise { 12 | const worker = await Worker.init({ 13 | network: 'sandbox', 14 | rm: true, // 关闭 sandbox 后删除测试缓存文件, 节约硬盘空间 15 | }); 16 | 17 | // 默认根账户名为 `test.near` 18 | const root = worker.rootAccount; 19 | 20 | // `hello_test.test.near` 21 | const contract = await root.createSubAccount('hello_test'); 22 | 23 | // `alice.test.near` 24 | const alice = await root.createSubAccount('alice'); 25 | 26 | const code = fs.readFileSync('res/hello_test.wasm'); 27 | 28 | // 部署并初始化合约 29 | const result = await contract 30 | .batch(contract.accountId) 31 | // Deploy Action 32 | .deployContract(code) 33 | // FunctionCall Action 34 | .functionCall('init', { 35 | owner_id: alice.accountId, 36 | }) 37 | // 执行交易 38 | .transact(); 39 | 40 | if (result.succeeded) { 41 | console.log('Succeed to init contract'); 42 | } else { 43 | throw Error(`Failed to init contract: ${result.Failure?.error_message}`); 44 | } 45 | 46 | return { worker, root, contract, alice }; 47 | } 48 | -------------------------------------------------------------------------------- /2. 认识 NEAR 智能合约/src/lib.rs: -------------------------------------------------------------------------------- 1 | use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; 2 | use near_sdk::{env, near_bindgen, require, AccountId, PanicOnDefault}; 3 | use std::collections::HashMap; 4 | 5 | #[near_bindgen] // 定义合约根结构, 一个项目中只能有一个根结构 6 | #[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)] // 实现 Borsh 序列化 7 | pub struct Contract { 8 | // 合约所有者 9 | owner_id: AccountId, 10 | // 账户及其描述信息. 注: `std::collections` 作为容器不是最好的选择, 此处仅用于教学目的 11 | descriptions: HashMap, 12 | } 13 | 14 | #[near_bindgen] // 定义合约方法 15 | impl Contract { 16 | #[init] // 标记合约初始化方法 17 | pub fn init(owner_id: AccountId) -> Self { 18 | Self { 19 | owner_id, 20 | descriptions: HashMap::new(), 21 | } 22 | } 23 | 24 | // Change 方法, 第一个参数为 `&mut self` 25 | pub fn set_account_description(&mut self, account_id: AccountId, description: String) { 26 | require!( 27 | env::predecessor_account_id() == self.owner_id, 28 | "Only contract owner can call this method." 29 | ); 30 | self.descriptions.insert(account_id, description); 31 | } 32 | 33 | // View 方法, 第一个参数为 `&self` 34 | pub fn get_account_description(&self, account_id: AccountId) -> Option<&String> { 35 | self.descriptions.get(&account_id) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /4. 状态存储与容器/src/lib.rs: -------------------------------------------------------------------------------- 1 | use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; 2 | use near_sdk::store::LookupMap; 3 | use near_sdk::{ 4 | env, near_bindgen, require, AccountId, BorshStorageKey, CryptoHash, PanicOnDefault, 5 | }; 6 | 7 | #[near_bindgen] 8 | #[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)] 9 | pub struct Contract { 10 | owner_id: AccountId, 11 | // 来自 `near_sdk::store` 12 | // 该容器内的数据与容器本身分开存储, 容器本身是根结构的一部分, 但内部数据是独立的存储记录 13 | descriptions: LookupMap, 14 | } 15 | 16 | // 容器在初始化的时候都需要唯一的 Storage Key 17 | // 可以使用 `BorshStorageKey` 宏来获取 Storage Key 18 | #[derive(BorshSerialize, BorshStorageKey)] 19 | enum StorageKey { 20 | Descriptions, 21 | 22 | #[allow(unused)] 23 | UnusedKey, 24 | 25 | // 动态的 Storage Key, 通常用于容器嵌套的情况 26 | #[allow(unused)] 27 | UnusedDynamicKey { 28 | hash: CryptoHash, 29 | }, 30 | } 31 | 32 | #[near_bindgen] 33 | impl Contract { 34 | #[init] 35 | pub fn init(owner_id: AccountId) -> Self { 36 | Self { 37 | owner_id, 38 | descriptions: LookupMap::new(StorageKey::Descriptions), 39 | } 40 | } 41 | 42 | pub fn set_account_description(&mut self, account_id: AccountId, description: String) { 43 | require!( 44 | env::predecessor_account_id() == self.owner_id, 45 | "Only contract owner can call this method." 46 | ); 47 | self.descriptions.insert(account_id, description); 48 | } 49 | 50 | pub fn get_account_description(&self, account_id: AccountId) -> Option<&String> { 51 | self.descriptions.get(&account_id) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /2. 认识 NEAR 智能合约/README.md: -------------------------------------------------------------------------------- 1 | # 认识 NEAR 智能合约 2 | NEAR 是一条高性能分片 Layer1 公链. NEAR 账户是 NEAR 区块链的访问入口, 而智能合约就是部署在 NEAR 账户上的一段代码. 3 | 智能合约提供接口, 让外部能够访问和修改账户状态 (也叫合约状态). 目前, 一个账户只能部署一份合约代码, 重复部署会覆盖原有代码 4 | 5 | 通常的合约交互的流程: 发起合约调用 -> 执行合约代码 -> 读写合约状态 -> 返回调用结果. 6 | 流程中有 3 处主要的数据交互 7 | 1. 发起合约调用时的参数传递 8 | 2. 读写合约状态 9 | 3. 返回调用结果时的返回值传递 10 | 11 | 1 和 3 属于合约外部数据传递, 默认情况下使用 [JSON](https://github.com/serde-rs/json) 序列化. 12 | 2 属于合约内部数据传递, 默认情况下使用 [Borsh](https://github.com/near/borsh-rs) 序列化 13 | 14 | ## 合约项目结构 15 | NEAR 合约项目与普通的 Rust 项目结构一致 16 | ``` 17 | . 18 | ├── Cargo.lock 19 | ├── Cargo.toml 20 | └── src 21 | └── lib.rs 22 | ``` 23 | 24 | [NEAR SDK](https://github.com/near/near-sdk-rs) 是 NEAR 合约发开的最常用工具, 我们需要导入该库 (本教程使用 `4.1.1` 版本) 25 | ```shell 26 | cargo add near-sdk@4.1.1 27 | ``` 28 | 29 | 我们需要在 `Cargo.toml` 中设置 `crate-type` 用于编译 WASM 二进制文件 30 | ```toml 31 | [lib] 32 | crate-type = ["cdylib"] 33 | ``` 34 | 35 | 注: 若出现找不到 `parity-secp256k1` 的错误, 请在 `Cargo.toml` 中添加 36 | ```toml 37 | [patch.crates-io] 38 | parity-secp256k1 = { git = 'https://github.com/paritytech/rust-secp256k1.git' } 39 | ``` 40 | 41 | ## 合约代码解析 42 | [lib.rs](./src/lib.rs) 是合约代码的入口, 本教程编写了一个非常简单的智能合约, 该合约有一个所有者权限 `owner_id`, 合约存储账户 `AccountId` 以及账户对应的描述信息 `String`. 43 | 只有合约所有者可以修改描述信息,任何人都可以读取描述信息 44 | 45 | ### 合约根结构 46 | `Contract` 结构体是合约的根结构, 使用 `#[near_bindgen]` 标记, 根结构需要被存储在合约状态里, 因此还需要实现 Borsh 序列化 47 | 48 | ### 合约方法 49 | 合约方法被定义在使用 `#[near_bindgen]` 标记的 `impl` 块中, 并且只有 `pub` 的方法才能被合约外部访问 50 | 51 | 合约方法可以是 52 | * 第一个参数为 `&self` 的 View 方法 53 | * 第一个参数为 `&mut self` 的 Change 方法 54 | * 第一个参数与 `self` 无关的合约初始化方法 55 | 56 | ### 合约初始化 57 | 合约默认使用 `Default` trait 来初始化, 因此我们必须为根结构实现这个 trait, 但是 `default` 方法没有参数, 用于初始化不太灵活, 绝大多数情况下我们都会自定义初始化方法. 58 | `init` 方法就是一个带参数的初始化方法, 使用 `#[init]` 标记, 同时我们还需要为根结构实现一个不可用的 `default` 方法 `#derive[PanicOnDefault]` 以通过编译. 59 | 60 | ### View 方法和 Change 方法 61 | `get_account_description` 方法第一个参数是 `&self` 无法修改合约状态, 因此是一个 View 方法; 62 | 而 `set_account_description` 第一个参数是 `&mut self` 允许修改合约状态,因此是一个 Change 方法. 63 | View 方法可以不消耗 gas 直接调用, 而 Change 方法必须发起一笔交易消耗 gas 去调用 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | 106 | # Local dataset 107 | dataset/local 108 | 109 | # Local files 110 | .DS_Store 111 | 112 | # JetBrains IDE 113 | .idea 114 | 115 | # Contract WASM 116 | res 117 | 118 | # Build target 119 | target 120 | -------------------------------------------------------------------------------- /6. 单元测试与集成测试/src/lib.rs: -------------------------------------------------------------------------------- 1 | use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; 2 | use near_sdk::store::LookupMap; 3 | use near_sdk::{env, near_bindgen, require, AccountId, BorshStorageKey, PanicOnDefault}; 4 | 5 | #[near_bindgen] 6 | #[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)] 7 | pub struct Contract { 8 | owner_id: AccountId, 9 | descriptions: LookupMap, 10 | } 11 | 12 | #[derive(BorshSerialize, BorshStorageKey)] 13 | enum StorageKey { 14 | Descriptions, 15 | } 16 | 17 | #[near_bindgen] 18 | impl Contract { 19 | #[init] 20 | pub fn init(owner_id: AccountId) -> Self { 21 | Self { 22 | owner_id, 23 | descriptions: LookupMap::new(StorageKey::Descriptions), 24 | } 25 | } 26 | } 27 | 28 | #[near_bindgen] 29 | impl Contract { 30 | pub fn set_account_description(&mut self, account_id: AccountId, description: String) { 31 | require!( 32 | env::predecessor_account_id() == self.owner_id, 33 | "Only contract owner can call this method." 34 | ); 35 | self.descriptions.insert(account_id, description); 36 | } 37 | 38 | pub fn get_account_description(&self, account_id: AccountId) -> Option<&String> { 39 | self.descriptions.get(&account_id) 40 | } 41 | } 42 | 43 | #[cfg(test)] 44 | mod test { 45 | use crate::Contract; 46 | use near_sdk::test_utils::VMContextBuilder; 47 | use near_sdk::{testing_env, AccountId}; 48 | 49 | fn alice() -> AccountId { 50 | "alice.near".parse().unwrap() 51 | } 52 | 53 | fn bob() -> AccountId { 54 | "bob.near".parse().unwrap() 55 | } 56 | 57 | #[test] 58 | #[should_panic(expected = "Only contract owner can call this method.")] 59 | fn test_setter_without_permission() { 60 | let mut contract = Contract::init(alice()); 61 | contract.set_account_description(bob(), "Nice Bob".to_string()); 62 | } 63 | 64 | #[test] 65 | fn test_setter_getter() { 66 | let mut contract = Contract::init(alice()); 67 | 68 | let context = VMContextBuilder::new() 69 | .predecessor_account_id(alice()) 70 | .build(); 71 | testing_env!(context); 72 | 73 | contract.set_account_description(bob(), "Nice Bob".to_string()); 74 | let description = contract.get_account_description(bob()).unwrap(); 75 | assert_eq!(description, "Nice Bob"); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /4. 状态存储与容器/README.md: -------------------------------------------------------------------------------- 1 | # 状态存储与容器 2 | 3 | ## 状态存储 4 | NEAR 链上数据以 Key - Value 的形式存储 5 | 6 | 合约根结构 (由 `#[near_bindgen]` 标记的结构体) 会被序列化成一条记录, 并且这条记录的 Key 固定为 `b"STATE"`, 对应的 base64 值为 `U1RBVEU=`. 7 | 当合约被调用时, 根结构会被反序列化到内存 8 | 9 | ### 合约状态 10 | ```json 11 | [ 12 | { 13 | "key": "U1RBVEU=", 14 | "value": "EgAAAGNvcm5mbG93ZXIudGVzdG5ldAAAAAA=" 15 | } 16 | ] 17 | ``` 18 | 初始化后的合约状态只有一条记录, 其中 `value` 的值就是我们定义的 `Contract` 结构体 19 | 20 | ### 插入数据后的合约状态 21 | 当我们仿照第一章中的示例合约, 使用 `std::collections::HashMap` 作为容器时, 这个容器包括它内部的数据都会作为合约根结构的一部分存在. 22 | 当插入数据时, 数据会被保存为根结构的一部分, 使根结构变大 23 | ```json 24 | [ 25 | { 26 | "key": "U1RBVEU=", 27 | "value": "EgAAAGNvcm5mbG93ZXIudGVzdG5ldAEAAAAFAAAAYWxpY2UEAAAAZ29vZA==" 28 | } 29 | ] 30 | ``` 31 | 32 | 可以看到 `value` 对应的字符串变长了但是记录的数量没改变 33 | 34 | ## 容器 35 | 如果根结构一直增大, 当合约被调用时反序列化需要消耗更多的 gas, 一旦超出 gas 上限可能会导致合约无法正常运行 36 | 37 | 为了解决这个问题, near-sdk 提供了两个容器模块, 分别是 `near_sdk::store` 和 `near_sdk::collections` (以下简称 Store 和 Collections). 38 | 这些容器本身与它们内部的数据是分离的, 当我们向容器中插入一条数据时, 在链上会产生一条 (或多条) 新的记录, 而不是将数据保存为合约根结构的一部分 39 | 40 | ⚠️ Store 和 Collections 的容器均未实现 JSON 序列化, 因此默认情况下无法把它们作为合约方法的返回值. 如果希望返回容器内的部分或全部数据, 请使用迭代器功能转换为标准库容器 41 | 42 | ### 使用 Collections 时合约状态示例 43 | 插入数据前 44 | ```json 45 | [ 46 | { 47 | "key": "U1RBVEU=", 48 | "value": "EgAAAGNvcm5mbG93ZXIudGVzdG5ldAEAAAAA" 49 | } 50 | ] 51 | ``` 52 | 53 | 插入数据后 54 | ```json 55 | [ 56 | { 57 | "key": "U1RBVEU=", 58 | "value": "EgAAAGNvcm5mbG93ZXIudGVzdG5ldAEAAAAA" 59 | }, 60 | { 61 | "key": "AAUAAABhbGljZQ==", 62 | "value": "BAAAAGdvb2Q=" 63 | } 64 | ] 65 | ``` 66 | 67 | 可以看到合约根结构的 `value` 值并没有变化, 但是产生了一条新的记录, 这些记录只有在需要的时候才会参与反序列化 68 | 69 | ### 常用容器 70 | * `LookupMap `: 不可迭代的映射类型 71 | * `LookupSet`: 不可迭代的集合类型 72 | * `Vector`: 可迭代的列表类型 73 | * `UnorderedMap`: 可迭代的映射类型, 相比 `LookupMap` 存储占用更大 74 | * `UnorderedSet`: 可迭代的集合类型, 相比 `LookupSet` 存储占用更大 75 | * `LazyOption`: 按需加载的数据类型, 适合存储大型数据 76 | 77 | 由于每个容器在插入数据时都会在全局状态中产生一条新的记录, 需要有唯一的前缀与容器绑定, 用于区分不同容器的数据. 78 | 因此这些容器在初始化时都需要传入唯一的 Storage Key 作为记录前缀 79 | 80 | 可以使用 rust 的 `enum` 类型配合 `BorshStorageKey` 宏得到 Storage Key 81 | 82 | ### Store 与 Collections 的区别 83 | | | Store | Collections | 84 | |---------------|--------------------------------------|-------------------| 85 | | 缓存 | 有 | 无 | 86 | | 插入的数据类型 | 所有权类型 `K` 和 `V` | 引用类型 `&K` 和 `&V` | 87 | | 获取的数据类型 | 引用类型 `Option<&V>` 或 `Option<&mut V>` | 所有权类型 `Option` | 88 | | 修改数据后是否需要重新插入 | 不需要 | 需要 | 89 | 90 | Store 与 Collections 在使用方式上区别较大, 通常不建议在同一个项目中同时使用这两个模块 91 | -------------------------------------------------------------------------------- /3. 合约的编译与部署/README.md: -------------------------------------------------------------------------------- 1 | # 合约的编译与部署 2 | 3 | ## 安装 NEAR CLI 4 | NEAR CLI 是一个与 NEAR 区块链交互的终端工具, 有 [near-cli-rs](https://github.com/near/near-cli-rs) 和 [near-cli-js](https://github.com/near/near-cli) 两种版本 5 | 6 | 其中 Rust 版是交互式终端, 并且功能更加强大, 因此本教程选择 Rust 版本 7 | ```shell 8 | cargo install near-cli-rs 9 | ``` 10 | 11 | 与 CLI 交互 12 | ```shell 13 | near 14 | ``` 15 | 16 | ![near-cli-rs](./near-cli-rs.png) 17 | 18 | ### 切换 RPC 19 | NEAR [官方 RPC](https://rpc.testnet.near.org) 需要科学上网, 因此我们可能需要使用个人 RPC, 可以通过 [All That Node](https://www.allthatnode.com) 免费注册个人 RPC 20 | 21 | 以 macOS 为例, 获取测试网 RPC 后编辑 `~/Library/Application\ Support/near-cli/config.toml` 文件, 修改 `[network_connection.testnet]` 下的 `rpc_url` 字段即可切换 RPC 22 | 23 | ## 创建并导入 NEAR 账户 24 | 1. 打开测试网网页钱包 [MyNearWallet](https://testnet.mynearwallet.com), 根据指引注册 NEAR 账户, 保存好助记词 25 | 2. 将助记词导入终端 26 | ```shell 27 | near account import-account using-seed-phrase "${YOUR_SEED_PHRASE}" --seed-phrase-hd-path 'm/44'\''/397'\''/0'\''' network-config testnet 28 | ``` 29 | 30 | ### Keychain 31 | 导入私钥时, 可以选择保存在 macOS Keychain 或 Legacy Keychain 中 32 | 33 | 如果保存在 macOS Keychain 中, 可以在 macOS 自带的**钥匙串访问**应用中找到私钥文件. 34 | 当导入同一个账户的多个不同私钥时, 虽然钥匙串名称是相同的, 但由于钥匙串账户不同, 私钥文件不会发生覆盖. 当需要签署交易的时候, 会自动去找钥匙串中可用的私钥进行签名. 35 | **私钥文件不会被 iCloud 同步** 36 | 37 | ![macOS Keychain](./macOS%20Keychain.png) 38 | 39 | 如果保存在 Legacy Keychain 中, 可以在 `~/.near-credentials/${NETWORK_ID}` 目录中找到私钥文件. 包括一个与账户同名的 JSON 文件和一个与账户同名的目录, 40 | 目录里有一个与公钥同名的 JSON 文件, 该文件的内容和外面那个 JSON 是一样的, 都是私钥文件, 只是文件名不一样. 41 | 当导入同一个账户的多个不同私钥时, 最外面的 JSON 文件不会被覆盖, 而是将新的私钥文件保存在对应目录中. 当需要签署交易的时候, 会自动去找对应目录中可用的私钥进行签名 42 | 43 | ![Legacy Keychain](./Legacy%20Keychain.png) 44 | 45 | ## 编译第一章中的示例合约 46 | 1. 安装 WASM 编译目标 47 | ```shell 48 | rustup target add wasm32-unknown-unknown 49 | ``` 50 | 2. 编译合约 51 | ```shell 52 | RUSTFLAGS="-C link-arg=-s" cargo build --target wasm32-unknown-unknown --release 53 | ``` 54 | 3. 将合约 WASM 文件移动到项目根目录下方便后续操作 55 | ```shell 56 | mkdir -p ./res && cp ./target/wasm32-unknown-unknown/release/hello_near.wasm ./res/ 57 | ``` 58 | 59 | 以上操作已经封装在 makefile 文件中 60 | ```shell 61 | make all 62 | ``` 63 | 64 | ## 部署和交互 65 | 假设你注册了两个测试网账户 `alice.testnet` 和 `code.testnet`, 一个用于作为主账户, 另一个用于作为合约账户, 私钥保存在 legacy keychain 中 66 | 67 | 1. 部署并初始化合约 68 | ```shell 69 | near contract deploy code.testnet use-file ./res/hello_near.wasm with-init-call init json-args '{"owner_id":"alice.testnet"}' prepaid-gas '100.000 TeraGas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send 70 | ``` 71 | 2. 调用 Change 方法 72 | ```shell 73 | near contract call-function as-transaction code.testnet set_account_description json-args '{"account_id":"bob.testnet","description":"Nice Bob"}' prepaid-gas '100.000 TeraGas' attached-deposit '0 NEAR' sign-as alice.testnet network-config testnet sign-with-keychain send 74 | ``` 75 | 3. 调用 View 方法 76 | ```shell 77 | near contract call-function as-read-only code.testnet get_account_description json-args '{"account_id":"bob.testnet"}' network-config testnet now 78 | ``` 79 | -------------------------------------------------------------------------------- /7. 编写一个 FT 合约/README.md: -------------------------------------------------------------------------------- 1 | # 编写一个 FT 合约 2 | FT 即 Fungible Token 同质化通证 3 | 4 | NEAR 的 FT 标准 5 | * [NEP141](https://github.com/near/NEPs/blob/master/neps/nep-0141.md) 6 | * [NEP148](https://github.com/near/NEPs/blob/master/neps/nep-0148.md) 7 | 8 | ## FT 标准实现 9 | NEAR SDK 实现了标准的 FT, 需要额外引入 `near-contract-standards` 10 | ```toml 11 | [dependencies] 12 | near-sdk = "4.1.1" 13 | near-contract-standards = "4.1.1" 14 | ``` 15 | 16 | 其中的 `FungibleToken` 类型即 FT 标准实现, 我们可以将其作为合约的一个字段, 然后把它的实现封装成合约方法. 17 | 标准 FT 不仅实现了 NEP141 和 NEP148, 还实现了存储管理 [NEP145](https://github.com/near/NEPs/blob/master/neps/nep-0145.md) 18 | 19 | ### NEP141 20 | ```rust 21 | pub trait FungibleTokenCore { 22 | // 给普通账户转账. 调用该方法需要附加 1 yocto NEAR 以保证安全性 23 | fn ft_transfer(&mut self, receiver_id: AccountId, amount: U128, memo: Option); 24 | 25 | // 给合约账户转账, 以触发合约相关逻辑, 返回值的含义是实际转账的 FT 数量. 调用该方法需要附加 1 yocto NEAR 以保证安全性 26 | fn ft_transfer_call( 27 | &mut self, 28 | receiver_id: AccountId, 29 | amount: U128, 30 | memo: Option, 31 | msg: String, 32 | ) -> PromiseOrValue; 33 | 34 | // 查询 FT 总供应量 35 | fn ft_total_supply(&self) -> U128; 36 | 37 | // 查询账户持有 FT 的数量 38 | fn ft_balance_of(&self, account_id: AccountId) -> U128; 39 | } 40 | 41 | pub trait FungibleTokenResolver { 42 | // `ft_transfer_call` 内部的回调函数 43 | fn ft_resolve_transfer( 44 | &mut self, 45 | sender_id: AccountId, 46 | receiver_id: AccountId, 47 | amount: U128, 48 | ) -> U128; 49 | } 50 | ``` 51 | 52 | `near-contract-standards` 提供了 `impl_fungible_token_core` 宏来快速给合约实现上述接口 53 | 54 | ### NEP 145 55 | ```rust 56 | pub trait StorageManagement { 57 | // 注册 FT 持有者信息并支付存储费. 调用该方法需要附加一定量的 NEAR 作为存储费 58 | fn storage_deposit( 59 | &mut self, 60 | account_id: Option, 61 | registration_only: Option, 62 | ) -> StorageBalance; 63 | 64 | // 提取用户已支付的存储费. 调用该方法需要附加 1 yocto NEAR 以保证安全性 65 | fn storage_withdraw(&mut self, amount: Option) -> StorageBalance; 66 | 67 | // 注销 FT 持有者信息并返还存储费. 调用该方法需要附加 1 yocto NEAR 以保证安全性 68 | fn storage_unregister(&mut self, force: Option) -> bool; 69 | 70 | // 查询合约对单个用户需要的存储费范围 71 | fn storage_balance_bounds(&self) -> StorageBalanceBounds; 72 | 73 | // 查询用户支付的存储费, 对于未注册的用户返回 `None` 74 | fn storage_balance_of(&self, account_id: AccountId) -> Option; 75 | } 76 | ``` 77 | 78 | `near-contract-standards` 提供了 `impl_fungible_token_storage` 宏来快速给合约实现上述接口 79 | 80 | ### NEP148 81 | ```rust 82 | pub trait FungibleTokenMetadataProvider { 83 | // FT 合约详情 84 | fn ft_metadata(&self) -> FungibleTokenMetadata; 85 | } 86 | ``` 87 | 88 | ## Mint 和 Burn 89 | mint 和 burn 不是标准的操作, 因此我们需要自己实现. 需要注意的是 mint 的时候对于没有注册 FT 持有者信息的用户, 需要先注册再 mint. 90 | 也可以让用户自己从合约外部调用 `storage_deposit` 进行注册并支付存储费, 取决于开发者想怎么实现 91 | 92 | ## 接收合约 93 | 如果一个合约需要感知到自己接收了用户转账的 FT, 则该合约需要实现 `ft_on_transfer` 来触发合约相关操作 94 | ```rust 95 | pub trait FungibleTokenReceiver { 96 | // 接收合约的这个方法会被 `ft_transfer_call` 调用, 返回值的含义是退回的 FT 数量 97 | fn ft_on_transfer( 98 | &mut self, 99 | sender_id: AccountId, 100 | amount: U128, 101 | msg: String, 102 | ) -> PromiseOrValue; 103 | } 104 | ``` 105 | -------------------------------------------------------------------------------- /1. NEAR 区块链核心概念/README.md: -------------------------------------------------------------------------------- 1 | # NEAR 区块链核心概念 2 | NEAR 是一条基于分片的异步区块链, 有一些与其他区块链不同的独特概念 3 | 4 | ## 出块时间 5 | NEAR 的出块时间在 1.2 s 左右 6 | 7 | ## 最终确认 8 | NEAR 的最终确认时间是 1 s 左右 9 | 10 | ## 单位换算 11 | `1 NEAR = 10 ^ 24 yoctoNEAR` 12 | 13 | `1 Tgas = 10 ^ 12 gas`. 单笔交易 gas 消耗上限为 `300 Tgas` 14 | 15 | ## 存储与 gas 价格 16 | NEAR 的存储价格为 `10 ^ -5 NEAR / Byte` 17 | 18 | NEAR 的 gas 价格为 `10 ^ -4 NEAR / Tgas` 19 | 20 | ## 分片 21 | NEAR 是一条全分片区块链, 没有所谓的主链用于协调分片. 22 | 验证节点只处理自己分片的交易, 也只打包自己分片的交易. 23 | 验证节点与分片的对应关系是隐藏的, 且会随周期改变. 24 | 跨分片通信至少需要 2 个区块才能完成 25 | 26 | ## Action 27 | Action 是 NEAR 链上操作的基本单位 28 | 29 | 在 NEAR 上有且仅有以下 8 种 Action 30 | * `Transfer`: 转账 NEAR 31 | * `FunctionCall`: 合约调用 32 | * `CreateAccount`: 创建子账户 33 | * `DeleteAccount`: 删除账户 34 | * `AddKey`: 新增公钥 35 | * `DeleteKey`: 删除公钥 36 | * `Deploy`: 部署合约 37 | * `Stake`: 质押 NEAR 38 | 39 | ## Transaction 40 | Transaction 是由用户私钥签名并支付 gas 费发起的一系列修改链上状态的 Action 的集合 41 | 42 | Transaction 包括几个关键参数 43 | * `signer_id`: 交易签名者 44 | * `receiver_id`: 交易接收者 45 | * `actions`: Action 列表 46 | * `tx_hash`: 最近的任意一笔链上交易的哈希 47 | * `public_key`: 用于验证签名的公钥 48 | * `nonce`: 比公钥当前 nonce 值大的新 nonce 值 49 | 50 | ## Receipt 51 | Receipt 是为了处理跨分片通信而存在的概念 52 | 53 | Transaction 被打包进区块后不会直接执行, 而是先转换为 Receipt, 可以认为 Receipt 是一种可执行的 Transaction 格式. 54 | Receipt 中的 Action 列表会在一个区块内执行完成, 执行具有原子性 55 | 56 | 如果 Action 列表中包含 FunctionCall, 则执行完毕后可能产生新的子 Receipt. 57 | 子 Receipt 会在后面的区块执行, 因此子 Receipt 中的 Action 列表与父 Receipt 中的 Action 列表之间**不具有原子性**. 58 | 产生子 Receipt 是因为被调用的函数内部可能发生了跨合约调用 (FunctionCall Action) 或转账 (Transfer Action) 或其他操作, 这些操作都是异步的, 在函数被调用的那个区块不会执行 59 | 60 | ### Signer, Predecessor, Receiver 61 | Signer 是绝对概念, Predecessor 和 Receiver 是相对概念 62 | 63 | 假设用户 Alice 发起一笔交易调用了 ContractA 合约, ContractA 合约又调用了 ContractB 合约. 64 | 即 Alice -> ContractA -> ContractB. 65 | Signer 始终是 Alice. 66 | 对于 Alice -> ContractA, Predecessor 是 Alice, Receiver 是 ContractA. 67 | 对于 ContractA -> ContractB, Predecessor 是 ContractA, Receiver 是 ContractB 68 | 69 | ## 账户模型 70 | 71 | ### 域名账户 72 | NEAR 的账户是可读域名账户 73 | 74 | 没有 `.` 的账户是顶级账户, 其余都是子账户. 75 | 顶级账户 (32 字符以内) 只能由 [registrar](https://explorer.near.org/accounts/registrar) 创建, 该账户目前受 NEAR Foundation 控制. 76 | 子账户只能由其**直接父账户**创建, 子账户没有级数限制, 只要总长度不超过 64 个字符即可, 父账户对子账户没有控制权. 77 | 通过对公钥的 16 进制编码可以获得一个长度为 64 个字符的账户, 一般称为 Implicit Account, 其本质是一个顶级账户, 由于占满了 64 个字符, 它不能创建子账户 78 | 79 | ### 抽象账户 80 | NEAR 的账户是抽象账户, 可以在指定账户直接部署智能合约 81 | 82 | ### 多密钥对账户 83 | NEAR 的账户是多密钥对账户, 创建一个账户即向链上申请一个账户名, 然后绑定一个公钥到该账户名上, 通过对应的私钥访问该账户, 一个账户上面可以绑定多个公钥 84 | 85 | 密钥分为两种权限 86 | * `FullAccess`: 完全访问权限 87 | * `FunctionCallAccess`: 只允许调用特定的合约方法 88 | 89 | `FunctionCallAccess` 权限的密钥通常在登陆 APP 的时候生成并给到 App 前端, 让 App 能自动帮用户签署低风险交易, 减少用户与钱包交互的频率, 从而优化用户的体验 90 | 91 | ## 私钥 92 | NEAR 使用 ed25519 椭圆曲线 93 | 94 | 私钥 `base58(32 bytes private key + 32 bytes public key)` 原始数据大小为 64 字节, base58 字符串长度为 88 字符 95 | 96 | 公钥 `base58(32 bytes public key)` 原始数据大小为 32 字节, base58 字符串长度为 44 字符 97 | 98 | ## 助记词 99 | NEAR 助记词符合以下规范 100 | * [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) 101 | * [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) 102 | * [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) 103 | 104 | ### 派生路径 105 | 助记词通过派生路径转换为私钥 106 | 107 | 默认派生路径为 `m/44'/397'/0'` 108 | 109 | ![master path](./master%20key%20path.png) 110 | 111 | ⚠️ 使用 [Ledger](https://www.ledger.com) 时默认派生路径为 `m/44'/397'/0'/0'/1'` 112 | -------------------------------------------------------------------------------- /5. 跨合约调用与回调函数/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod cross; 2 | 3 | use crate::cross::linkdrop_contract; 4 | use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; 5 | use near_sdk::json_types::U128; 6 | use near_sdk::serde::Serialize; 7 | use near_sdk::{ 8 | env, log, near_bindgen, serde_json, AccountId, Gas, GasWeight, PanicOnDefault, Promise, 9 | PromiseError, PromiseOrValue, PublicKey, 10 | }; 11 | 12 | #[near_bindgen] 13 | #[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)] 14 | pub struct Contract { 15 | // Linkdrop 合约地址 16 | linkdrop_contract_id: AccountId, 17 | } 18 | 19 | #[near_bindgen] 20 | impl Contract { 21 | #[init] 22 | pub fn init(linkdrop_contract_id: AccountId) -> Self { 23 | Self { 24 | linkdrop_contract_id, 25 | } 26 | } 27 | } 28 | 29 | #[near_bindgen] 30 | impl Contract { 31 | // 通过 Linkdrop 合约创建一个子账户, 需要支付一定的 NEAR 作为初始余额, 如果创建失败. 则退回这笔费用 32 | // 该方法使用高级 API 编写, 不直接使用 `Promise` 33 | #[payable] // 标记该方法在调用时接受附带的 NEAR 34 | pub fn create_account_by_linkdrop( 35 | &mut self, 36 | new_account_id: AccountId, 37 | new_public_key: PublicKey, 38 | ) -> PromiseOrValue<()> { 39 | let amount = env::attached_deposit(); 40 | // `U128` 是 `u128` 的封装类型, 使用 `String` 的 JSON 序列化方式, 避免大数在序列化之后产生精度丢失 41 | let amount = U128(amount); 42 | 43 | // `ext` 是一个固定的方法 44 | linkdrop_contract::ext(self.linkdrop_contract_id.clone()) 45 | // 附带 NEAR 用于创建账户 46 | .with_attached_deposit(amount.0) 47 | // 创建调用 `create_account` 的 `Promise`, 调用逻辑在当前区块不执行 48 | .create_account(new_account_id, new_public_key) 49 | .then( 50 | // `ext` 是一个固定的方法, 除了使用 `Self::ext` 之外, 也可以像调用 Linkdrop 合约一样先声明接口, 再通过模块进行调用 51 | Self::ext(env::current_account_id()) 52 | // 创建调用 `resolve_create_account` 的 `Promise`, 调用逻辑在当前区块不执行 53 | .resolve_create_account(env::predecessor_account_id(), amount), 54 | ) 55 | .into() 56 | } 57 | } 58 | 59 | #[near_bindgen] 60 | impl Contract { 61 | // 通过 Linkdrop 合约创建一个子账户, 需要支付一定的 NEAR 作为初始余额, 如果创建失败. 则退回这笔费用 62 | // 该方法直接使用 `Promise` 编写, 不使用高级 API, 代码量更大 63 | #[payable] 64 | pub fn create_account_by_linkdrop_using_promise( 65 | &mut self, 66 | new_account_id: AccountId, 67 | new_public_key: PublicKey, 68 | ) -> PromiseOrValue<()> { 69 | let amount = env::attached_deposit(); 70 | let amount = U128(amount); 71 | 72 | #[derive(Serialize)] 73 | #[serde(crate = "near_sdk::serde")] 74 | struct CreateAccountArgs { 75 | new_account_id: AccountId, 76 | new_public_key: PublicKey, 77 | } 78 | 79 | #[derive(Serialize)] 80 | #[serde(crate = "near_sdk::serde")] 81 | struct ResolveCreateAccountArgs { 82 | payer_id: AccountId, 83 | amount: U128, 84 | } 85 | 86 | Promise::new(self.linkdrop_contract_id.clone()) 87 | .function_call_weight( 88 | "create_account".to_string(), 89 | serde_json::to_vec(&CreateAccountArgs { 90 | new_account_id, 91 | new_public_key, 92 | }) 93 | .unwrap(), 94 | amount.0, 95 | Gas(0), 96 | GasWeight(1), 97 | ) 98 | .then( 99 | Promise::new(env::current_account_id()).function_call_weight( 100 | "resolve_create_account".to_string(), 101 | serde_json::to_vec(&ResolveCreateAccountArgs { 102 | payer_id: env::predecessor_account_id(), 103 | amount, 104 | }) 105 | .unwrap(), 106 | 0, 107 | Gas(0), 108 | GasWeight(1), 109 | ), 110 | ) 111 | .into() 112 | } 113 | } 114 | 115 | #[near_bindgen] 116 | impl Contract { 117 | #[private] // 标记该方法只能由合约自己调用 118 | pub fn resolve_create_account( 119 | &mut self, 120 | payer_id: AccountId, 121 | amount: U128, 122 | // 如果被回调的方法有返回值, 可以使用 `#[callback_result]` 来获取返回值 123 | #[callback_result] is_success: Result, 124 | ) { 125 | if is_success.unwrap_or(false) { 126 | log!("Account is successfully created."); 127 | } else { 128 | log!("Failed to create account, refund the money."); 129 | Promise::new(payer_id).transfer(amount.0); 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /8. 编写一个 NFT 合约/README.md: -------------------------------------------------------------------------------- 1 | # 编写一个 NFT 合约 2 | NFT 即 Non Fungible Token 非同质化通证 3 | 4 | NEAR 的 NFT 标准 5 | * [NEP171](https://github.com/near/NEPs/blob/master/neps/nep-0171.md) 6 | * [NEP177](https://github.com/near/NEPs/blob/master/neps/nep-0177.md) 7 | * [NEP178](https://github.com/near/NEPs/blob/master/neps/nep-0178.md) 8 | * [NEP181](https://github.com/near/NEPs/blob/master/neps/nep-0181.md) 9 | 10 | ## NFT 标准实现 11 | NEAR SDK 实现了标准的 NFT, 需要额外引入 `near-contract-standards` 12 | ```toml 13 | [dependencies] 14 | near-sdk = "4.1.1" 15 | near-contract-standards = "4.1.1" 16 | ``` 17 | 18 | 其中的 `NonFungibleToken` 类型即 NFT 标准实现, 我们可以将其作为合约的一个字段, 然后把它的实现封装成合约方法 19 | 20 | ### NEP171 21 | ```rust 22 | pub trait NonFungibleTokenCore { 23 | // 给普通账户转移 NFT. 调用该方法需要附加 1 yocto NEAR 以保证安全性 24 | fn nft_transfer( 25 | &mut self, 26 | receiver_id: AccountId, 27 | token_id: TokenId, 28 | approval_id: Option, 29 | memo: Option, 30 | ); 31 | 32 | // 给合约账户转移 NFT, 以触发合约相关逻辑, 返回值的含义是转移是否成功. 调用该方法需要附加 1 yocto NEAR 以保证安全性 33 | fn nft_transfer_call( 34 | &mut self, 35 | receiver_id: AccountId, 36 | token_id: TokenId, 37 | approval_id: Option, 38 | memo: Option, 39 | msg: String, 40 | ) -> PromiseOrValue; 41 | 42 | // 查询某个 NFT 详情 43 | fn nft_token(&self, token_id: TokenId) -> Option; 44 | } 45 | 46 | pub trait NonFungibleTokenResolver { 47 | // `nft_transfer_call` 内部的回调函数 48 | fn nft_resolve_transfer( 49 | &mut self, 50 | previous_owner_id: AccountId, 51 | receiver_id: AccountId, 52 | token_id: TokenId, 53 | approved_account_ids: Option>, 54 | ) -> bool; 55 | } 56 | ``` 57 | 58 | `near-contract-standards` 提供了 `impl_non_fungible_token_core` 宏来快速给合约实现上述接口 59 | 60 | ### NEP 178 61 | ```rust 62 | pub trait NonFungibleTokenApproval { 63 | // 当用户把 NFT 授权给别的账户时, 别的账户就有权转移这个 NFT, 该功能通常用于在 NFT 市场挂单 64 | // 转移 NFT 时, 如果没有传 `approval_id` 参数, 则不校验该值 65 | // 否则必须保证传入的参数和实际值一致才能转移成功, 该校验是为了保护挂单中的 NFT 的安全性 66 | // 当 NFT 成功发生转移之后, 该 NFT 所有的授权都会被重置 67 | // 调用该方法需要附加一些 NEAR 作为被授权账户的存储费 68 | fn nft_approve( 69 | &mut self, 70 | token_id: TokenId, 71 | account_id: AccountId, 72 | msg: Option, 73 | ) -> Option; 74 | 75 | // 取消某个 NFT 对某个账户的授权. 调用该方法需要附加 1 yocto NEAR 以保证安全性 76 | fn nft_revoke(&mut self, token_id: TokenId, account_id: AccountId); 77 | 78 | // 取消某个 NFT 对所有账户的授权. 调用该方法需要附加 1 yocto NEAR 以保证安全性 79 | fn nft_revoke_all(&mut self, token_id: TokenId); 80 | 81 | // 判断 NFT 是否授权给某个账户 82 | // 如果没有传 `approval_id` 参数, 则不校验该值 83 | // 否则必须保证传入的参数和实际值一致才会返回 `true` 84 | fn nft_is_approved( 85 | &self, 86 | token_id: TokenId, 87 | approved_account_id: AccountId, 88 | approval_id: Option, 89 | ) -> bool; 90 | } 91 | ``` 92 | 93 | `near-contract-standards` 提供了 `impl_non_fungible_token_approval` 宏来快速给合约实现上述接口 94 | 95 | ### NEP181 96 | ```rust 97 | pub trait NonFungibleTokenEnumeration { 98 | // 查询 NFT 总供应量 99 | fn nft_total_supply(&self) -> U128; 100 | 101 | // 查询多个 NFT 详情 102 | fn nft_tokens( 103 | &self, 104 | from_index: Option, 105 | limit: Option, 106 | ) -> Vec; 107 | 108 | // 查询某个用户持有的 NFT 数量 109 | fn nft_supply_for_owner(&self, account_id: AccountId) -> U128; 110 | 111 | // 查询某个用户持有的多个 NFT 详情 112 | fn nft_tokens_for_owner( 113 | &self, 114 | account_id: AccountId, 115 | from_index: Option, 116 | limit: Option, 117 | ) -> Vec; 118 | } 119 | ``` 120 | 121 | `near-contract-standards` 提供了 `impl_non_fungible_token_enumeration` 宏来快速给合约实现上述接口 122 | 123 | ### NEP 177 124 | ```rust 125 | pub trait NonFungibleTokenMetadataProvider { 126 | // NFT 合约详情 127 | fn nft_metadata(&self) -> NFTContractMetadata; 128 | } 129 | ``` 130 | 131 | ## Mint 和 Burn 132 | mint 和 burn 不是标准的操作, 因此我们需要自己实现. 需要注意的是 mint NFT 会大量占用存储, 需要关注合约中用于存储质押的 NEAR 是否足够 133 | 134 | ## 接收合约 135 | 如果一个合约需要感知到自己接收了用户转账的 NFT, 则该合约需要实现 `nft_on_transfer` 来触发合约相关操作 136 | ```rust 137 | pub trait NonFungibleTokenReceiver { 138 | // 接收合约的这个方法会被 `nft_transfer_call` 调用, 返回值的含义是是否需要退回 NFT 139 | fn nft_on_transfer( 140 | &mut self, 141 | sender_id: AccountId, 142 | previous_owner_id: AccountId, 143 | token_id: TokenId, 144 | msg: String, 145 | ) -> PromiseOrValue; 146 | } 147 | ``` 148 | 149 | ## 接收授权合约 150 | 如果一个合约需要感知到自己被用户授权了 NFT, 则该合约需要实现 `nft_on_approve` 来触发合约相关操作 151 | ```rust 152 | pub trait NonFungibleTokenApprovalReceiver { 153 | // 接收授权合约的这个方法会被 `nft_approve` 调用, 返回值没有明确含义 154 | fn nft_on_approve( 155 | &mut self, 156 | token_id: TokenId, 157 | owner_id: AccountId, 158 | approval_id: u64, 159 | msg: String, 160 | ) -> PromiseOrValue; 161 | } 162 | ``` 163 | -------------------------------------------------------------------------------- /7. 编写一个 FT 合约/src/lib.rs: -------------------------------------------------------------------------------- 1 | use near_contract_standards::fungible_token::events::{FtBurn, FtMint}; 2 | use near_contract_standards::fungible_token::metadata::{ 3 | FungibleTokenMetadata, FungibleTokenMetadataProvider, FT_METADATA_SPEC, 4 | }; 5 | use near_contract_standards::fungible_token::FungibleToken; 6 | use near_contract_standards::{impl_fungible_token_core, impl_fungible_token_storage}; 7 | use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; 8 | use near_sdk::json_types::U128; 9 | use near_sdk::{ 10 | env, near_bindgen, require, AccountId, Balance, BorshStorageKey, PanicOnDefault, PromiseOrValue, 11 | }; 12 | 13 | #[near_bindgen] 14 | #[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)] 15 | pub struct Contract { 16 | owner_id: AccountId, 17 | tokens: FungibleToken, 18 | } 19 | 20 | #[derive(BorshSerialize, BorshStorageKey)] 21 | enum StorageKey { 22 | FungibleToken, 23 | } 24 | 25 | #[near_bindgen] 26 | impl Contract { 27 | #[init] 28 | pub fn init(owner_id: AccountId) -> Self { 29 | Self { 30 | owner_id, 31 | tokens: FungibleToken::new(StorageKey::FungibleToken), 32 | } 33 | } 34 | 35 | // 合约所有者能为任意用户 mint 指定数量的 FT 36 | pub fn mint(&mut self, account_id: AccountId, amount: U128, memo: Option) { 37 | require!( 38 | env::predecessor_account_id() == self.owner_id, 39 | "Only contract owner can call this method." 40 | ); 41 | self.internal_mint(&account_id, amount.0, memo); 42 | } 43 | 44 | // 合约所有者能为任意用户 burn 指定数量的 FT 45 | pub fn burn(&mut self, account_id: AccountId, amount: U128, memo: Option) { 46 | require!( 47 | env::predecessor_account_id() == self.owner_id, 48 | "Only contract owner can call this method." 49 | ); 50 | self.internal_burn(&account_id, amount.0, memo); 51 | } 52 | } 53 | 54 | // 为合约实现 NEP141 55 | // ft_transfer 56 | // ft_transfer_call 57 | // ft_total_supply 58 | // ft_balance_of 59 | // ft_resolve_transfer 60 | impl_fungible_token_core!(Contract, tokens); 61 | 62 | // 为合约实现 NEP145 63 | // storage_deposit 64 | // storage_withdraw 65 | // storage_unregister 66 | // storage_balance_bounds 67 | // storage_balance_of 68 | impl_fungible_token_storage!(Contract, tokens); 69 | 70 | // 为合约实现 NEP148 71 | #[near_bindgen] 72 | impl FungibleTokenMetadataProvider for Contract { 73 | fn ft_metadata(&self) -> FungibleTokenMetadata { 74 | FungibleTokenMetadata { 75 | spec: FT_METADATA_SPEC.to_string(), 76 | name: "Hello Fungible Token".to_string(), 77 | symbol: "HelloFT".to_string(), 78 | icon: None, 79 | reference: None, 80 | reference_hash: None, 81 | decimals: 18, 82 | } 83 | } 84 | } 85 | 86 | // ------------------------------------- 合约内部方法 ------------------------------------------------ 87 | 88 | impl Contract { 89 | pub(crate) fn internal_mint( 90 | &mut self, 91 | account_id: &AccountId, 92 | amount: Balance, 93 | memo: Option, 94 | ) { 95 | // 注册 FT 持有者信息 96 | if !self.tokens.accounts.contains_key(account_id) { 97 | self.tokens.internal_register_account(account_id); 98 | } 99 | 100 | // mint 101 | self.tokens.internal_deposit(account_id, amount); 102 | 103 | // 打印标准 log 104 | FtMint { 105 | owner_id: account_id, 106 | amount: &U128(amount), 107 | memo: memo.as_deref(), 108 | } 109 | .emit(); 110 | } 111 | 112 | pub(crate) fn internal_burn( 113 | &mut self, 114 | account_id: &AccountId, 115 | amount: Balance, 116 | memo: Option, 117 | ) { 118 | // burn 119 | self.tokens.internal_withdraw(account_id, amount); 120 | 121 | // 打印标准 log 122 | FtBurn { 123 | owner_id: account_id, 124 | amount: &U128(amount), 125 | memo: memo.as_deref(), 126 | } 127 | .emit(); 128 | } 129 | } 130 | 131 | #[cfg(test)] 132 | mod test { 133 | use crate::Contract; 134 | use near_contract_standards::fungible_token::core::FungibleTokenCore; 135 | use near_contract_standards::storage_management::StorageManagement; 136 | use near_sdk::json_types::U128; 137 | use near_sdk::test_utils::VMContextBuilder; 138 | use near_sdk::{testing_env, AccountId, Balance, ONE_YOCTO}; 139 | 140 | fn owner() -> AccountId { 141 | "owner.near".parse().unwrap() 142 | } 143 | 144 | fn alice() -> AccountId { 145 | "alice.near".parse().unwrap() 146 | } 147 | 148 | fn bob() -> AccountId { 149 | "bob.near".parse().unwrap() 150 | } 151 | 152 | const ONE_TOKEN: Balance = 1_000_000_000_000_000_000; 153 | 154 | #[test] 155 | fn test_mint_transfer_burn() { 156 | let mut contract = Contract::init(owner()); 157 | 158 | // ----------------------------- 给 Bob mint 1000 FT --------------------------------------- 159 | 160 | testing_env!(VMContextBuilder::new() 161 | .predecessor_account_id(owner()) 162 | .build()); 163 | 164 | contract.mint(bob(), U128(1000 * ONE_TOKEN), None); 165 | 166 | assert_eq!(contract.ft_balance_of(bob()), U128(1000 * ONE_TOKEN)); 167 | assert_eq!(contract.ft_total_supply(), U128(1000 * ONE_TOKEN)); 168 | 169 | // --------------------------- Bob 给 Alice 转账 200 FT ------------------------------------- 170 | 171 | // 给 Alice 注册持有者信息并支付存储费 172 | let storage_balance_bounds = contract.storage_balance_bounds(); 173 | 174 | testing_env!(VMContextBuilder::new() 175 | .predecessor_account_id(bob()) 176 | .attached_deposit(storage_balance_bounds.min.0) 177 | .build()); 178 | 179 | contract.storage_deposit(Some(alice()), None); 180 | 181 | // `ft_transfer` 调用需要附加 1 yocto NEAR 182 | testing_env!(VMContextBuilder::new() 183 | .predecessor_account_id(bob()) 184 | .attached_deposit(ONE_YOCTO) 185 | .build()); 186 | 187 | contract.ft_transfer(alice(), U128(200 * ONE_TOKEN), None); 188 | 189 | assert_eq!(contract.ft_balance_of(bob()), U128(800 * ONE_TOKEN)); 190 | assert_eq!(contract.ft_balance_of(alice()), U128(200 * ONE_TOKEN)); 191 | assert_eq!(contract.ft_total_supply(), U128(1000 * ONE_TOKEN)); 192 | 193 | // ------------------------------ 销毁 Bob 的 300 FT ---------------------------------------- 194 | 195 | testing_env!(VMContextBuilder::new() 196 | .predecessor_account_id(owner()) 197 | .build()); 198 | 199 | contract.burn(bob(), U128(300 * ONE_TOKEN), None); 200 | 201 | assert_eq!(contract.ft_balance_of(bob()), U128(500 * ONE_TOKEN)); 202 | assert_eq!(contract.ft_balance_of(alice()), U128(200 * ONE_TOKEN)); 203 | assert_eq!(contract.ft_total_supply(), U128(700 * ONE_TOKEN)); 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /6. 单元测试与集成测试/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 26 | 27 | /* Modules */ 28 | "module": "CommonJS", /* Specify what module code is generated. */ 29 | // "rootDir": "./", /* Specify the root folder within your source files. */ 30 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 38 | // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ 39 | // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ 40 | // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ 41 | // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ 42 | // "resolveJsonModule": true, /* Enable importing .json files. */ 43 | // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ 44 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 45 | 46 | /* JavaScript Support */ 47 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 48 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 49 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 50 | 51 | /* Emit */ 52 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 53 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 54 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 55 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 56 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 57 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 58 | // "outDir": "./", /* Specify an output folder for all emitted files. */ 59 | // "removeComments": true, /* Disable emitting comments. */ 60 | "noEmit": true, /* Disable emitting files from a compilation. */ 61 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 62 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 63 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 64 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 65 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 66 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 67 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 68 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 69 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 70 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 71 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 72 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 73 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 74 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 75 | 76 | /* Interop Constraints */ 77 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 78 | // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ 79 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 80 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 81 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 82 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 83 | 84 | /* Type Checking */ 85 | "strict": true, /* Enable all strict type-checking options. */ 86 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 87 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 88 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 89 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 90 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 91 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 92 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 93 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 94 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 95 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 96 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 97 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 98 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 99 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 100 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 101 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 102 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 103 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 104 | 105 | /* Completeness */ 106 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 107 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /8. 编写一个 NFT 合约/src/lib.rs: -------------------------------------------------------------------------------- 1 | use near_contract_standards::non_fungible_token::events::{NftBurn, NftMint}; 2 | use near_contract_standards::non_fungible_token::metadata::{ 3 | NFTContractMetadata, NonFungibleTokenMetadataProvider, TokenMetadata, NFT_METADATA_SPEC, 4 | }; 5 | use near_contract_standards::non_fungible_token::{NonFungibleToken, Token, TokenId}; 6 | use near_contract_standards::{ 7 | impl_non_fungible_token_approval, impl_non_fungible_token_core, 8 | impl_non_fungible_token_enumeration, 9 | }; 10 | use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; 11 | use near_sdk::collections::UnorderedSet; 12 | use near_sdk::{ 13 | env, near_bindgen, require, AccountId, BorshStorageKey, PanicOnDefault, Promise, PromiseOrValue, 14 | }; 15 | 16 | #[near_bindgen] 17 | #[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)] 18 | pub struct Contract { 19 | owner_id: AccountId, 20 | tokens: NonFungibleToken, 21 | 22 | // 使用全局自增 id 作为 NFT id 23 | unique_id: u64, 24 | } 25 | 26 | #[derive(BorshSerialize, BorshStorageKey)] 27 | enum StorageKey { 28 | NonFungibleToken, 29 | TokenMetadata, 30 | Enumeration, 31 | Approval, 32 | } 33 | 34 | #[near_bindgen] 35 | impl Contract { 36 | #[init] 37 | pub fn init(owner_id: AccountId) -> Self { 38 | Self { 39 | owner_id: owner_id.clone(), 40 | tokens: NonFungibleToken::new( 41 | StorageKey::NonFungibleToken, 42 | owner_id, 43 | Some(StorageKey::TokenMetadata), 44 | Some(StorageKey::Enumeration), 45 | Some(StorageKey::Approval), 46 | ), 47 | unique_id: 0, 48 | } 49 | } 50 | 51 | // 合约所有者能为任意用户 mint NFT 52 | pub fn mint(&mut self, account_id: AccountId, metadata: TokenMetadata, memo: Option) { 53 | require!( 54 | env::predecessor_account_id() == self.owner_id, 55 | "Only contract owner can call this method." 56 | ); 57 | let token_id = self.next_id().to_string(); 58 | self.internal_mint(&account_id, &token_id, &metadata, memo); 59 | } 60 | 61 | // 合约所有者能为任意用户 burn NFT 62 | pub fn burn(&mut self, account_id: AccountId, token_id: TokenId, memo: Option) { 63 | require!( 64 | env::predecessor_account_id() == self.owner_id, 65 | "Only contract owner can call this method." 66 | ); 67 | self.internal_burn(&account_id, &token_id, memo); 68 | } 69 | } 70 | 71 | // 为合约实现 NEP171 72 | // nft_transfer 73 | // nft_transfer_call 74 | // nft_token 75 | // nft_resolve_transfer 76 | impl_non_fungible_token_core!(Contract, tokens); 77 | 78 | // 为合约实现 NEP178 79 | // nft_approve 80 | // nft_revoke 81 | // nft_revoke_all 82 | // nft_is_approved 83 | impl_non_fungible_token_approval!(Contract, tokens); 84 | 85 | // 为合约实现 NEP181 86 | // nft_total_supply 87 | // nft_tokens 88 | // nft_supply_for_owner 89 | // nft_tokens_for_owner 90 | impl_non_fungible_token_enumeration!(Contract, tokens); 91 | 92 | // 为合约实现 NEP177 93 | #[near_bindgen] 94 | impl NonFungibleTokenMetadataProvider for Contract { 95 | fn nft_metadata(&self) -> NFTContractMetadata { 96 | NFTContractMetadata { 97 | spec: NFT_METADATA_SPEC.to_string(), 98 | name: "Hello Non Fungible Token".to_string(), 99 | symbol: "HelloNFT".to_string(), 100 | icon: None, 101 | base_uri: None, 102 | reference: None, 103 | reference_hash: None, 104 | } 105 | } 106 | } 107 | 108 | // ------------------------------------- 合约内部方法 ------------------------------------------------ 109 | 110 | impl Contract { 111 | pub(crate) fn next_id(&mut self) -> u64 { 112 | self.unique_id += 1; 113 | self.unique_id 114 | } 115 | 116 | pub(crate) fn internal_mint( 117 | &mut self, 118 | account_id: &AccountId, 119 | token_id: &TokenId, 120 | metadata: &TokenMetadata, 121 | memo: Option, 122 | ) { 123 | // 添加 token_id -> token_owner_id 映射 124 | self.tokens.owner_by_id.insert(token_id, account_id); 125 | 126 | // 更新或添加 token_owner_id -> token_ids 映射 127 | if let Some(tokens_per_owner) = &mut self.tokens.tokens_per_owner { 128 | let mut token_ids = tokens_per_owner.get(account_id).unwrap_or_else(|| { 129 | UnorderedSet::new( 130 | near_contract_standards::non_fungible_token::core::StorageKey::TokensPerOwner { 131 | account_hash: env::sha256(&account_id.try_to_vec().unwrap()), // 也可以用 `account_id.as_bytes()`, 但使用 borsh 字节更加通用 132 | }, 133 | ) 134 | }); 135 | token_ids.insert(token_id); 136 | tokens_per_owner.insert(account_id, &token_ids); 137 | } 138 | 139 | // 添加 token_id -> token_metadata 映射 140 | if let Some(token_metadata_by_id) = &mut self.tokens.token_metadata_by_id { 141 | token_metadata_by_id.insert(token_id, metadata); 142 | } 143 | 144 | // 打印标准 log 145 | NftMint { 146 | owner_id: account_id, 147 | token_ids: &[token_id], 148 | memo: memo.as_deref(), 149 | } 150 | .emit(); 151 | } 152 | 153 | pub(crate) fn internal_burn( 154 | &mut self, 155 | account_id: &AccountId, 156 | token_id: &TokenId, 157 | memo: Option, 158 | ) { 159 | // 移除 token_id -> token_owner_id 映射 160 | self.tokens.owner_by_id.remove(token_id); 161 | 162 | // 更新或移除 token_owner_id -> token_ids 映射 163 | if let Some(tokens_per_owner) = &mut self.tokens.tokens_per_owner { 164 | if let Some(mut token_ids) = tokens_per_owner.remove(account_id) { 165 | token_ids.remove(token_id); 166 | if !token_ids.is_empty() { 167 | tokens_per_owner.insert(account_id, &token_ids); 168 | } 169 | } 170 | }; 171 | 172 | // 移除 token_id -> token_metadata 映射 173 | if let Some(token_metadata_by_id) = &mut self.tokens.token_metadata_by_id { 174 | token_metadata_by_id.remove(token_id); 175 | } 176 | 177 | // 移除 token_id -> approval_ids 映射 178 | if let Some(approvals_by_id) = &mut self.tokens.approvals_by_id { 179 | approvals_by_id.remove(token_id); 180 | } 181 | 182 | // 移除 token_id -> next_approval_id 映射 183 | if let Some(next_approval_id_by_id) = &mut self.tokens.next_approval_id_by_id { 184 | next_approval_id_by_id.remove(token_id); 185 | } 186 | 187 | // 打印标准 log 188 | NftBurn { 189 | owner_id: account_id, 190 | token_ids: &[token_id], 191 | authorized_id: Some(account_id), 192 | memo: memo.as_deref(), 193 | } 194 | .emit(); 195 | } 196 | } 197 | 198 | #[cfg(test)] 199 | mod test { 200 | use crate::Contract; 201 | use near_contract_standards::non_fungible_token::approval::NonFungibleTokenApproval; 202 | 203 | use near_contract_standards::non_fungible_token::core::NonFungibleTokenCore; 204 | use near_contract_standards::non_fungible_token::enumeration::NonFungibleTokenEnumeration; 205 | use near_contract_standards::non_fungible_token::metadata::TokenMetadata; 206 | use near_contract_standards::non_fungible_token::TokenId; 207 | 208 | use near_sdk::json_types::U128; 209 | use near_sdk::test_utils::VMContextBuilder; 210 | use near_sdk::{testing_env, AccountId, ONE_NEAR, ONE_YOCTO}; 211 | 212 | fn owner() -> AccountId { 213 | "owner.near".parse().unwrap() 214 | } 215 | 216 | fn alice() -> AccountId { 217 | "alice.near".parse().unwrap() 218 | } 219 | 220 | fn bob() -> AccountId { 221 | "bob.near".parse().unwrap() 222 | } 223 | 224 | fn token(token_id: TokenId) -> TokenMetadata { 225 | TokenMetadata { 226 | title: Some(format!("HelloNFT #{}", token_id)), 227 | description: None, 228 | media: None, 229 | media_hash: None, 230 | copies: None, 231 | issued_at: None, 232 | expires_at: None, 233 | starts_at: None, 234 | updated_at: None, 235 | extra: None, 236 | reference: None, 237 | reference_hash: None, 238 | } 239 | } 240 | 241 | #[test] 242 | fn test_mint_transfer_burn() { 243 | let mut contract = Contract::init(owner()); 244 | 245 | let token_id_1 = "1".to_string(); 246 | let token_1 = token(token_id_1.clone()); 247 | let token_id_2 = "2".to_string(); 248 | let token_2 = token(token_id_2.clone()); 249 | 250 | // --------------------------------- 给 Bob mint NFT --------------------------------------- 251 | 252 | testing_env!(VMContextBuilder::new() 253 | .predecessor_account_id(owner()) 254 | .build()); 255 | 256 | contract.mint(bob(), token_1, None); 257 | contract.mint(bob(), token_2, None); 258 | 259 | assert_eq!( 260 | contract.nft_token(token_id_1.clone()).unwrap().owner_id, 261 | bob() 262 | ); 263 | assert_eq!( 264 | contract.nft_token(token_id_2.clone()).unwrap().owner_id, 265 | bob() 266 | ); 267 | assert_eq!(contract.nft_total_supply(), U128(2)); 268 | 269 | // -------------------------------- Bob 给 Alice 转 NFT ------------------------------------- 270 | 271 | // `nft_transfer` 调用需要附加 1 yocto NEAR 272 | testing_env!(VMContextBuilder::new() 273 | .predecessor_account_id(bob()) 274 | .attached_deposit(ONE_YOCTO) 275 | .build()); 276 | 277 | contract.nft_transfer(alice(), token_id_1.clone(), None, None); 278 | 279 | assert_eq!( 280 | contract.nft_token(token_id_1.clone()).unwrap().owner_id, 281 | alice() 282 | ); 283 | assert_eq!( 284 | contract.nft_token(token_id_2.clone()).unwrap().owner_id, 285 | bob() 286 | ); 287 | assert_eq!(contract.nft_total_supply(), U128(2)); 288 | 289 | // ---------------------------------- 销毁 Bob 的 NFT --------------------------------------- 290 | 291 | testing_env!(VMContextBuilder::new() 292 | .predecessor_account_id(owner()) 293 | .build()); 294 | 295 | contract.burn(bob(), token_id_2.clone(), None); 296 | 297 | assert_eq!(contract.nft_token(token_id_1).unwrap().owner_id, alice()); 298 | assert!(contract.nft_token(token_id_2).is_none()); 299 | assert_eq!(contract.nft_total_supply(), U128(1)); 300 | } 301 | 302 | #[test] 303 | fn test_approve_transfer() { 304 | let mut contract = Contract::init(owner()); 305 | 306 | let token_id = "1".to_string(); 307 | let token = token(token_id.clone()); 308 | 309 | // --------------------------------- 给 Bob mint NFT --------------------------------------- 310 | 311 | testing_env!(VMContextBuilder::new() 312 | .predecessor_account_id(owner()) 313 | .build()); 314 | 315 | contract.mint(bob(), token, None); 316 | 317 | assert_eq!( 318 | contract.nft_token(token_id.clone()).unwrap().owner_id, 319 | bob() 320 | ); 321 | 322 | // ------------------------------- Bob 授权 NFT 给 Alice ------------------------------------ 323 | 324 | // `nft_approve` 需要附加一些 NEAR 作为被授权账户的存储费 325 | testing_env!(VMContextBuilder::new() 326 | .predecessor_account_id(bob()) 327 | .attached_deposit(ONE_NEAR / 100) // 附加 0.01 NEAR 328 | .build()); 329 | 330 | contract.nft_approve(token_id.clone(), alice(), None); 331 | 332 | assert!(contract.nft_is_approved(token_id.clone(), alice(), None)); 333 | 334 | // ---------------------------- Alice 通过授权把 Bob 的NFT 转给自己 --------------------------- 335 | 336 | // `nft_transfer` 调用需要附加 1 yocto NEAR 337 | testing_env!(VMContextBuilder::new() 338 | .predecessor_account_id(alice()) 339 | .attached_deposit(ONE_YOCTO) 340 | .build()); 341 | 342 | contract.nft_transfer(alice(), token_id.clone(), None, None); 343 | 344 | assert_eq!( 345 | contract.nft_token(token_id.clone()).unwrap().owner_id, 346 | alice() 347 | ); 348 | assert!(!contract.nft_is_approved(token_id, alice(), None)); 349 | } 350 | } 351 | -------------------------------------------------------------------------------- /2. 认识 NEAR 智能合约/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "Inflector" 7 | version = "0.11.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" 10 | 11 | [[package]] 12 | name = "ahash" 13 | version = "0.7.6" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" 16 | dependencies = [ 17 | "getrandom 0.2.10", 18 | "once_cell", 19 | "version_check", 20 | ] 21 | 22 | [[package]] 23 | name = "android-tzdata" 24 | version = "0.1.1" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" 27 | 28 | [[package]] 29 | name = "android_system_properties" 30 | version = "0.1.5" 31 | source = "registry+https://github.com/rust-lang/crates.io-index" 32 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 33 | dependencies = [ 34 | "libc", 35 | ] 36 | 37 | [[package]] 38 | name = "arrayref" 39 | version = "0.3.7" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" 42 | 43 | [[package]] 44 | name = "arrayvec" 45 | version = "0.5.2" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" 48 | 49 | [[package]] 50 | name = "arrayvec" 51 | version = "0.7.4" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" 54 | 55 | [[package]] 56 | name = "autocfg" 57 | version = "1.1.0" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 60 | 61 | [[package]] 62 | name = "base64" 63 | version = "0.11.0" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" 66 | 67 | [[package]] 68 | name = "base64" 69 | version = "0.13.1" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 72 | 73 | [[package]] 74 | name = "bitvec" 75 | version = "0.20.4" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" 78 | dependencies = [ 79 | "funty", 80 | "radium", 81 | "tap", 82 | "wyz", 83 | ] 84 | 85 | [[package]] 86 | name = "blake2" 87 | version = "0.9.2" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174" 90 | dependencies = [ 91 | "crypto-mac", 92 | "digest 0.9.0", 93 | "opaque-debug", 94 | ] 95 | 96 | [[package]] 97 | name = "block-buffer" 98 | version = "0.9.0" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 101 | dependencies = [ 102 | "generic-array", 103 | ] 104 | 105 | [[package]] 106 | name = "block-buffer" 107 | version = "0.10.4" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 110 | dependencies = [ 111 | "generic-array", 112 | ] 113 | 114 | [[package]] 115 | name = "borsh" 116 | version = "0.9.3" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" 119 | dependencies = [ 120 | "borsh-derive", 121 | "hashbrown 0.11.2", 122 | ] 123 | 124 | [[package]] 125 | name = "borsh-derive" 126 | version = "0.9.3" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" 129 | dependencies = [ 130 | "borsh-derive-internal", 131 | "borsh-schema-derive-internal", 132 | "proc-macro-crate 0.1.5", 133 | "proc-macro2", 134 | "syn 1.0.109", 135 | ] 136 | 137 | [[package]] 138 | name = "borsh-derive-internal" 139 | version = "0.9.3" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" 142 | dependencies = [ 143 | "proc-macro2", 144 | "quote", 145 | "syn 1.0.109", 146 | ] 147 | 148 | [[package]] 149 | name = "borsh-schema-derive-internal" 150 | version = "0.9.3" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" 153 | dependencies = [ 154 | "proc-macro2", 155 | "quote", 156 | "syn 1.0.109", 157 | ] 158 | 159 | [[package]] 160 | name = "bs58" 161 | version = "0.4.0" 162 | source = "registry+https://github.com/rust-lang/crates.io-index" 163 | checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" 164 | 165 | [[package]] 166 | name = "bumpalo" 167 | version = "3.13.0" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" 170 | 171 | [[package]] 172 | name = "byte-slice-cast" 173 | version = "1.2.2" 174 | source = "registry+https://github.com/rust-lang/crates.io-index" 175 | checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" 176 | 177 | [[package]] 178 | name = "byteorder" 179 | version = "1.4.3" 180 | source = "registry+https://github.com/rust-lang/crates.io-index" 181 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 182 | 183 | [[package]] 184 | name = "bytesize" 185 | version = "1.2.0" 186 | source = "registry+https://github.com/rust-lang/crates.io-index" 187 | checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5" 188 | 189 | [[package]] 190 | name = "c2-chacha" 191 | version = "0.3.3" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "d27dae93fe7b1e0424dc57179ac396908c26b035a87234809f5c4dfd1b47dc80" 194 | dependencies = [ 195 | "cipher", 196 | "ppv-lite86", 197 | ] 198 | 199 | [[package]] 200 | name = "cc" 201 | version = "1.0.79" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 204 | 205 | [[package]] 206 | name = "cfg-if" 207 | version = "0.1.10" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 210 | 211 | [[package]] 212 | name = "cfg-if" 213 | version = "1.0.0" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 216 | 217 | [[package]] 218 | name = "chrono" 219 | version = "0.4.26" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" 222 | dependencies = [ 223 | "android-tzdata", 224 | "iana-time-zone", 225 | "js-sys", 226 | "num-traits", 227 | "serde", 228 | "time", 229 | "wasm-bindgen", 230 | "winapi", 231 | ] 232 | 233 | [[package]] 234 | name = "cipher" 235 | version = "0.2.5" 236 | source = "registry+https://github.com/rust-lang/crates.io-index" 237 | checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" 238 | dependencies = [ 239 | "generic-array", 240 | ] 241 | 242 | [[package]] 243 | name = "convert_case" 244 | version = "0.4.0" 245 | source = "registry+https://github.com/rust-lang/crates.io-index" 246 | checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" 247 | 248 | [[package]] 249 | name = "core-foundation-sys" 250 | version = "0.8.4" 251 | source = "registry+https://github.com/rust-lang/crates.io-index" 252 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" 253 | 254 | [[package]] 255 | name = "cpufeatures" 256 | version = "0.2.8" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" 259 | dependencies = [ 260 | "libc", 261 | ] 262 | 263 | [[package]] 264 | name = "crunchy" 265 | version = "0.2.2" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" 268 | 269 | [[package]] 270 | name = "crypto-common" 271 | version = "0.1.6" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 274 | dependencies = [ 275 | "generic-array", 276 | "typenum", 277 | ] 278 | 279 | [[package]] 280 | name = "crypto-mac" 281 | version = "0.8.0" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" 284 | dependencies = [ 285 | "generic-array", 286 | "subtle", 287 | ] 288 | 289 | [[package]] 290 | name = "curve25519-dalek" 291 | version = "3.2.1" 292 | source = "registry+https://github.com/rust-lang/crates.io-index" 293 | checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" 294 | dependencies = [ 295 | "byteorder", 296 | "digest 0.9.0", 297 | "rand_core 0.5.1", 298 | "subtle", 299 | "zeroize", 300 | ] 301 | 302 | [[package]] 303 | name = "derive_more" 304 | version = "0.99.17" 305 | source = "registry+https://github.com/rust-lang/crates.io-index" 306 | checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" 307 | dependencies = [ 308 | "convert_case", 309 | "proc-macro2", 310 | "quote", 311 | "rustc_version", 312 | "syn 1.0.109", 313 | ] 314 | 315 | [[package]] 316 | name = "digest" 317 | version = "0.9.0" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 320 | dependencies = [ 321 | "generic-array", 322 | ] 323 | 324 | [[package]] 325 | name = "digest" 326 | version = "0.10.7" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 329 | dependencies = [ 330 | "block-buffer 0.10.4", 331 | "crypto-common", 332 | ] 333 | 334 | [[package]] 335 | name = "dyn-clone" 336 | version = "1.0.11" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" 339 | 340 | [[package]] 341 | name = "easy-ext" 342 | version = "0.2.9" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "53aff6fdc1b181225acdcb5b14c47106726fd8e486707315b1b138baed68ee31" 345 | 346 | [[package]] 347 | name = "ed25519" 348 | version = "1.5.3" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" 351 | dependencies = [ 352 | "signature", 353 | ] 354 | 355 | [[package]] 356 | name = "ed25519-dalek" 357 | version = "1.0.1" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" 360 | dependencies = [ 361 | "curve25519-dalek", 362 | "ed25519", 363 | "rand 0.7.3", 364 | "serde", 365 | "sha2 0.9.9", 366 | "zeroize", 367 | ] 368 | 369 | [[package]] 370 | name = "fixed-hash" 371 | version = "0.7.0" 372 | source = "registry+https://github.com/rust-lang/crates.io-index" 373 | checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" 374 | dependencies = [ 375 | "byteorder", 376 | "rand 0.8.5", 377 | "rustc-hex", 378 | "static_assertions", 379 | ] 380 | 381 | [[package]] 382 | name = "funty" 383 | version = "1.1.0" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" 386 | 387 | [[package]] 388 | name = "generic-array" 389 | version = "0.14.7" 390 | source = "registry+https://github.com/rust-lang/crates.io-index" 391 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 392 | dependencies = [ 393 | "typenum", 394 | "version_check", 395 | ] 396 | 397 | [[package]] 398 | name = "getrandom" 399 | version = "0.1.16" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" 402 | dependencies = [ 403 | "cfg-if 1.0.0", 404 | "libc", 405 | "wasi 0.9.0+wasi-snapshot-preview1", 406 | ] 407 | 408 | [[package]] 409 | name = "getrandom" 410 | version = "0.2.10" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" 413 | dependencies = [ 414 | "cfg-if 1.0.0", 415 | "libc", 416 | "wasi 0.11.0+wasi-snapshot-preview1", 417 | ] 418 | 419 | [[package]] 420 | name = "hashbrown" 421 | version = "0.11.2" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 424 | dependencies = [ 425 | "ahash", 426 | ] 427 | 428 | [[package]] 429 | name = "hashbrown" 430 | version = "0.12.3" 431 | source = "registry+https://github.com/rust-lang/crates.io-index" 432 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 433 | 434 | [[package]] 435 | name = "heck" 436 | version = "0.4.1" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 439 | 440 | [[package]] 441 | name = "hello_near" 442 | version = "1.0.0" 443 | dependencies = [ 444 | "near-sdk", 445 | ] 446 | 447 | [[package]] 448 | name = "hex" 449 | version = "0.4.3" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 452 | 453 | [[package]] 454 | name = "iana-time-zone" 455 | version = "0.1.57" 456 | source = "registry+https://github.com/rust-lang/crates.io-index" 457 | checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" 458 | dependencies = [ 459 | "android_system_properties", 460 | "core-foundation-sys", 461 | "iana-time-zone-haiku", 462 | "js-sys", 463 | "wasm-bindgen", 464 | "windows", 465 | ] 466 | 467 | [[package]] 468 | name = "iana-time-zone-haiku" 469 | version = "0.1.2" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" 472 | dependencies = [ 473 | "cc", 474 | ] 475 | 476 | [[package]] 477 | name = "impl-codec" 478 | version = "0.5.1" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443" 481 | dependencies = [ 482 | "parity-scale-codec", 483 | ] 484 | 485 | [[package]] 486 | name = "impl-trait-for-tuples" 487 | version = "0.2.2" 488 | source = "registry+https://github.com/rust-lang/crates.io-index" 489 | checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" 490 | dependencies = [ 491 | "proc-macro2", 492 | "quote", 493 | "syn 1.0.109", 494 | ] 495 | 496 | [[package]] 497 | name = "indexmap" 498 | version = "1.9.3" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 501 | dependencies = [ 502 | "autocfg", 503 | "hashbrown 0.12.3", 504 | ] 505 | 506 | [[package]] 507 | name = "itoa" 508 | version = "1.0.6" 509 | source = "registry+https://github.com/rust-lang/crates.io-index" 510 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" 511 | 512 | [[package]] 513 | name = "js-sys" 514 | version = "0.3.64" 515 | source = "registry+https://github.com/rust-lang/crates.io-index" 516 | checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" 517 | dependencies = [ 518 | "wasm-bindgen", 519 | ] 520 | 521 | [[package]] 522 | name = "keccak" 523 | version = "0.1.4" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" 526 | dependencies = [ 527 | "cpufeatures", 528 | ] 529 | 530 | [[package]] 531 | name = "lazy_static" 532 | version = "1.4.0" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 535 | dependencies = [ 536 | "spin", 537 | ] 538 | 539 | [[package]] 540 | name = "libc" 541 | version = "0.2.146" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" 544 | 545 | [[package]] 546 | name = "log" 547 | version = "0.4.19" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" 550 | 551 | [[package]] 552 | name = "memchr" 553 | version = "2.5.0" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 556 | 557 | [[package]] 558 | name = "memory_units" 559 | version = "0.4.0" 560 | source = "registry+https://github.com/rust-lang/crates.io-index" 561 | checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" 562 | 563 | [[package]] 564 | name = "near-abi" 565 | version = "0.3.0" 566 | source = "registry+https://github.com/rust-lang/crates.io-index" 567 | checksum = "885db39b08518fa700b73fa2214e8adbbfba316ba82dd510f50519173eadaf73" 568 | dependencies = [ 569 | "borsh", 570 | "schemars", 571 | "semver", 572 | "serde", 573 | ] 574 | 575 | [[package]] 576 | name = "near-account-id" 577 | version = "0.14.0" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | checksum = "71d258582a1878e6db67400b0504a5099db85718d22c2e07f747fe1706ae7150" 580 | dependencies = [ 581 | "borsh", 582 | "serde", 583 | ] 584 | 585 | [[package]] 586 | name = "near-crypto" 587 | version = "0.14.0" 588 | source = "registry+https://github.com/rust-lang/crates.io-index" 589 | checksum = "1e75673d69fd7365508f3d32483669fe45b03bfb34e4d9363e90adae9dfb416c" 590 | dependencies = [ 591 | "arrayref", 592 | "blake2", 593 | "borsh", 594 | "bs58", 595 | "c2-chacha", 596 | "curve25519-dalek", 597 | "derive_more", 598 | "ed25519-dalek", 599 | "near-account-id", 600 | "once_cell", 601 | "parity-secp256k1", 602 | "primitive-types", 603 | "rand 0.7.3", 604 | "rand_core 0.5.1", 605 | "serde", 606 | "serde_json", 607 | "subtle", 608 | "thiserror", 609 | ] 610 | 611 | [[package]] 612 | name = "near-primitives" 613 | version = "0.14.0" 614 | source = "registry+https://github.com/rust-lang/crates.io-index" 615 | checksum = "8ad1a9a1640539c81f065425c31bffcfbf6b31ef1aeaade59ce905f5df6ac860" 616 | dependencies = [ 617 | "borsh", 618 | "byteorder", 619 | "bytesize", 620 | "chrono", 621 | "derive_more", 622 | "easy-ext", 623 | "hex", 624 | "near-crypto", 625 | "near-primitives-core", 626 | "near-rpc-error-macro", 627 | "near-vm-errors", 628 | "num-rational", 629 | "once_cell", 630 | "primitive-types", 631 | "rand 0.7.3", 632 | "reed-solomon-erasure", 633 | "serde", 634 | "serde_json", 635 | "smart-default", 636 | "strum", 637 | "thiserror", 638 | ] 639 | 640 | [[package]] 641 | name = "near-primitives-core" 642 | version = "0.14.0" 643 | source = "registry+https://github.com/rust-lang/crates.io-index" 644 | checksum = "91d508f0fc340f6461e4e256417685720d3c4c00bb5a939b105160e49137caba" 645 | dependencies = [ 646 | "base64 0.11.0", 647 | "borsh", 648 | "bs58", 649 | "derive_more", 650 | "near-account-id", 651 | "num-rational", 652 | "serde", 653 | "sha2 0.10.7", 654 | "strum", 655 | ] 656 | 657 | [[package]] 658 | name = "near-rpc-error-core" 659 | version = "0.14.0" 660 | source = "registry+https://github.com/rust-lang/crates.io-index" 661 | checksum = "93ee0b41c75ef859c193a8ff1dadfa0c8207bc0ac447cc22259721ad769a1408" 662 | dependencies = [ 663 | "quote", 664 | "serde", 665 | "syn 1.0.109", 666 | ] 667 | 668 | [[package]] 669 | name = "near-rpc-error-macro" 670 | version = "0.14.0" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "8e837bd4bacd807073ec5ceb85708da7f721b46a4c2a978de86027fb0034ce31" 673 | dependencies = [ 674 | "near-rpc-error-core", 675 | "serde", 676 | "syn 1.0.109", 677 | ] 678 | 679 | [[package]] 680 | name = "near-sdk" 681 | version = "4.1.1" 682 | source = "registry+https://github.com/rust-lang/crates.io-index" 683 | checksum = "15eb3de2defe3626260cc209a6cdb985c6b27b0bd4619fad97dcfae002c3c5bd" 684 | dependencies = [ 685 | "base64 0.13.1", 686 | "borsh", 687 | "bs58", 688 | "near-abi", 689 | "near-crypto", 690 | "near-primitives", 691 | "near-primitives-core", 692 | "near-sdk-macros", 693 | "near-sys", 694 | "near-vm-logic", 695 | "once_cell", 696 | "schemars", 697 | "serde", 698 | "serde_json", 699 | "wee_alloc", 700 | ] 701 | 702 | [[package]] 703 | name = "near-sdk-macros" 704 | version = "4.1.1" 705 | source = "registry+https://github.com/rust-lang/crates.io-index" 706 | checksum = "4907affc9f5ed559456509188ff0024f1f2099c0830e6bdb66eb61d5b75912c0" 707 | dependencies = [ 708 | "Inflector", 709 | "proc-macro2", 710 | "quote", 711 | "syn 1.0.109", 712 | ] 713 | 714 | [[package]] 715 | name = "near-sys" 716 | version = "0.2.0" 717 | source = "registry+https://github.com/rust-lang/crates.io-index" 718 | checksum = "e307313276eaeced2ca95740b5639e1f3125b7c97f0a1151809d105f1aa8c6d3" 719 | 720 | [[package]] 721 | name = "near-vm-errors" 722 | version = "0.14.0" 723 | source = "registry+https://github.com/rust-lang/crates.io-index" 724 | checksum = "d0da466a30f0446639cbd788c30865086fac3e8dcb07a79e51d2b0775ed4261e" 725 | dependencies = [ 726 | "borsh", 727 | "near-account-id", 728 | "near-rpc-error-macro", 729 | "serde", 730 | ] 731 | 732 | [[package]] 733 | name = "near-vm-logic" 734 | version = "0.14.0" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "81b534828419bacbf1f7b11ef7b00420f248c548c485d3f0cfda8bb6931152f2" 737 | dependencies = [ 738 | "base64 0.13.1", 739 | "borsh", 740 | "bs58", 741 | "byteorder", 742 | "near-account-id", 743 | "near-crypto", 744 | "near-primitives", 745 | "near-primitives-core", 746 | "near-vm-errors", 747 | "ripemd", 748 | "serde", 749 | "sha2 0.10.7", 750 | "sha3", 751 | "zeropool-bn", 752 | ] 753 | 754 | [[package]] 755 | name = "num-bigint" 756 | version = "0.3.3" 757 | source = "registry+https://github.com/rust-lang/crates.io-index" 758 | checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" 759 | dependencies = [ 760 | "autocfg", 761 | "num-integer", 762 | "num-traits", 763 | ] 764 | 765 | [[package]] 766 | name = "num-integer" 767 | version = "0.1.45" 768 | source = "registry+https://github.com/rust-lang/crates.io-index" 769 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 770 | dependencies = [ 771 | "autocfg", 772 | "num-traits", 773 | ] 774 | 775 | [[package]] 776 | name = "num-rational" 777 | version = "0.3.2" 778 | source = "registry+https://github.com/rust-lang/crates.io-index" 779 | checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" 780 | dependencies = [ 781 | "autocfg", 782 | "num-bigint", 783 | "num-integer", 784 | "num-traits", 785 | "serde", 786 | ] 787 | 788 | [[package]] 789 | name = "num-traits" 790 | version = "0.2.15" 791 | source = "registry+https://github.com/rust-lang/crates.io-index" 792 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 793 | dependencies = [ 794 | "autocfg", 795 | ] 796 | 797 | [[package]] 798 | name = "once_cell" 799 | version = "1.18.0" 800 | source = "registry+https://github.com/rust-lang/crates.io-index" 801 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 802 | 803 | [[package]] 804 | name = "opaque-debug" 805 | version = "0.3.0" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 808 | 809 | [[package]] 810 | name = "parity-scale-codec" 811 | version = "2.3.1" 812 | source = "registry+https://github.com/rust-lang/crates.io-index" 813 | checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909" 814 | dependencies = [ 815 | "arrayvec 0.7.4", 816 | "bitvec", 817 | "byte-slice-cast", 818 | "impl-trait-for-tuples", 819 | "parity-scale-codec-derive", 820 | "serde", 821 | ] 822 | 823 | [[package]] 824 | name = "parity-scale-codec-derive" 825 | version = "2.3.1" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" 828 | dependencies = [ 829 | "proc-macro-crate 1.3.1", 830 | "proc-macro2", 831 | "quote", 832 | "syn 1.0.109", 833 | ] 834 | 835 | [[package]] 836 | name = "parity-secp256k1" 837 | version = "0.7.0" 838 | source = "git+https://github.com/paritytech/rust-secp256k1.git#d05fd8e152f8d110b587906e3d854196b086e42a" 839 | dependencies = [ 840 | "arrayvec 0.5.2", 841 | "cc", 842 | "cfg-if 0.1.10", 843 | "rand 0.7.3", 844 | ] 845 | 846 | [[package]] 847 | name = "ppv-lite86" 848 | version = "0.2.17" 849 | source = "registry+https://github.com/rust-lang/crates.io-index" 850 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 851 | 852 | [[package]] 853 | name = "primitive-types" 854 | version = "0.10.1" 855 | source = "registry+https://github.com/rust-lang/crates.io-index" 856 | checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" 857 | dependencies = [ 858 | "fixed-hash", 859 | "impl-codec", 860 | "uint", 861 | ] 862 | 863 | [[package]] 864 | name = "proc-macro-crate" 865 | version = "0.1.5" 866 | source = "registry+https://github.com/rust-lang/crates.io-index" 867 | checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" 868 | dependencies = [ 869 | "toml", 870 | ] 871 | 872 | [[package]] 873 | name = "proc-macro-crate" 874 | version = "1.3.1" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" 877 | dependencies = [ 878 | "once_cell", 879 | "toml_edit", 880 | ] 881 | 882 | [[package]] 883 | name = "proc-macro2" 884 | version = "1.0.60" 885 | source = "registry+https://github.com/rust-lang/crates.io-index" 886 | checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" 887 | dependencies = [ 888 | "unicode-ident", 889 | ] 890 | 891 | [[package]] 892 | name = "quote" 893 | version = "1.0.28" 894 | source = "registry+https://github.com/rust-lang/crates.io-index" 895 | checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" 896 | dependencies = [ 897 | "proc-macro2", 898 | ] 899 | 900 | [[package]] 901 | name = "radium" 902 | version = "0.6.2" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" 905 | 906 | [[package]] 907 | name = "rand" 908 | version = "0.7.3" 909 | source = "registry+https://github.com/rust-lang/crates.io-index" 910 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" 911 | dependencies = [ 912 | "getrandom 0.1.16", 913 | "libc", 914 | "rand_chacha 0.2.2", 915 | "rand_core 0.5.1", 916 | "rand_hc", 917 | ] 918 | 919 | [[package]] 920 | name = "rand" 921 | version = "0.8.5" 922 | source = "registry+https://github.com/rust-lang/crates.io-index" 923 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 924 | dependencies = [ 925 | "libc", 926 | "rand_chacha 0.3.1", 927 | "rand_core 0.6.4", 928 | ] 929 | 930 | [[package]] 931 | name = "rand_chacha" 932 | version = "0.2.2" 933 | source = "registry+https://github.com/rust-lang/crates.io-index" 934 | checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" 935 | dependencies = [ 936 | "ppv-lite86", 937 | "rand_core 0.5.1", 938 | ] 939 | 940 | [[package]] 941 | name = "rand_chacha" 942 | version = "0.3.1" 943 | source = "registry+https://github.com/rust-lang/crates.io-index" 944 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 945 | dependencies = [ 946 | "ppv-lite86", 947 | "rand_core 0.6.4", 948 | ] 949 | 950 | [[package]] 951 | name = "rand_core" 952 | version = "0.5.1" 953 | source = "registry+https://github.com/rust-lang/crates.io-index" 954 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 955 | dependencies = [ 956 | "getrandom 0.1.16", 957 | ] 958 | 959 | [[package]] 960 | name = "rand_core" 961 | version = "0.6.4" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 964 | dependencies = [ 965 | "getrandom 0.2.10", 966 | ] 967 | 968 | [[package]] 969 | name = "rand_hc" 970 | version = "0.2.0" 971 | source = "registry+https://github.com/rust-lang/crates.io-index" 972 | checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 973 | dependencies = [ 974 | "rand_core 0.5.1", 975 | ] 976 | 977 | [[package]] 978 | name = "reed-solomon-erasure" 979 | version = "4.0.2" 980 | source = "registry+https://github.com/rust-lang/crates.io-index" 981 | checksum = "a415a013dd7c5d4221382329a5a3482566da675737494935cbbbcdec04662f9d" 982 | dependencies = [ 983 | "smallvec", 984 | ] 985 | 986 | [[package]] 987 | name = "ripemd" 988 | version = "0.1.3" 989 | source = "registry+https://github.com/rust-lang/crates.io-index" 990 | checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" 991 | dependencies = [ 992 | "digest 0.10.7", 993 | ] 994 | 995 | [[package]] 996 | name = "rustc-hex" 997 | version = "2.1.0" 998 | source = "registry+https://github.com/rust-lang/crates.io-index" 999 | checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" 1000 | 1001 | [[package]] 1002 | name = "rustc_version" 1003 | version = "0.4.0" 1004 | source = "registry+https://github.com/rust-lang/crates.io-index" 1005 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 1006 | dependencies = [ 1007 | "semver", 1008 | ] 1009 | 1010 | [[package]] 1011 | name = "rustversion" 1012 | version = "1.0.12" 1013 | source = "registry+https://github.com/rust-lang/crates.io-index" 1014 | checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" 1015 | 1016 | [[package]] 1017 | name = "ryu" 1018 | version = "1.0.13" 1019 | source = "registry+https://github.com/rust-lang/crates.io-index" 1020 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 1021 | 1022 | [[package]] 1023 | name = "schemars" 1024 | version = "0.8.12" 1025 | source = "registry+https://github.com/rust-lang/crates.io-index" 1026 | checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" 1027 | dependencies = [ 1028 | "dyn-clone", 1029 | "schemars_derive", 1030 | "serde", 1031 | "serde_json", 1032 | ] 1033 | 1034 | [[package]] 1035 | name = "schemars_derive" 1036 | version = "0.8.12" 1037 | source = "registry+https://github.com/rust-lang/crates.io-index" 1038 | checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" 1039 | dependencies = [ 1040 | "proc-macro2", 1041 | "quote", 1042 | "serde_derive_internals", 1043 | "syn 1.0.109", 1044 | ] 1045 | 1046 | [[package]] 1047 | name = "semver" 1048 | version = "1.0.17" 1049 | source = "registry+https://github.com/rust-lang/crates.io-index" 1050 | checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" 1051 | 1052 | [[package]] 1053 | name = "serde" 1054 | version = "1.0.164" 1055 | source = "registry+https://github.com/rust-lang/crates.io-index" 1056 | checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" 1057 | dependencies = [ 1058 | "serde_derive", 1059 | ] 1060 | 1061 | [[package]] 1062 | name = "serde_derive" 1063 | version = "1.0.164" 1064 | source = "registry+https://github.com/rust-lang/crates.io-index" 1065 | checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" 1066 | dependencies = [ 1067 | "proc-macro2", 1068 | "quote", 1069 | "syn 2.0.18", 1070 | ] 1071 | 1072 | [[package]] 1073 | name = "serde_derive_internals" 1074 | version = "0.26.0" 1075 | source = "registry+https://github.com/rust-lang/crates.io-index" 1076 | checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" 1077 | dependencies = [ 1078 | "proc-macro2", 1079 | "quote", 1080 | "syn 1.0.109", 1081 | ] 1082 | 1083 | [[package]] 1084 | name = "serde_json" 1085 | version = "1.0.97" 1086 | source = "registry+https://github.com/rust-lang/crates.io-index" 1087 | checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" 1088 | dependencies = [ 1089 | "itoa", 1090 | "ryu", 1091 | "serde", 1092 | ] 1093 | 1094 | [[package]] 1095 | name = "sha2" 1096 | version = "0.9.9" 1097 | source = "registry+https://github.com/rust-lang/crates.io-index" 1098 | checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" 1099 | dependencies = [ 1100 | "block-buffer 0.9.0", 1101 | "cfg-if 1.0.0", 1102 | "cpufeatures", 1103 | "digest 0.9.0", 1104 | "opaque-debug", 1105 | ] 1106 | 1107 | [[package]] 1108 | name = "sha2" 1109 | version = "0.10.7" 1110 | source = "registry+https://github.com/rust-lang/crates.io-index" 1111 | checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" 1112 | dependencies = [ 1113 | "cfg-if 1.0.0", 1114 | "cpufeatures", 1115 | "digest 0.10.7", 1116 | ] 1117 | 1118 | [[package]] 1119 | name = "sha3" 1120 | version = "0.10.8" 1121 | source = "registry+https://github.com/rust-lang/crates.io-index" 1122 | checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" 1123 | dependencies = [ 1124 | "digest 0.10.7", 1125 | "keccak", 1126 | ] 1127 | 1128 | [[package]] 1129 | name = "signature" 1130 | version = "1.6.4" 1131 | source = "registry+https://github.com/rust-lang/crates.io-index" 1132 | checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" 1133 | 1134 | [[package]] 1135 | name = "smallvec" 1136 | version = "1.10.0" 1137 | source = "registry+https://github.com/rust-lang/crates.io-index" 1138 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 1139 | 1140 | [[package]] 1141 | name = "smart-default" 1142 | version = "0.6.0" 1143 | source = "registry+https://github.com/rust-lang/crates.io-index" 1144 | checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" 1145 | dependencies = [ 1146 | "proc-macro2", 1147 | "quote", 1148 | "syn 1.0.109", 1149 | ] 1150 | 1151 | [[package]] 1152 | name = "spin" 1153 | version = "0.5.2" 1154 | source = "registry+https://github.com/rust-lang/crates.io-index" 1155 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 1156 | 1157 | [[package]] 1158 | name = "static_assertions" 1159 | version = "1.1.0" 1160 | source = "registry+https://github.com/rust-lang/crates.io-index" 1161 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1162 | 1163 | [[package]] 1164 | name = "strum" 1165 | version = "0.24.1" 1166 | source = "registry+https://github.com/rust-lang/crates.io-index" 1167 | checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" 1168 | dependencies = [ 1169 | "strum_macros", 1170 | ] 1171 | 1172 | [[package]] 1173 | name = "strum_macros" 1174 | version = "0.24.3" 1175 | source = "registry+https://github.com/rust-lang/crates.io-index" 1176 | checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" 1177 | dependencies = [ 1178 | "heck", 1179 | "proc-macro2", 1180 | "quote", 1181 | "rustversion", 1182 | "syn 1.0.109", 1183 | ] 1184 | 1185 | [[package]] 1186 | name = "subtle" 1187 | version = "2.5.0" 1188 | source = "registry+https://github.com/rust-lang/crates.io-index" 1189 | checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" 1190 | 1191 | [[package]] 1192 | name = "syn" 1193 | version = "1.0.109" 1194 | source = "registry+https://github.com/rust-lang/crates.io-index" 1195 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1196 | dependencies = [ 1197 | "proc-macro2", 1198 | "quote", 1199 | "unicode-ident", 1200 | ] 1201 | 1202 | [[package]] 1203 | name = "syn" 1204 | version = "2.0.18" 1205 | source = "registry+https://github.com/rust-lang/crates.io-index" 1206 | checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" 1207 | dependencies = [ 1208 | "proc-macro2", 1209 | "quote", 1210 | "unicode-ident", 1211 | ] 1212 | 1213 | [[package]] 1214 | name = "tap" 1215 | version = "1.0.1" 1216 | source = "registry+https://github.com/rust-lang/crates.io-index" 1217 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" 1218 | 1219 | [[package]] 1220 | name = "thiserror" 1221 | version = "1.0.40" 1222 | source = "registry+https://github.com/rust-lang/crates.io-index" 1223 | checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" 1224 | dependencies = [ 1225 | "thiserror-impl", 1226 | ] 1227 | 1228 | [[package]] 1229 | name = "thiserror-impl" 1230 | version = "1.0.40" 1231 | source = "registry+https://github.com/rust-lang/crates.io-index" 1232 | checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" 1233 | dependencies = [ 1234 | "proc-macro2", 1235 | "quote", 1236 | "syn 2.0.18", 1237 | ] 1238 | 1239 | [[package]] 1240 | name = "time" 1241 | version = "0.1.45" 1242 | source = "registry+https://github.com/rust-lang/crates.io-index" 1243 | checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" 1244 | dependencies = [ 1245 | "libc", 1246 | "wasi 0.10.0+wasi-snapshot-preview1", 1247 | "winapi", 1248 | ] 1249 | 1250 | [[package]] 1251 | name = "toml" 1252 | version = "0.5.11" 1253 | source = "registry+https://github.com/rust-lang/crates.io-index" 1254 | checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" 1255 | dependencies = [ 1256 | "serde", 1257 | ] 1258 | 1259 | [[package]] 1260 | name = "toml_datetime" 1261 | version = "0.6.2" 1262 | source = "registry+https://github.com/rust-lang/crates.io-index" 1263 | checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" 1264 | 1265 | [[package]] 1266 | name = "toml_edit" 1267 | version = "0.19.10" 1268 | source = "registry+https://github.com/rust-lang/crates.io-index" 1269 | checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" 1270 | dependencies = [ 1271 | "indexmap", 1272 | "toml_datetime", 1273 | "winnow", 1274 | ] 1275 | 1276 | [[package]] 1277 | name = "typenum" 1278 | version = "1.16.0" 1279 | source = "registry+https://github.com/rust-lang/crates.io-index" 1280 | checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" 1281 | 1282 | [[package]] 1283 | name = "uint" 1284 | version = "0.9.5" 1285 | source = "registry+https://github.com/rust-lang/crates.io-index" 1286 | checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" 1287 | dependencies = [ 1288 | "byteorder", 1289 | "crunchy", 1290 | "hex", 1291 | "static_assertions", 1292 | ] 1293 | 1294 | [[package]] 1295 | name = "unicode-ident" 1296 | version = "1.0.9" 1297 | source = "registry+https://github.com/rust-lang/crates.io-index" 1298 | checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" 1299 | 1300 | [[package]] 1301 | name = "version_check" 1302 | version = "0.9.4" 1303 | source = "registry+https://github.com/rust-lang/crates.io-index" 1304 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1305 | 1306 | [[package]] 1307 | name = "wasi" 1308 | version = "0.9.0+wasi-snapshot-preview1" 1309 | source = "registry+https://github.com/rust-lang/crates.io-index" 1310 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 1311 | 1312 | [[package]] 1313 | name = "wasi" 1314 | version = "0.10.0+wasi-snapshot-preview1" 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" 1316 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 1317 | 1318 | [[package]] 1319 | name = "wasi" 1320 | version = "0.11.0+wasi-snapshot-preview1" 1321 | source = "registry+https://github.com/rust-lang/crates.io-index" 1322 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1323 | 1324 | [[package]] 1325 | name = "wasm-bindgen" 1326 | version = "0.2.87" 1327 | source = "registry+https://github.com/rust-lang/crates.io-index" 1328 | checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" 1329 | dependencies = [ 1330 | "cfg-if 1.0.0", 1331 | "wasm-bindgen-macro", 1332 | ] 1333 | 1334 | [[package]] 1335 | name = "wasm-bindgen-backend" 1336 | version = "0.2.87" 1337 | source = "registry+https://github.com/rust-lang/crates.io-index" 1338 | checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" 1339 | dependencies = [ 1340 | "bumpalo", 1341 | "log", 1342 | "once_cell", 1343 | "proc-macro2", 1344 | "quote", 1345 | "syn 2.0.18", 1346 | "wasm-bindgen-shared", 1347 | ] 1348 | 1349 | [[package]] 1350 | name = "wasm-bindgen-macro" 1351 | version = "0.2.87" 1352 | source = "registry+https://github.com/rust-lang/crates.io-index" 1353 | checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" 1354 | dependencies = [ 1355 | "quote", 1356 | "wasm-bindgen-macro-support", 1357 | ] 1358 | 1359 | [[package]] 1360 | name = "wasm-bindgen-macro-support" 1361 | version = "0.2.87" 1362 | source = "registry+https://github.com/rust-lang/crates.io-index" 1363 | checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" 1364 | dependencies = [ 1365 | "proc-macro2", 1366 | "quote", 1367 | "syn 2.0.18", 1368 | "wasm-bindgen-backend", 1369 | "wasm-bindgen-shared", 1370 | ] 1371 | 1372 | [[package]] 1373 | name = "wasm-bindgen-shared" 1374 | version = "0.2.87" 1375 | source = "registry+https://github.com/rust-lang/crates.io-index" 1376 | checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" 1377 | 1378 | [[package]] 1379 | name = "wee_alloc" 1380 | version = "0.4.5" 1381 | source = "registry+https://github.com/rust-lang/crates.io-index" 1382 | checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" 1383 | dependencies = [ 1384 | "cfg-if 0.1.10", 1385 | "libc", 1386 | "memory_units", 1387 | "winapi", 1388 | ] 1389 | 1390 | [[package]] 1391 | name = "winapi" 1392 | version = "0.3.9" 1393 | source = "registry+https://github.com/rust-lang/crates.io-index" 1394 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1395 | dependencies = [ 1396 | "winapi-i686-pc-windows-gnu", 1397 | "winapi-x86_64-pc-windows-gnu", 1398 | ] 1399 | 1400 | [[package]] 1401 | name = "winapi-i686-pc-windows-gnu" 1402 | version = "0.4.0" 1403 | source = "registry+https://github.com/rust-lang/crates.io-index" 1404 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1405 | 1406 | [[package]] 1407 | name = "winapi-x86_64-pc-windows-gnu" 1408 | version = "0.4.0" 1409 | source = "registry+https://github.com/rust-lang/crates.io-index" 1410 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1411 | 1412 | [[package]] 1413 | name = "windows" 1414 | version = "0.48.0" 1415 | source = "registry+https://github.com/rust-lang/crates.io-index" 1416 | checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" 1417 | dependencies = [ 1418 | "windows-targets", 1419 | ] 1420 | 1421 | [[package]] 1422 | name = "windows-targets" 1423 | version = "0.48.0" 1424 | source = "registry+https://github.com/rust-lang/crates.io-index" 1425 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 1426 | dependencies = [ 1427 | "windows_aarch64_gnullvm", 1428 | "windows_aarch64_msvc", 1429 | "windows_i686_gnu", 1430 | "windows_i686_msvc", 1431 | "windows_x86_64_gnu", 1432 | "windows_x86_64_gnullvm", 1433 | "windows_x86_64_msvc", 1434 | ] 1435 | 1436 | [[package]] 1437 | name = "windows_aarch64_gnullvm" 1438 | version = "0.48.0" 1439 | source = "registry+https://github.com/rust-lang/crates.io-index" 1440 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1441 | 1442 | [[package]] 1443 | name = "windows_aarch64_msvc" 1444 | version = "0.48.0" 1445 | source = "registry+https://github.com/rust-lang/crates.io-index" 1446 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1447 | 1448 | [[package]] 1449 | name = "windows_i686_gnu" 1450 | version = "0.48.0" 1451 | source = "registry+https://github.com/rust-lang/crates.io-index" 1452 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1453 | 1454 | [[package]] 1455 | name = "windows_i686_msvc" 1456 | version = "0.48.0" 1457 | source = "registry+https://github.com/rust-lang/crates.io-index" 1458 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1459 | 1460 | [[package]] 1461 | name = "windows_x86_64_gnu" 1462 | version = "0.48.0" 1463 | source = "registry+https://github.com/rust-lang/crates.io-index" 1464 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1465 | 1466 | [[package]] 1467 | name = "windows_x86_64_gnullvm" 1468 | version = "0.48.0" 1469 | source = "registry+https://github.com/rust-lang/crates.io-index" 1470 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 1471 | 1472 | [[package]] 1473 | name = "windows_x86_64_msvc" 1474 | version = "0.48.0" 1475 | source = "registry+https://github.com/rust-lang/crates.io-index" 1476 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 1477 | 1478 | [[package]] 1479 | name = "winnow" 1480 | version = "0.4.7" 1481 | source = "registry+https://github.com/rust-lang/crates.io-index" 1482 | checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" 1483 | dependencies = [ 1484 | "memchr", 1485 | ] 1486 | 1487 | [[package]] 1488 | name = "wyz" 1489 | version = "0.2.0" 1490 | source = "registry+https://github.com/rust-lang/crates.io-index" 1491 | checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" 1492 | 1493 | [[package]] 1494 | name = "zeroize" 1495 | version = "1.3.0" 1496 | source = "registry+https://github.com/rust-lang/crates.io-index" 1497 | checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" 1498 | dependencies = [ 1499 | "zeroize_derive", 1500 | ] 1501 | 1502 | [[package]] 1503 | name = "zeroize_derive" 1504 | version = "1.4.2" 1505 | source = "registry+https://github.com/rust-lang/crates.io-index" 1506 | checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" 1507 | dependencies = [ 1508 | "proc-macro2", 1509 | "quote", 1510 | "syn 2.0.18", 1511 | ] 1512 | 1513 | [[package]] 1514 | name = "zeropool-bn" 1515 | version = "0.5.11" 1516 | source = "registry+https://github.com/rust-lang/crates.io-index" 1517 | checksum = "71e61de68ede9ffdd69c01664f65a178c5188b73f78faa21f0936016a888ff7c" 1518 | dependencies = [ 1519 | "borsh", 1520 | "byteorder", 1521 | "crunchy", 1522 | "lazy_static", 1523 | "rand 0.8.5", 1524 | "rustc-hex", 1525 | ] 1526 | -------------------------------------------------------------------------------- /4. 状态存储与容器/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "Inflector" 7 | version = "0.11.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" 10 | 11 | [[package]] 12 | name = "ahash" 13 | version = "0.7.6" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" 16 | dependencies = [ 17 | "getrandom 0.2.10", 18 | "once_cell", 19 | "version_check", 20 | ] 21 | 22 | [[package]] 23 | name = "android-tzdata" 24 | version = "0.1.1" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" 27 | 28 | [[package]] 29 | name = "android_system_properties" 30 | version = "0.1.5" 31 | source = "registry+https://github.com/rust-lang/crates.io-index" 32 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 33 | dependencies = [ 34 | "libc", 35 | ] 36 | 37 | [[package]] 38 | name = "arrayref" 39 | version = "0.3.7" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" 42 | 43 | [[package]] 44 | name = "arrayvec" 45 | version = "0.5.2" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" 48 | 49 | [[package]] 50 | name = "arrayvec" 51 | version = "0.7.4" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" 54 | 55 | [[package]] 56 | name = "autocfg" 57 | version = "1.1.0" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 60 | 61 | [[package]] 62 | name = "base64" 63 | version = "0.11.0" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" 66 | 67 | [[package]] 68 | name = "base64" 69 | version = "0.13.1" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 72 | 73 | [[package]] 74 | name = "bitvec" 75 | version = "0.20.4" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" 78 | dependencies = [ 79 | "funty", 80 | "radium", 81 | "tap", 82 | "wyz", 83 | ] 84 | 85 | [[package]] 86 | name = "blake2" 87 | version = "0.9.2" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174" 90 | dependencies = [ 91 | "crypto-mac", 92 | "digest 0.9.0", 93 | "opaque-debug", 94 | ] 95 | 96 | [[package]] 97 | name = "block-buffer" 98 | version = "0.9.0" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 101 | dependencies = [ 102 | "generic-array", 103 | ] 104 | 105 | [[package]] 106 | name = "block-buffer" 107 | version = "0.10.4" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 110 | dependencies = [ 111 | "generic-array", 112 | ] 113 | 114 | [[package]] 115 | name = "borsh" 116 | version = "0.9.3" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" 119 | dependencies = [ 120 | "borsh-derive", 121 | "hashbrown 0.11.2", 122 | ] 123 | 124 | [[package]] 125 | name = "borsh-derive" 126 | version = "0.9.3" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" 129 | dependencies = [ 130 | "borsh-derive-internal", 131 | "borsh-schema-derive-internal", 132 | "proc-macro-crate 0.1.5", 133 | "proc-macro2", 134 | "syn 1.0.109", 135 | ] 136 | 137 | [[package]] 138 | name = "borsh-derive-internal" 139 | version = "0.9.3" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" 142 | dependencies = [ 143 | "proc-macro2", 144 | "quote", 145 | "syn 1.0.109", 146 | ] 147 | 148 | [[package]] 149 | name = "borsh-schema-derive-internal" 150 | version = "0.9.3" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" 153 | dependencies = [ 154 | "proc-macro2", 155 | "quote", 156 | "syn 1.0.109", 157 | ] 158 | 159 | [[package]] 160 | name = "bs58" 161 | version = "0.4.0" 162 | source = "registry+https://github.com/rust-lang/crates.io-index" 163 | checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" 164 | 165 | [[package]] 166 | name = "bumpalo" 167 | version = "3.13.0" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" 170 | 171 | [[package]] 172 | name = "byte-slice-cast" 173 | version = "1.2.2" 174 | source = "registry+https://github.com/rust-lang/crates.io-index" 175 | checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" 176 | 177 | [[package]] 178 | name = "byteorder" 179 | version = "1.4.3" 180 | source = "registry+https://github.com/rust-lang/crates.io-index" 181 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 182 | 183 | [[package]] 184 | name = "bytesize" 185 | version = "1.2.0" 186 | source = "registry+https://github.com/rust-lang/crates.io-index" 187 | checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5" 188 | 189 | [[package]] 190 | name = "c2-chacha" 191 | version = "0.3.3" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "d27dae93fe7b1e0424dc57179ac396908c26b035a87234809f5c4dfd1b47dc80" 194 | dependencies = [ 195 | "cipher", 196 | "ppv-lite86", 197 | ] 198 | 199 | [[package]] 200 | name = "cc" 201 | version = "1.0.79" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 204 | 205 | [[package]] 206 | name = "cfg-if" 207 | version = "0.1.10" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 210 | 211 | [[package]] 212 | name = "cfg-if" 213 | version = "1.0.0" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 216 | 217 | [[package]] 218 | name = "chrono" 219 | version = "0.4.26" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" 222 | dependencies = [ 223 | "android-tzdata", 224 | "iana-time-zone", 225 | "js-sys", 226 | "num-traits", 227 | "serde", 228 | "time", 229 | "wasm-bindgen", 230 | "winapi", 231 | ] 232 | 233 | [[package]] 234 | name = "cipher" 235 | version = "0.2.5" 236 | source = "registry+https://github.com/rust-lang/crates.io-index" 237 | checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" 238 | dependencies = [ 239 | "generic-array", 240 | ] 241 | 242 | [[package]] 243 | name = "convert_case" 244 | version = "0.4.0" 245 | source = "registry+https://github.com/rust-lang/crates.io-index" 246 | checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" 247 | 248 | [[package]] 249 | name = "core-foundation-sys" 250 | version = "0.8.4" 251 | source = "registry+https://github.com/rust-lang/crates.io-index" 252 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" 253 | 254 | [[package]] 255 | name = "cpufeatures" 256 | version = "0.2.8" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" 259 | dependencies = [ 260 | "libc", 261 | ] 262 | 263 | [[package]] 264 | name = "crunchy" 265 | version = "0.2.2" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" 268 | 269 | [[package]] 270 | name = "crypto-common" 271 | version = "0.1.6" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 274 | dependencies = [ 275 | "generic-array", 276 | "typenum", 277 | ] 278 | 279 | [[package]] 280 | name = "crypto-mac" 281 | version = "0.8.0" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" 284 | dependencies = [ 285 | "generic-array", 286 | "subtle", 287 | ] 288 | 289 | [[package]] 290 | name = "curve25519-dalek" 291 | version = "3.2.1" 292 | source = "registry+https://github.com/rust-lang/crates.io-index" 293 | checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" 294 | dependencies = [ 295 | "byteorder", 296 | "digest 0.9.0", 297 | "rand_core 0.5.1", 298 | "subtle", 299 | "zeroize", 300 | ] 301 | 302 | [[package]] 303 | name = "derive_more" 304 | version = "0.99.17" 305 | source = "registry+https://github.com/rust-lang/crates.io-index" 306 | checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" 307 | dependencies = [ 308 | "convert_case", 309 | "proc-macro2", 310 | "quote", 311 | "rustc_version", 312 | "syn 1.0.109", 313 | ] 314 | 315 | [[package]] 316 | name = "digest" 317 | version = "0.9.0" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 320 | dependencies = [ 321 | "generic-array", 322 | ] 323 | 324 | [[package]] 325 | name = "digest" 326 | version = "0.10.7" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 329 | dependencies = [ 330 | "block-buffer 0.10.4", 331 | "crypto-common", 332 | ] 333 | 334 | [[package]] 335 | name = "dyn-clone" 336 | version = "1.0.11" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" 339 | 340 | [[package]] 341 | name = "easy-ext" 342 | version = "0.2.9" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "53aff6fdc1b181225acdcb5b14c47106726fd8e486707315b1b138baed68ee31" 345 | 346 | [[package]] 347 | name = "ed25519" 348 | version = "1.5.3" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" 351 | dependencies = [ 352 | "signature", 353 | ] 354 | 355 | [[package]] 356 | name = "ed25519-dalek" 357 | version = "1.0.1" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" 360 | dependencies = [ 361 | "curve25519-dalek", 362 | "ed25519", 363 | "rand 0.7.3", 364 | "serde", 365 | "sha2 0.9.9", 366 | "zeroize", 367 | ] 368 | 369 | [[package]] 370 | name = "fixed-hash" 371 | version = "0.7.0" 372 | source = "registry+https://github.com/rust-lang/crates.io-index" 373 | checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" 374 | dependencies = [ 375 | "byteorder", 376 | "rand 0.8.5", 377 | "rustc-hex", 378 | "static_assertions", 379 | ] 380 | 381 | [[package]] 382 | name = "funty" 383 | version = "1.1.0" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" 386 | 387 | [[package]] 388 | name = "generic-array" 389 | version = "0.14.7" 390 | source = "registry+https://github.com/rust-lang/crates.io-index" 391 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 392 | dependencies = [ 393 | "typenum", 394 | "version_check", 395 | ] 396 | 397 | [[package]] 398 | name = "getrandom" 399 | version = "0.1.16" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" 402 | dependencies = [ 403 | "cfg-if 1.0.0", 404 | "libc", 405 | "wasi 0.9.0+wasi-snapshot-preview1", 406 | ] 407 | 408 | [[package]] 409 | name = "getrandom" 410 | version = "0.2.10" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" 413 | dependencies = [ 414 | "cfg-if 1.0.0", 415 | "libc", 416 | "wasi 0.11.0+wasi-snapshot-preview1", 417 | ] 418 | 419 | [[package]] 420 | name = "hashbrown" 421 | version = "0.11.2" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 424 | dependencies = [ 425 | "ahash", 426 | ] 427 | 428 | [[package]] 429 | name = "hashbrown" 430 | version = "0.12.3" 431 | source = "registry+https://github.com/rust-lang/crates.io-index" 432 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 433 | 434 | [[package]] 435 | name = "heck" 436 | version = "0.4.1" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 439 | 440 | [[package]] 441 | name = "hello_collections" 442 | version = "1.0.0" 443 | dependencies = [ 444 | "near-sdk", 445 | ] 446 | 447 | [[package]] 448 | name = "hex" 449 | version = "0.4.3" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 452 | 453 | [[package]] 454 | name = "iana-time-zone" 455 | version = "0.1.57" 456 | source = "registry+https://github.com/rust-lang/crates.io-index" 457 | checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" 458 | dependencies = [ 459 | "android_system_properties", 460 | "core-foundation-sys", 461 | "iana-time-zone-haiku", 462 | "js-sys", 463 | "wasm-bindgen", 464 | "windows", 465 | ] 466 | 467 | [[package]] 468 | name = "iana-time-zone-haiku" 469 | version = "0.1.2" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" 472 | dependencies = [ 473 | "cc", 474 | ] 475 | 476 | [[package]] 477 | name = "impl-codec" 478 | version = "0.5.1" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443" 481 | dependencies = [ 482 | "parity-scale-codec", 483 | ] 484 | 485 | [[package]] 486 | name = "impl-trait-for-tuples" 487 | version = "0.2.2" 488 | source = "registry+https://github.com/rust-lang/crates.io-index" 489 | checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" 490 | dependencies = [ 491 | "proc-macro2", 492 | "quote", 493 | "syn 1.0.109", 494 | ] 495 | 496 | [[package]] 497 | name = "indexmap" 498 | version = "1.9.3" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 501 | dependencies = [ 502 | "autocfg", 503 | "hashbrown 0.12.3", 504 | ] 505 | 506 | [[package]] 507 | name = "itoa" 508 | version = "1.0.6" 509 | source = "registry+https://github.com/rust-lang/crates.io-index" 510 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" 511 | 512 | [[package]] 513 | name = "js-sys" 514 | version = "0.3.64" 515 | source = "registry+https://github.com/rust-lang/crates.io-index" 516 | checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" 517 | dependencies = [ 518 | "wasm-bindgen", 519 | ] 520 | 521 | [[package]] 522 | name = "keccak" 523 | version = "0.1.4" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" 526 | dependencies = [ 527 | "cpufeatures", 528 | ] 529 | 530 | [[package]] 531 | name = "lazy_static" 532 | version = "1.4.0" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 535 | dependencies = [ 536 | "spin", 537 | ] 538 | 539 | [[package]] 540 | name = "libc" 541 | version = "0.2.146" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" 544 | 545 | [[package]] 546 | name = "log" 547 | version = "0.4.19" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" 550 | 551 | [[package]] 552 | name = "memchr" 553 | version = "2.5.0" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 556 | 557 | [[package]] 558 | name = "memory_units" 559 | version = "0.4.0" 560 | source = "registry+https://github.com/rust-lang/crates.io-index" 561 | checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" 562 | 563 | [[package]] 564 | name = "near-abi" 565 | version = "0.3.0" 566 | source = "registry+https://github.com/rust-lang/crates.io-index" 567 | checksum = "885db39b08518fa700b73fa2214e8adbbfba316ba82dd510f50519173eadaf73" 568 | dependencies = [ 569 | "borsh", 570 | "schemars", 571 | "semver", 572 | "serde", 573 | ] 574 | 575 | [[package]] 576 | name = "near-account-id" 577 | version = "0.14.0" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | checksum = "71d258582a1878e6db67400b0504a5099db85718d22c2e07f747fe1706ae7150" 580 | dependencies = [ 581 | "borsh", 582 | "serde", 583 | ] 584 | 585 | [[package]] 586 | name = "near-crypto" 587 | version = "0.14.0" 588 | source = "registry+https://github.com/rust-lang/crates.io-index" 589 | checksum = "1e75673d69fd7365508f3d32483669fe45b03bfb34e4d9363e90adae9dfb416c" 590 | dependencies = [ 591 | "arrayref", 592 | "blake2", 593 | "borsh", 594 | "bs58", 595 | "c2-chacha", 596 | "curve25519-dalek", 597 | "derive_more", 598 | "ed25519-dalek", 599 | "near-account-id", 600 | "once_cell", 601 | "parity-secp256k1", 602 | "primitive-types", 603 | "rand 0.7.3", 604 | "rand_core 0.5.1", 605 | "serde", 606 | "serde_json", 607 | "subtle", 608 | "thiserror", 609 | ] 610 | 611 | [[package]] 612 | name = "near-primitives" 613 | version = "0.14.0" 614 | source = "registry+https://github.com/rust-lang/crates.io-index" 615 | checksum = "8ad1a9a1640539c81f065425c31bffcfbf6b31ef1aeaade59ce905f5df6ac860" 616 | dependencies = [ 617 | "borsh", 618 | "byteorder", 619 | "bytesize", 620 | "chrono", 621 | "derive_more", 622 | "easy-ext", 623 | "hex", 624 | "near-crypto", 625 | "near-primitives-core", 626 | "near-rpc-error-macro", 627 | "near-vm-errors", 628 | "num-rational", 629 | "once_cell", 630 | "primitive-types", 631 | "rand 0.7.3", 632 | "reed-solomon-erasure", 633 | "serde", 634 | "serde_json", 635 | "smart-default", 636 | "strum", 637 | "thiserror", 638 | ] 639 | 640 | [[package]] 641 | name = "near-primitives-core" 642 | version = "0.14.0" 643 | source = "registry+https://github.com/rust-lang/crates.io-index" 644 | checksum = "91d508f0fc340f6461e4e256417685720d3c4c00bb5a939b105160e49137caba" 645 | dependencies = [ 646 | "base64 0.11.0", 647 | "borsh", 648 | "bs58", 649 | "derive_more", 650 | "near-account-id", 651 | "num-rational", 652 | "serde", 653 | "sha2 0.10.7", 654 | "strum", 655 | ] 656 | 657 | [[package]] 658 | name = "near-rpc-error-core" 659 | version = "0.14.0" 660 | source = "registry+https://github.com/rust-lang/crates.io-index" 661 | checksum = "93ee0b41c75ef859c193a8ff1dadfa0c8207bc0ac447cc22259721ad769a1408" 662 | dependencies = [ 663 | "quote", 664 | "serde", 665 | "syn 1.0.109", 666 | ] 667 | 668 | [[package]] 669 | name = "near-rpc-error-macro" 670 | version = "0.14.0" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "8e837bd4bacd807073ec5ceb85708da7f721b46a4c2a978de86027fb0034ce31" 673 | dependencies = [ 674 | "near-rpc-error-core", 675 | "serde", 676 | "syn 1.0.109", 677 | ] 678 | 679 | [[package]] 680 | name = "near-sdk" 681 | version = "4.1.1" 682 | source = "registry+https://github.com/rust-lang/crates.io-index" 683 | checksum = "15eb3de2defe3626260cc209a6cdb985c6b27b0bd4619fad97dcfae002c3c5bd" 684 | dependencies = [ 685 | "base64 0.13.1", 686 | "borsh", 687 | "bs58", 688 | "near-abi", 689 | "near-crypto", 690 | "near-primitives", 691 | "near-primitives-core", 692 | "near-sdk-macros", 693 | "near-sys", 694 | "near-vm-logic", 695 | "once_cell", 696 | "schemars", 697 | "serde", 698 | "serde_json", 699 | "wee_alloc", 700 | ] 701 | 702 | [[package]] 703 | name = "near-sdk-macros" 704 | version = "4.1.1" 705 | source = "registry+https://github.com/rust-lang/crates.io-index" 706 | checksum = "4907affc9f5ed559456509188ff0024f1f2099c0830e6bdb66eb61d5b75912c0" 707 | dependencies = [ 708 | "Inflector", 709 | "proc-macro2", 710 | "quote", 711 | "syn 1.0.109", 712 | ] 713 | 714 | [[package]] 715 | name = "near-sys" 716 | version = "0.2.0" 717 | source = "registry+https://github.com/rust-lang/crates.io-index" 718 | checksum = "e307313276eaeced2ca95740b5639e1f3125b7c97f0a1151809d105f1aa8c6d3" 719 | 720 | [[package]] 721 | name = "near-vm-errors" 722 | version = "0.14.0" 723 | source = "registry+https://github.com/rust-lang/crates.io-index" 724 | checksum = "d0da466a30f0446639cbd788c30865086fac3e8dcb07a79e51d2b0775ed4261e" 725 | dependencies = [ 726 | "borsh", 727 | "near-account-id", 728 | "near-rpc-error-macro", 729 | "serde", 730 | ] 731 | 732 | [[package]] 733 | name = "near-vm-logic" 734 | version = "0.14.0" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "81b534828419bacbf1f7b11ef7b00420f248c548c485d3f0cfda8bb6931152f2" 737 | dependencies = [ 738 | "base64 0.13.1", 739 | "borsh", 740 | "bs58", 741 | "byteorder", 742 | "near-account-id", 743 | "near-crypto", 744 | "near-primitives", 745 | "near-primitives-core", 746 | "near-vm-errors", 747 | "ripemd", 748 | "serde", 749 | "sha2 0.10.7", 750 | "sha3", 751 | "zeropool-bn", 752 | ] 753 | 754 | [[package]] 755 | name = "num-bigint" 756 | version = "0.3.3" 757 | source = "registry+https://github.com/rust-lang/crates.io-index" 758 | checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" 759 | dependencies = [ 760 | "autocfg", 761 | "num-integer", 762 | "num-traits", 763 | ] 764 | 765 | [[package]] 766 | name = "num-integer" 767 | version = "0.1.45" 768 | source = "registry+https://github.com/rust-lang/crates.io-index" 769 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 770 | dependencies = [ 771 | "autocfg", 772 | "num-traits", 773 | ] 774 | 775 | [[package]] 776 | name = "num-rational" 777 | version = "0.3.2" 778 | source = "registry+https://github.com/rust-lang/crates.io-index" 779 | checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" 780 | dependencies = [ 781 | "autocfg", 782 | "num-bigint", 783 | "num-integer", 784 | "num-traits", 785 | "serde", 786 | ] 787 | 788 | [[package]] 789 | name = "num-traits" 790 | version = "0.2.15" 791 | source = "registry+https://github.com/rust-lang/crates.io-index" 792 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 793 | dependencies = [ 794 | "autocfg", 795 | ] 796 | 797 | [[package]] 798 | name = "once_cell" 799 | version = "1.18.0" 800 | source = "registry+https://github.com/rust-lang/crates.io-index" 801 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 802 | 803 | [[package]] 804 | name = "opaque-debug" 805 | version = "0.3.0" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 808 | 809 | [[package]] 810 | name = "parity-scale-codec" 811 | version = "2.3.1" 812 | source = "registry+https://github.com/rust-lang/crates.io-index" 813 | checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909" 814 | dependencies = [ 815 | "arrayvec 0.7.4", 816 | "bitvec", 817 | "byte-slice-cast", 818 | "impl-trait-for-tuples", 819 | "parity-scale-codec-derive", 820 | "serde", 821 | ] 822 | 823 | [[package]] 824 | name = "parity-scale-codec-derive" 825 | version = "2.3.1" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" 828 | dependencies = [ 829 | "proc-macro-crate 1.3.1", 830 | "proc-macro2", 831 | "quote", 832 | "syn 1.0.109", 833 | ] 834 | 835 | [[package]] 836 | name = "parity-secp256k1" 837 | version = "0.7.0" 838 | source = "git+https://github.com/paritytech/rust-secp256k1.git#d05fd8e152f8d110b587906e3d854196b086e42a" 839 | dependencies = [ 840 | "arrayvec 0.5.2", 841 | "cc", 842 | "cfg-if 0.1.10", 843 | "rand 0.7.3", 844 | ] 845 | 846 | [[package]] 847 | name = "ppv-lite86" 848 | version = "0.2.17" 849 | source = "registry+https://github.com/rust-lang/crates.io-index" 850 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 851 | 852 | [[package]] 853 | name = "primitive-types" 854 | version = "0.10.1" 855 | source = "registry+https://github.com/rust-lang/crates.io-index" 856 | checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" 857 | dependencies = [ 858 | "fixed-hash", 859 | "impl-codec", 860 | "uint", 861 | ] 862 | 863 | [[package]] 864 | name = "proc-macro-crate" 865 | version = "0.1.5" 866 | source = "registry+https://github.com/rust-lang/crates.io-index" 867 | checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" 868 | dependencies = [ 869 | "toml", 870 | ] 871 | 872 | [[package]] 873 | name = "proc-macro-crate" 874 | version = "1.3.1" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" 877 | dependencies = [ 878 | "once_cell", 879 | "toml_edit", 880 | ] 881 | 882 | [[package]] 883 | name = "proc-macro2" 884 | version = "1.0.60" 885 | source = "registry+https://github.com/rust-lang/crates.io-index" 886 | checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" 887 | dependencies = [ 888 | "unicode-ident", 889 | ] 890 | 891 | [[package]] 892 | name = "quote" 893 | version = "1.0.28" 894 | source = "registry+https://github.com/rust-lang/crates.io-index" 895 | checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" 896 | dependencies = [ 897 | "proc-macro2", 898 | ] 899 | 900 | [[package]] 901 | name = "radium" 902 | version = "0.6.2" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" 905 | 906 | [[package]] 907 | name = "rand" 908 | version = "0.7.3" 909 | source = "registry+https://github.com/rust-lang/crates.io-index" 910 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" 911 | dependencies = [ 912 | "getrandom 0.1.16", 913 | "libc", 914 | "rand_chacha 0.2.2", 915 | "rand_core 0.5.1", 916 | "rand_hc", 917 | ] 918 | 919 | [[package]] 920 | name = "rand" 921 | version = "0.8.5" 922 | source = "registry+https://github.com/rust-lang/crates.io-index" 923 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 924 | dependencies = [ 925 | "libc", 926 | "rand_chacha 0.3.1", 927 | "rand_core 0.6.4", 928 | ] 929 | 930 | [[package]] 931 | name = "rand_chacha" 932 | version = "0.2.2" 933 | source = "registry+https://github.com/rust-lang/crates.io-index" 934 | checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" 935 | dependencies = [ 936 | "ppv-lite86", 937 | "rand_core 0.5.1", 938 | ] 939 | 940 | [[package]] 941 | name = "rand_chacha" 942 | version = "0.3.1" 943 | source = "registry+https://github.com/rust-lang/crates.io-index" 944 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 945 | dependencies = [ 946 | "ppv-lite86", 947 | "rand_core 0.6.4", 948 | ] 949 | 950 | [[package]] 951 | name = "rand_core" 952 | version = "0.5.1" 953 | source = "registry+https://github.com/rust-lang/crates.io-index" 954 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 955 | dependencies = [ 956 | "getrandom 0.1.16", 957 | ] 958 | 959 | [[package]] 960 | name = "rand_core" 961 | version = "0.6.4" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 964 | dependencies = [ 965 | "getrandom 0.2.10", 966 | ] 967 | 968 | [[package]] 969 | name = "rand_hc" 970 | version = "0.2.0" 971 | source = "registry+https://github.com/rust-lang/crates.io-index" 972 | checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 973 | dependencies = [ 974 | "rand_core 0.5.1", 975 | ] 976 | 977 | [[package]] 978 | name = "reed-solomon-erasure" 979 | version = "4.0.2" 980 | source = "registry+https://github.com/rust-lang/crates.io-index" 981 | checksum = "a415a013dd7c5d4221382329a5a3482566da675737494935cbbbcdec04662f9d" 982 | dependencies = [ 983 | "smallvec", 984 | ] 985 | 986 | [[package]] 987 | name = "ripemd" 988 | version = "0.1.3" 989 | source = "registry+https://github.com/rust-lang/crates.io-index" 990 | checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" 991 | dependencies = [ 992 | "digest 0.10.7", 993 | ] 994 | 995 | [[package]] 996 | name = "rustc-hex" 997 | version = "2.1.0" 998 | source = "registry+https://github.com/rust-lang/crates.io-index" 999 | checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" 1000 | 1001 | [[package]] 1002 | name = "rustc_version" 1003 | version = "0.4.0" 1004 | source = "registry+https://github.com/rust-lang/crates.io-index" 1005 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 1006 | dependencies = [ 1007 | "semver", 1008 | ] 1009 | 1010 | [[package]] 1011 | name = "rustversion" 1012 | version = "1.0.12" 1013 | source = "registry+https://github.com/rust-lang/crates.io-index" 1014 | checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" 1015 | 1016 | [[package]] 1017 | name = "ryu" 1018 | version = "1.0.13" 1019 | source = "registry+https://github.com/rust-lang/crates.io-index" 1020 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 1021 | 1022 | [[package]] 1023 | name = "schemars" 1024 | version = "0.8.12" 1025 | source = "registry+https://github.com/rust-lang/crates.io-index" 1026 | checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" 1027 | dependencies = [ 1028 | "dyn-clone", 1029 | "schemars_derive", 1030 | "serde", 1031 | "serde_json", 1032 | ] 1033 | 1034 | [[package]] 1035 | name = "schemars_derive" 1036 | version = "0.8.12" 1037 | source = "registry+https://github.com/rust-lang/crates.io-index" 1038 | checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" 1039 | dependencies = [ 1040 | "proc-macro2", 1041 | "quote", 1042 | "serde_derive_internals", 1043 | "syn 1.0.109", 1044 | ] 1045 | 1046 | [[package]] 1047 | name = "semver" 1048 | version = "1.0.17" 1049 | source = "registry+https://github.com/rust-lang/crates.io-index" 1050 | checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" 1051 | 1052 | [[package]] 1053 | name = "serde" 1054 | version = "1.0.164" 1055 | source = "registry+https://github.com/rust-lang/crates.io-index" 1056 | checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" 1057 | dependencies = [ 1058 | "serde_derive", 1059 | ] 1060 | 1061 | [[package]] 1062 | name = "serde_derive" 1063 | version = "1.0.164" 1064 | source = "registry+https://github.com/rust-lang/crates.io-index" 1065 | checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" 1066 | dependencies = [ 1067 | "proc-macro2", 1068 | "quote", 1069 | "syn 2.0.18", 1070 | ] 1071 | 1072 | [[package]] 1073 | name = "serde_derive_internals" 1074 | version = "0.26.0" 1075 | source = "registry+https://github.com/rust-lang/crates.io-index" 1076 | checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" 1077 | dependencies = [ 1078 | "proc-macro2", 1079 | "quote", 1080 | "syn 1.0.109", 1081 | ] 1082 | 1083 | [[package]] 1084 | name = "serde_json" 1085 | version = "1.0.97" 1086 | source = "registry+https://github.com/rust-lang/crates.io-index" 1087 | checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" 1088 | dependencies = [ 1089 | "itoa", 1090 | "ryu", 1091 | "serde", 1092 | ] 1093 | 1094 | [[package]] 1095 | name = "sha2" 1096 | version = "0.9.9" 1097 | source = "registry+https://github.com/rust-lang/crates.io-index" 1098 | checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" 1099 | dependencies = [ 1100 | "block-buffer 0.9.0", 1101 | "cfg-if 1.0.0", 1102 | "cpufeatures", 1103 | "digest 0.9.0", 1104 | "opaque-debug", 1105 | ] 1106 | 1107 | [[package]] 1108 | name = "sha2" 1109 | version = "0.10.7" 1110 | source = "registry+https://github.com/rust-lang/crates.io-index" 1111 | checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" 1112 | dependencies = [ 1113 | "cfg-if 1.0.0", 1114 | "cpufeatures", 1115 | "digest 0.10.7", 1116 | ] 1117 | 1118 | [[package]] 1119 | name = "sha3" 1120 | version = "0.10.8" 1121 | source = "registry+https://github.com/rust-lang/crates.io-index" 1122 | checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" 1123 | dependencies = [ 1124 | "digest 0.10.7", 1125 | "keccak", 1126 | ] 1127 | 1128 | [[package]] 1129 | name = "signature" 1130 | version = "1.6.4" 1131 | source = "registry+https://github.com/rust-lang/crates.io-index" 1132 | checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" 1133 | 1134 | [[package]] 1135 | name = "smallvec" 1136 | version = "1.10.0" 1137 | source = "registry+https://github.com/rust-lang/crates.io-index" 1138 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 1139 | 1140 | [[package]] 1141 | name = "smart-default" 1142 | version = "0.6.0" 1143 | source = "registry+https://github.com/rust-lang/crates.io-index" 1144 | checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" 1145 | dependencies = [ 1146 | "proc-macro2", 1147 | "quote", 1148 | "syn 1.0.109", 1149 | ] 1150 | 1151 | [[package]] 1152 | name = "spin" 1153 | version = "0.5.2" 1154 | source = "registry+https://github.com/rust-lang/crates.io-index" 1155 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 1156 | 1157 | [[package]] 1158 | name = "static_assertions" 1159 | version = "1.1.0" 1160 | source = "registry+https://github.com/rust-lang/crates.io-index" 1161 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1162 | 1163 | [[package]] 1164 | name = "strum" 1165 | version = "0.24.1" 1166 | source = "registry+https://github.com/rust-lang/crates.io-index" 1167 | checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" 1168 | dependencies = [ 1169 | "strum_macros", 1170 | ] 1171 | 1172 | [[package]] 1173 | name = "strum_macros" 1174 | version = "0.24.3" 1175 | source = "registry+https://github.com/rust-lang/crates.io-index" 1176 | checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" 1177 | dependencies = [ 1178 | "heck", 1179 | "proc-macro2", 1180 | "quote", 1181 | "rustversion", 1182 | "syn 1.0.109", 1183 | ] 1184 | 1185 | [[package]] 1186 | name = "subtle" 1187 | version = "2.5.0" 1188 | source = "registry+https://github.com/rust-lang/crates.io-index" 1189 | checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" 1190 | 1191 | [[package]] 1192 | name = "syn" 1193 | version = "1.0.109" 1194 | source = "registry+https://github.com/rust-lang/crates.io-index" 1195 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1196 | dependencies = [ 1197 | "proc-macro2", 1198 | "quote", 1199 | "unicode-ident", 1200 | ] 1201 | 1202 | [[package]] 1203 | name = "syn" 1204 | version = "2.0.18" 1205 | source = "registry+https://github.com/rust-lang/crates.io-index" 1206 | checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" 1207 | dependencies = [ 1208 | "proc-macro2", 1209 | "quote", 1210 | "unicode-ident", 1211 | ] 1212 | 1213 | [[package]] 1214 | name = "tap" 1215 | version = "1.0.1" 1216 | source = "registry+https://github.com/rust-lang/crates.io-index" 1217 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" 1218 | 1219 | [[package]] 1220 | name = "thiserror" 1221 | version = "1.0.40" 1222 | source = "registry+https://github.com/rust-lang/crates.io-index" 1223 | checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" 1224 | dependencies = [ 1225 | "thiserror-impl", 1226 | ] 1227 | 1228 | [[package]] 1229 | name = "thiserror-impl" 1230 | version = "1.0.40" 1231 | source = "registry+https://github.com/rust-lang/crates.io-index" 1232 | checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" 1233 | dependencies = [ 1234 | "proc-macro2", 1235 | "quote", 1236 | "syn 2.0.18", 1237 | ] 1238 | 1239 | [[package]] 1240 | name = "time" 1241 | version = "0.1.45" 1242 | source = "registry+https://github.com/rust-lang/crates.io-index" 1243 | checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" 1244 | dependencies = [ 1245 | "libc", 1246 | "wasi 0.10.0+wasi-snapshot-preview1", 1247 | "winapi", 1248 | ] 1249 | 1250 | [[package]] 1251 | name = "toml" 1252 | version = "0.5.11" 1253 | source = "registry+https://github.com/rust-lang/crates.io-index" 1254 | checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" 1255 | dependencies = [ 1256 | "serde", 1257 | ] 1258 | 1259 | [[package]] 1260 | name = "toml_datetime" 1261 | version = "0.6.2" 1262 | source = "registry+https://github.com/rust-lang/crates.io-index" 1263 | checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" 1264 | 1265 | [[package]] 1266 | name = "toml_edit" 1267 | version = "0.19.10" 1268 | source = "registry+https://github.com/rust-lang/crates.io-index" 1269 | checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" 1270 | dependencies = [ 1271 | "indexmap", 1272 | "toml_datetime", 1273 | "winnow", 1274 | ] 1275 | 1276 | [[package]] 1277 | name = "typenum" 1278 | version = "1.16.0" 1279 | source = "registry+https://github.com/rust-lang/crates.io-index" 1280 | checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" 1281 | 1282 | [[package]] 1283 | name = "uint" 1284 | version = "0.9.5" 1285 | source = "registry+https://github.com/rust-lang/crates.io-index" 1286 | checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" 1287 | dependencies = [ 1288 | "byteorder", 1289 | "crunchy", 1290 | "hex", 1291 | "static_assertions", 1292 | ] 1293 | 1294 | [[package]] 1295 | name = "unicode-ident" 1296 | version = "1.0.9" 1297 | source = "registry+https://github.com/rust-lang/crates.io-index" 1298 | checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" 1299 | 1300 | [[package]] 1301 | name = "version_check" 1302 | version = "0.9.4" 1303 | source = "registry+https://github.com/rust-lang/crates.io-index" 1304 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1305 | 1306 | [[package]] 1307 | name = "wasi" 1308 | version = "0.9.0+wasi-snapshot-preview1" 1309 | source = "registry+https://github.com/rust-lang/crates.io-index" 1310 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 1311 | 1312 | [[package]] 1313 | name = "wasi" 1314 | version = "0.10.0+wasi-snapshot-preview1" 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" 1316 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 1317 | 1318 | [[package]] 1319 | name = "wasi" 1320 | version = "0.11.0+wasi-snapshot-preview1" 1321 | source = "registry+https://github.com/rust-lang/crates.io-index" 1322 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1323 | 1324 | [[package]] 1325 | name = "wasm-bindgen" 1326 | version = "0.2.87" 1327 | source = "registry+https://github.com/rust-lang/crates.io-index" 1328 | checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" 1329 | dependencies = [ 1330 | "cfg-if 1.0.0", 1331 | "wasm-bindgen-macro", 1332 | ] 1333 | 1334 | [[package]] 1335 | name = "wasm-bindgen-backend" 1336 | version = "0.2.87" 1337 | source = "registry+https://github.com/rust-lang/crates.io-index" 1338 | checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" 1339 | dependencies = [ 1340 | "bumpalo", 1341 | "log", 1342 | "once_cell", 1343 | "proc-macro2", 1344 | "quote", 1345 | "syn 2.0.18", 1346 | "wasm-bindgen-shared", 1347 | ] 1348 | 1349 | [[package]] 1350 | name = "wasm-bindgen-macro" 1351 | version = "0.2.87" 1352 | source = "registry+https://github.com/rust-lang/crates.io-index" 1353 | checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" 1354 | dependencies = [ 1355 | "quote", 1356 | "wasm-bindgen-macro-support", 1357 | ] 1358 | 1359 | [[package]] 1360 | name = "wasm-bindgen-macro-support" 1361 | version = "0.2.87" 1362 | source = "registry+https://github.com/rust-lang/crates.io-index" 1363 | checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" 1364 | dependencies = [ 1365 | "proc-macro2", 1366 | "quote", 1367 | "syn 2.0.18", 1368 | "wasm-bindgen-backend", 1369 | "wasm-bindgen-shared", 1370 | ] 1371 | 1372 | [[package]] 1373 | name = "wasm-bindgen-shared" 1374 | version = "0.2.87" 1375 | source = "registry+https://github.com/rust-lang/crates.io-index" 1376 | checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" 1377 | 1378 | [[package]] 1379 | name = "wee_alloc" 1380 | version = "0.4.5" 1381 | source = "registry+https://github.com/rust-lang/crates.io-index" 1382 | checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" 1383 | dependencies = [ 1384 | "cfg-if 0.1.10", 1385 | "libc", 1386 | "memory_units", 1387 | "winapi", 1388 | ] 1389 | 1390 | [[package]] 1391 | name = "winapi" 1392 | version = "0.3.9" 1393 | source = "registry+https://github.com/rust-lang/crates.io-index" 1394 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1395 | dependencies = [ 1396 | "winapi-i686-pc-windows-gnu", 1397 | "winapi-x86_64-pc-windows-gnu", 1398 | ] 1399 | 1400 | [[package]] 1401 | name = "winapi-i686-pc-windows-gnu" 1402 | version = "0.4.0" 1403 | source = "registry+https://github.com/rust-lang/crates.io-index" 1404 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1405 | 1406 | [[package]] 1407 | name = "winapi-x86_64-pc-windows-gnu" 1408 | version = "0.4.0" 1409 | source = "registry+https://github.com/rust-lang/crates.io-index" 1410 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1411 | 1412 | [[package]] 1413 | name = "windows" 1414 | version = "0.48.0" 1415 | source = "registry+https://github.com/rust-lang/crates.io-index" 1416 | checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" 1417 | dependencies = [ 1418 | "windows-targets", 1419 | ] 1420 | 1421 | [[package]] 1422 | name = "windows-targets" 1423 | version = "0.48.0" 1424 | source = "registry+https://github.com/rust-lang/crates.io-index" 1425 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 1426 | dependencies = [ 1427 | "windows_aarch64_gnullvm", 1428 | "windows_aarch64_msvc", 1429 | "windows_i686_gnu", 1430 | "windows_i686_msvc", 1431 | "windows_x86_64_gnu", 1432 | "windows_x86_64_gnullvm", 1433 | "windows_x86_64_msvc", 1434 | ] 1435 | 1436 | [[package]] 1437 | name = "windows_aarch64_gnullvm" 1438 | version = "0.48.0" 1439 | source = "registry+https://github.com/rust-lang/crates.io-index" 1440 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1441 | 1442 | [[package]] 1443 | name = "windows_aarch64_msvc" 1444 | version = "0.48.0" 1445 | source = "registry+https://github.com/rust-lang/crates.io-index" 1446 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1447 | 1448 | [[package]] 1449 | name = "windows_i686_gnu" 1450 | version = "0.48.0" 1451 | source = "registry+https://github.com/rust-lang/crates.io-index" 1452 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1453 | 1454 | [[package]] 1455 | name = "windows_i686_msvc" 1456 | version = "0.48.0" 1457 | source = "registry+https://github.com/rust-lang/crates.io-index" 1458 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1459 | 1460 | [[package]] 1461 | name = "windows_x86_64_gnu" 1462 | version = "0.48.0" 1463 | source = "registry+https://github.com/rust-lang/crates.io-index" 1464 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1465 | 1466 | [[package]] 1467 | name = "windows_x86_64_gnullvm" 1468 | version = "0.48.0" 1469 | source = "registry+https://github.com/rust-lang/crates.io-index" 1470 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 1471 | 1472 | [[package]] 1473 | name = "windows_x86_64_msvc" 1474 | version = "0.48.0" 1475 | source = "registry+https://github.com/rust-lang/crates.io-index" 1476 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 1477 | 1478 | [[package]] 1479 | name = "winnow" 1480 | version = "0.4.7" 1481 | source = "registry+https://github.com/rust-lang/crates.io-index" 1482 | checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" 1483 | dependencies = [ 1484 | "memchr", 1485 | ] 1486 | 1487 | [[package]] 1488 | name = "wyz" 1489 | version = "0.2.0" 1490 | source = "registry+https://github.com/rust-lang/crates.io-index" 1491 | checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" 1492 | 1493 | [[package]] 1494 | name = "zeroize" 1495 | version = "1.3.0" 1496 | source = "registry+https://github.com/rust-lang/crates.io-index" 1497 | checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" 1498 | dependencies = [ 1499 | "zeroize_derive", 1500 | ] 1501 | 1502 | [[package]] 1503 | name = "zeroize_derive" 1504 | version = "1.4.2" 1505 | source = "registry+https://github.com/rust-lang/crates.io-index" 1506 | checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" 1507 | dependencies = [ 1508 | "proc-macro2", 1509 | "quote", 1510 | "syn 2.0.18", 1511 | ] 1512 | 1513 | [[package]] 1514 | name = "zeropool-bn" 1515 | version = "0.5.11" 1516 | source = "registry+https://github.com/rust-lang/crates.io-index" 1517 | checksum = "71e61de68ede9ffdd69c01664f65a178c5188b73f78faa21f0936016a888ff7c" 1518 | dependencies = [ 1519 | "borsh", 1520 | "byteorder", 1521 | "crunchy", 1522 | "lazy_static", 1523 | "rand 0.8.5", 1524 | "rustc-hex", 1525 | ] 1526 | -------------------------------------------------------------------------------- /5. 跨合约调用与回调函数/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "Inflector" 7 | version = "0.11.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" 10 | 11 | [[package]] 12 | name = "ahash" 13 | version = "0.7.6" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" 16 | dependencies = [ 17 | "getrandom 0.2.10", 18 | "once_cell", 19 | "version_check", 20 | ] 21 | 22 | [[package]] 23 | name = "android-tzdata" 24 | version = "0.1.1" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" 27 | 28 | [[package]] 29 | name = "android_system_properties" 30 | version = "0.1.5" 31 | source = "registry+https://github.com/rust-lang/crates.io-index" 32 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 33 | dependencies = [ 34 | "libc", 35 | ] 36 | 37 | [[package]] 38 | name = "arrayref" 39 | version = "0.3.7" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" 42 | 43 | [[package]] 44 | name = "arrayvec" 45 | version = "0.5.2" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" 48 | 49 | [[package]] 50 | name = "arrayvec" 51 | version = "0.7.4" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" 54 | 55 | [[package]] 56 | name = "autocfg" 57 | version = "1.1.0" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 60 | 61 | [[package]] 62 | name = "base64" 63 | version = "0.11.0" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" 66 | 67 | [[package]] 68 | name = "base64" 69 | version = "0.13.1" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 72 | 73 | [[package]] 74 | name = "bitvec" 75 | version = "0.20.4" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" 78 | dependencies = [ 79 | "funty", 80 | "radium", 81 | "tap", 82 | "wyz", 83 | ] 84 | 85 | [[package]] 86 | name = "blake2" 87 | version = "0.9.2" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174" 90 | dependencies = [ 91 | "crypto-mac", 92 | "digest 0.9.0", 93 | "opaque-debug", 94 | ] 95 | 96 | [[package]] 97 | name = "block-buffer" 98 | version = "0.9.0" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 101 | dependencies = [ 102 | "generic-array", 103 | ] 104 | 105 | [[package]] 106 | name = "block-buffer" 107 | version = "0.10.4" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 110 | dependencies = [ 111 | "generic-array", 112 | ] 113 | 114 | [[package]] 115 | name = "borsh" 116 | version = "0.9.3" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" 119 | dependencies = [ 120 | "borsh-derive", 121 | "hashbrown 0.11.2", 122 | ] 123 | 124 | [[package]] 125 | name = "borsh-derive" 126 | version = "0.9.3" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" 129 | dependencies = [ 130 | "borsh-derive-internal", 131 | "borsh-schema-derive-internal", 132 | "proc-macro-crate 0.1.5", 133 | "proc-macro2", 134 | "syn 1.0.109", 135 | ] 136 | 137 | [[package]] 138 | name = "borsh-derive-internal" 139 | version = "0.9.3" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" 142 | dependencies = [ 143 | "proc-macro2", 144 | "quote", 145 | "syn 1.0.109", 146 | ] 147 | 148 | [[package]] 149 | name = "borsh-schema-derive-internal" 150 | version = "0.9.3" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" 153 | dependencies = [ 154 | "proc-macro2", 155 | "quote", 156 | "syn 1.0.109", 157 | ] 158 | 159 | [[package]] 160 | name = "bs58" 161 | version = "0.4.0" 162 | source = "registry+https://github.com/rust-lang/crates.io-index" 163 | checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" 164 | 165 | [[package]] 166 | name = "bumpalo" 167 | version = "3.13.0" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" 170 | 171 | [[package]] 172 | name = "byte-slice-cast" 173 | version = "1.2.2" 174 | source = "registry+https://github.com/rust-lang/crates.io-index" 175 | checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" 176 | 177 | [[package]] 178 | name = "byteorder" 179 | version = "1.4.3" 180 | source = "registry+https://github.com/rust-lang/crates.io-index" 181 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 182 | 183 | [[package]] 184 | name = "bytesize" 185 | version = "1.2.0" 186 | source = "registry+https://github.com/rust-lang/crates.io-index" 187 | checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5" 188 | 189 | [[package]] 190 | name = "c2-chacha" 191 | version = "0.3.3" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "d27dae93fe7b1e0424dc57179ac396908c26b035a87234809f5c4dfd1b47dc80" 194 | dependencies = [ 195 | "cipher", 196 | "ppv-lite86", 197 | ] 198 | 199 | [[package]] 200 | name = "cc" 201 | version = "1.0.79" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 204 | 205 | [[package]] 206 | name = "cfg-if" 207 | version = "0.1.10" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 210 | 211 | [[package]] 212 | name = "cfg-if" 213 | version = "1.0.0" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 216 | 217 | [[package]] 218 | name = "chrono" 219 | version = "0.4.26" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" 222 | dependencies = [ 223 | "android-tzdata", 224 | "iana-time-zone", 225 | "js-sys", 226 | "num-traits", 227 | "serde", 228 | "time", 229 | "wasm-bindgen", 230 | "winapi", 231 | ] 232 | 233 | [[package]] 234 | name = "cipher" 235 | version = "0.2.5" 236 | source = "registry+https://github.com/rust-lang/crates.io-index" 237 | checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" 238 | dependencies = [ 239 | "generic-array", 240 | ] 241 | 242 | [[package]] 243 | name = "convert_case" 244 | version = "0.4.0" 245 | source = "registry+https://github.com/rust-lang/crates.io-index" 246 | checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" 247 | 248 | [[package]] 249 | name = "core-foundation-sys" 250 | version = "0.8.4" 251 | source = "registry+https://github.com/rust-lang/crates.io-index" 252 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" 253 | 254 | [[package]] 255 | name = "cpufeatures" 256 | version = "0.2.8" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" 259 | dependencies = [ 260 | "libc", 261 | ] 262 | 263 | [[package]] 264 | name = "crunchy" 265 | version = "0.2.2" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" 268 | 269 | [[package]] 270 | name = "crypto-common" 271 | version = "0.1.6" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 274 | dependencies = [ 275 | "generic-array", 276 | "typenum", 277 | ] 278 | 279 | [[package]] 280 | name = "crypto-mac" 281 | version = "0.8.0" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" 284 | dependencies = [ 285 | "generic-array", 286 | "subtle", 287 | ] 288 | 289 | [[package]] 290 | name = "curve25519-dalek" 291 | version = "3.2.1" 292 | source = "registry+https://github.com/rust-lang/crates.io-index" 293 | checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" 294 | dependencies = [ 295 | "byteorder", 296 | "digest 0.9.0", 297 | "rand_core 0.5.1", 298 | "subtle", 299 | "zeroize", 300 | ] 301 | 302 | [[package]] 303 | name = "derive_more" 304 | version = "0.99.17" 305 | source = "registry+https://github.com/rust-lang/crates.io-index" 306 | checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" 307 | dependencies = [ 308 | "convert_case", 309 | "proc-macro2", 310 | "quote", 311 | "rustc_version", 312 | "syn 1.0.109", 313 | ] 314 | 315 | [[package]] 316 | name = "digest" 317 | version = "0.9.0" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 320 | dependencies = [ 321 | "generic-array", 322 | ] 323 | 324 | [[package]] 325 | name = "digest" 326 | version = "0.10.7" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 329 | dependencies = [ 330 | "block-buffer 0.10.4", 331 | "crypto-common", 332 | ] 333 | 334 | [[package]] 335 | name = "dyn-clone" 336 | version = "1.0.11" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" 339 | 340 | [[package]] 341 | name = "easy-ext" 342 | version = "0.2.9" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "53aff6fdc1b181225acdcb5b14c47106726fd8e486707315b1b138baed68ee31" 345 | 346 | [[package]] 347 | name = "ed25519" 348 | version = "1.5.3" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" 351 | dependencies = [ 352 | "signature", 353 | ] 354 | 355 | [[package]] 356 | name = "ed25519-dalek" 357 | version = "1.0.1" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" 360 | dependencies = [ 361 | "curve25519-dalek", 362 | "ed25519", 363 | "rand 0.7.3", 364 | "serde", 365 | "sha2 0.9.9", 366 | "zeroize", 367 | ] 368 | 369 | [[package]] 370 | name = "fixed-hash" 371 | version = "0.7.0" 372 | source = "registry+https://github.com/rust-lang/crates.io-index" 373 | checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" 374 | dependencies = [ 375 | "byteorder", 376 | "rand 0.8.5", 377 | "rustc-hex", 378 | "static_assertions", 379 | ] 380 | 381 | [[package]] 382 | name = "funty" 383 | version = "1.1.0" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" 386 | 387 | [[package]] 388 | name = "generic-array" 389 | version = "0.14.7" 390 | source = "registry+https://github.com/rust-lang/crates.io-index" 391 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 392 | dependencies = [ 393 | "typenum", 394 | "version_check", 395 | ] 396 | 397 | [[package]] 398 | name = "getrandom" 399 | version = "0.1.16" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" 402 | dependencies = [ 403 | "cfg-if 1.0.0", 404 | "libc", 405 | "wasi 0.9.0+wasi-snapshot-preview1", 406 | ] 407 | 408 | [[package]] 409 | name = "getrandom" 410 | version = "0.2.10" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" 413 | dependencies = [ 414 | "cfg-if 1.0.0", 415 | "libc", 416 | "wasi 0.11.0+wasi-snapshot-preview1", 417 | ] 418 | 419 | [[package]] 420 | name = "hashbrown" 421 | version = "0.11.2" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 424 | dependencies = [ 425 | "ahash", 426 | ] 427 | 428 | [[package]] 429 | name = "hashbrown" 430 | version = "0.12.3" 431 | source = "registry+https://github.com/rust-lang/crates.io-index" 432 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 433 | 434 | [[package]] 435 | name = "heck" 436 | version = "0.4.1" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 439 | 440 | [[package]] 441 | name = "hello_cross" 442 | version = "1.0.0" 443 | dependencies = [ 444 | "near-sdk", 445 | ] 446 | 447 | [[package]] 448 | name = "hex" 449 | version = "0.4.3" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 452 | 453 | [[package]] 454 | name = "iana-time-zone" 455 | version = "0.1.57" 456 | source = "registry+https://github.com/rust-lang/crates.io-index" 457 | checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" 458 | dependencies = [ 459 | "android_system_properties", 460 | "core-foundation-sys", 461 | "iana-time-zone-haiku", 462 | "js-sys", 463 | "wasm-bindgen", 464 | "windows", 465 | ] 466 | 467 | [[package]] 468 | name = "iana-time-zone-haiku" 469 | version = "0.1.2" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" 472 | dependencies = [ 473 | "cc", 474 | ] 475 | 476 | [[package]] 477 | name = "impl-codec" 478 | version = "0.5.1" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443" 481 | dependencies = [ 482 | "parity-scale-codec", 483 | ] 484 | 485 | [[package]] 486 | name = "impl-trait-for-tuples" 487 | version = "0.2.2" 488 | source = "registry+https://github.com/rust-lang/crates.io-index" 489 | checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" 490 | dependencies = [ 491 | "proc-macro2", 492 | "quote", 493 | "syn 1.0.109", 494 | ] 495 | 496 | [[package]] 497 | name = "indexmap" 498 | version = "1.9.3" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 501 | dependencies = [ 502 | "autocfg", 503 | "hashbrown 0.12.3", 504 | ] 505 | 506 | [[package]] 507 | name = "itoa" 508 | version = "1.0.6" 509 | source = "registry+https://github.com/rust-lang/crates.io-index" 510 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" 511 | 512 | [[package]] 513 | name = "js-sys" 514 | version = "0.3.64" 515 | source = "registry+https://github.com/rust-lang/crates.io-index" 516 | checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" 517 | dependencies = [ 518 | "wasm-bindgen", 519 | ] 520 | 521 | [[package]] 522 | name = "keccak" 523 | version = "0.1.4" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" 526 | dependencies = [ 527 | "cpufeatures", 528 | ] 529 | 530 | [[package]] 531 | name = "lazy_static" 532 | version = "1.4.0" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 535 | dependencies = [ 536 | "spin", 537 | ] 538 | 539 | [[package]] 540 | name = "libc" 541 | version = "0.2.146" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" 544 | 545 | [[package]] 546 | name = "log" 547 | version = "0.4.19" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" 550 | 551 | [[package]] 552 | name = "memchr" 553 | version = "2.5.0" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 556 | 557 | [[package]] 558 | name = "memory_units" 559 | version = "0.4.0" 560 | source = "registry+https://github.com/rust-lang/crates.io-index" 561 | checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" 562 | 563 | [[package]] 564 | name = "near-abi" 565 | version = "0.3.0" 566 | source = "registry+https://github.com/rust-lang/crates.io-index" 567 | checksum = "885db39b08518fa700b73fa2214e8adbbfba316ba82dd510f50519173eadaf73" 568 | dependencies = [ 569 | "borsh", 570 | "schemars", 571 | "semver", 572 | "serde", 573 | ] 574 | 575 | [[package]] 576 | name = "near-account-id" 577 | version = "0.14.0" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | checksum = "71d258582a1878e6db67400b0504a5099db85718d22c2e07f747fe1706ae7150" 580 | dependencies = [ 581 | "borsh", 582 | "serde", 583 | ] 584 | 585 | [[package]] 586 | name = "near-crypto" 587 | version = "0.14.0" 588 | source = "registry+https://github.com/rust-lang/crates.io-index" 589 | checksum = "1e75673d69fd7365508f3d32483669fe45b03bfb34e4d9363e90adae9dfb416c" 590 | dependencies = [ 591 | "arrayref", 592 | "blake2", 593 | "borsh", 594 | "bs58", 595 | "c2-chacha", 596 | "curve25519-dalek", 597 | "derive_more", 598 | "ed25519-dalek", 599 | "near-account-id", 600 | "once_cell", 601 | "parity-secp256k1", 602 | "primitive-types", 603 | "rand 0.7.3", 604 | "rand_core 0.5.1", 605 | "serde", 606 | "serde_json", 607 | "subtle", 608 | "thiserror", 609 | ] 610 | 611 | [[package]] 612 | name = "near-primitives" 613 | version = "0.14.0" 614 | source = "registry+https://github.com/rust-lang/crates.io-index" 615 | checksum = "8ad1a9a1640539c81f065425c31bffcfbf6b31ef1aeaade59ce905f5df6ac860" 616 | dependencies = [ 617 | "borsh", 618 | "byteorder", 619 | "bytesize", 620 | "chrono", 621 | "derive_more", 622 | "easy-ext", 623 | "hex", 624 | "near-crypto", 625 | "near-primitives-core", 626 | "near-rpc-error-macro", 627 | "near-vm-errors", 628 | "num-rational", 629 | "once_cell", 630 | "primitive-types", 631 | "rand 0.7.3", 632 | "reed-solomon-erasure", 633 | "serde", 634 | "serde_json", 635 | "smart-default", 636 | "strum", 637 | "thiserror", 638 | ] 639 | 640 | [[package]] 641 | name = "near-primitives-core" 642 | version = "0.14.0" 643 | source = "registry+https://github.com/rust-lang/crates.io-index" 644 | checksum = "91d508f0fc340f6461e4e256417685720d3c4c00bb5a939b105160e49137caba" 645 | dependencies = [ 646 | "base64 0.11.0", 647 | "borsh", 648 | "bs58", 649 | "derive_more", 650 | "near-account-id", 651 | "num-rational", 652 | "serde", 653 | "sha2 0.10.7", 654 | "strum", 655 | ] 656 | 657 | [[package]] 658 | name = "near-rpc-error-core" 659 | version = "0.14.0" 660 | source = "registry+https://github.com/rust-lang/crates.io-index" 661 | checksum = "93ee0b41c75ef859c193a8ff1dadfa0c8207bc0ac447cc22259721ad769a1408" 662 | dependencies = [ 663 | "quote", 664 | "serde", 665 | "syn 1.0.109", 666 | ] 667 | 668 | [[package]] 669 | name = "near-rpc-error-macro" 670 | version = "0.14.0" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "8e837bd4bacd807073ec5ceb85708da7f721b46a4c2a978de86027fb0034ce31" 673 | dependencies = [ 674 | "near-rpc-error-core", 675 | "serde", 676 | "syn 1.0.109", 677 | ] 678 | 679 | [[package]] 680 | name = "near-sdk" 681 | version = "4.1.1" 682 | source = "registry+https://github.com/rust-lang/crates.io-index" 683 | checksum = "15eb3de2defe3626260cc209a6cdb985c6b27b0bd4619fad97dcfae002c3c5bd" 684 | dependencies = [ 685 | "base64 0.13.1", 686 | "borsh", 687 | "bs58", 688 | "near-abi", 689 | "near-crypto", 690 | "near-primitives", 691 | "near-primitives-core", 692 | "near-sdk-macros", 693 | "near-sys", 694 | "near-vm-logic", 695 | "once_cell", 696 | "schemars", 697 | "serde", 698 | "serde_json", 699 | "wee_alloc", 700 | ] 701 | 702 | [[package]] 703 | name = "near-sdk-macros" 704 | version = "4.1.1" 705 | source = "registry+https://github.com/rust-lang/crates.io-index" 706 | checksum = "4907affc9f5ed559456509188ff0024f1f2099c0830e6bdb66eb61d5b75912c0" 707 | dependencies = [ 708 | "Inflector", 709 | "proc-macro2", 710 | "quote", 711 | "syn 1.0.109", 712 | ] 713 | 714 | [[package]] 715 | name = "near-sys" 716 | version = "0.2.0" 717 | source = "registry+https://github.com/rust-lang/crates.io-index" 718 | checksum = "e307313276eaeced2ca95740b5639e1f3125b7c97f0a1151809d105f1aa8c6d3" 719 | 720 | [[package]] 721 | name = "near-vm-errors" 722 | version = "0.14.0" 723 | source = "registry+https://github.com/rust-lang/crates.io-index" 724 | checksum = "d0da466a30f0446639cbd788c30865086fac3e8dcb07a79e51d2b0775ed4261e" 725 | dependencies = [ 726 | "borsh", 727 | "near-account-id", 728 | "near-rpc-error-macro", 729 | "serde", 730 | ] 731 | 732 | [[package]] 733 | name = "near-vm-logic" 734 | version = "0.14.0" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "81b534828419bacbf1f7b11ef7b00420f248c548c485d3f0cfda8bb6931152f2" 737 | dependencies = [ 738 | "base64 0.13.1", 739 | "borsh", 740 | "bs58", 741 | "byteorder", 742 | "near-account-id", 743 | "near-crypto", 744 | "near-primitives", 745 | "near-primitives-core", 746 | "near-vm-errors", 747 | "ripemd", 748 | "serde", 749 | "sha2 0.10.7", 750 | "sha3", 751 | "zeropool-bn", 752 | ] 753 | 754 | [[package]] 755 | name = "num-bigint" 756 | version = "0.3.3" 757 | source = "registry+https://github.com/rust-lang/crates.io-index" 758 | checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" 759 | dependencies = [ 760 | "autocfg", 761 | "num-integer", 762 | "num-traits", 763 | ] 764 | 765 | [[package]] 766 | name = "num-integer" 767 | version = "0.1.45" 768 | source = "registry+https://github.com/rust-lang/crates.io-index" 769 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 770 | dependencies = [ 771 | "autocfg", 772 | "num-traits", 773 | ] 774 | 775 | [[package]] 776 | name = "num-rational" 777 | version = "0.3.2" 778 | source = "registry+https://github.com/rust-lang/crates.io-index" 779 | checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" 780 | dependencies = [ 781 | "autocfg", 782 | "num-bigint", 783 | "num-integer", 784 | "num-traits", 785 | "serde", 786 | ] 787 | 788 | [[package]] 789 | name = "num-traits" 790 | version = "0.2.15" 791 | source = "registry+https://github.com/rust-lang/crates.io-index" 792 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 793 | dependencies = [ 794 | "autocfg", 795 | ] 796 | 797 | [[package]] 798 | name = "once_cell" 799 | version = "1.18.0" 800 | source = "registry+https://github.com/rust-lang/crates.io-index" 801 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 802 | 803 | [[package]] 804 | name = "opaque-debug" 805 | version = "0.3.0" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 808 | 809 | [[package]] 810 | name = "parity-scale-codec" 811 | version = "2.3.1" 812 | source = "registry+https://github.com/rust-lang/crates.io-index" 813 | checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909" 814 | dependencies = [ 815 | "arrayvec 0.7.4", 816 | "bitvec", 817 | "byte-slice-cast", 818 | "impl-trait-for-tuples", 819 | "parity-scale-codec-derive", 820 | "serde", 821 | ] 822 | 823 | [[package]] 824 | name = "parity-scale-codec-derive" 825 | version = "2.3.1" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" 828 | dependencies = [ 829 | "proc-macro-crate 1.3.1", 830 | "proc-macro2", 831 | "quote", 832 | "syn 1.0.109", 833 | ] 834 | 835 | [[package]] 836 | name = "parity-secp256k1" 837 | version = "0.7.0" 838 | source = "git+https://github.com/paritytech/rust-secp256k1.git#d05fd8e152f8d110b587906e3d854196b086e42a" 839 | dependencies = [ 840 | "arrayvec 0.5.2", 841 | "cc", 842 | "cfg-if 0.1.10", 843 | "rand 0.7.3", 844 | ] 845 | 846 | [[package]] 847 | name = "ppv-lite86" 848 | version = "0.2.17" 849 | source = "registry+https://github.com/rust-lang/crates.io-index" 850 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 851 | 852 | [[package]] 853 | name = "primitive-types" 854 | version = "0.10.1" 855 | source = "registry+https://github.com/rust-lang/crates.io-index" 856 | checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" 857 | dependencies = [ 858 | "fixed-hash", 859 | "impl-codec", 860 | "uint", 861 | ] 862 | 863 | [[package]] 864 | name = "proc-macro-crate" 865 | version = "0.1.5" 866 | source = "registry+https://github.com/rust-lang/crates.io-index" 867 | checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" 868 | dependencies = [ 869 | "toml", 870 | ] 871 | 872 | [[package]] 873 | name = "proc-macro-crate" 874 | version = "1.3.1" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" 877 | dependencies = [ 878 | "once_cell", 879 | "toml_edit", 880 | ] 881 | 882 | [[package]] 883 | name = "proc-macro2" 884 | version = "1.0.60" 885 | source = "registry+https://github.com/rust-lang/crates.io-index" 886 | checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" 887 | dependencies = [ 888 | "unicode-ident", 889 | ] 890 | 891 | [[package]] 892 | name = "quote" 893 | version = "1.0.28" 894 | source = "registry+https://github.com/rust-lang/crates.io-index" 895 | checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" 896 | dependencies = [ 897 | "proc-macro2", 898 | ] 899 | 900 | [[package]] 901 | name = "radium" 902 | version = "0.6.2" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" 905 | 906 | [[package]] 907 | name = "rand" 908 | version = "0.7.3" 909 | source = "registry+https://github.com/rust-lang/crates.io-index" 910 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" 911 | dependencies = [ 912 | "getrandom 0.1.16", 913 | "libc", 914 | "rand_chacha 0.2.2", 915 | "rand_core 0.5.1", 916 | "rand_hc", 917 | ] 918 | 919 | [[package]] 920 | name = "rand" 921 | version = "0.8.5" 922 | source = "registry+https://github.com/rust-lang/crates.io-index" 923 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 924 | dependencies = [ 925 | "libc", 926 | "rand_chacha 0.3.1", 927 | "rand_core 0.6.4", 928 | ] 929 | 930 | [[package]] 931 | name = "rand_chacha" 932 | version = "0.2.2" 933 | source = "registry+https://github.com/rust-lang/crates.io-index" 934 | checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" 935 | dependencies = [ 936 | "ppv-lite86", 937 | "rand_core 0.5.1", 938 | ] 939 | 940 | [[package]] 941 | name = "rand_chacha" 942 | version = "0.3.1" 943 | source = "registry+https://github.com/rust-lang/crates.io-index" 944 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 945 | dependencies = [ 946 | "ppv-lite86", 947 | "rand_core 0.6.4", 948 | ] 949 | 950 | [[package]] 951 | name = "rand_core" 952 | version = "0.5.1" 953 | source = "registry+https://github.com/rust-lang/crates.io-index" 954 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 955 | dependencies = [ 956 | "getrandom 0.1.16", 957 | ] 958 | 959 | [[package]] 960 | name = "rand_core" 961 | version = "0.6.4" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 964 | dependencies = [ 965 | "getrandom 0.2.10", 966 | ] 967 | 968 | [[package]] 969 | name = "rand_hc" 970 | version = "0.2.0" 971 | source = "registry+https://github.com/rust-lang/crates.io-index" 972 | checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 973 | dependencies = [ 974 | "rand_core 0.5.1", 975 | ] 976 | 977 | [[package]] 978 | name = "reed-solomon-erasure" 979 | version = "4.0.2" 980 | source = "registry+https://github.com/rust-lang/crates.io-index" 981 | checksum = "a415a013dd7c5d4221382329a5a3482566da675737494935cbbbcdec04662f9d" 982 | dependencies = [ 983 | "smallvec", 984 | ] 985 | 986 | [[package]] 987 | name = "ripemd" 988 | version = "0.1.3" 989 | source = "registry+https://github.com/rust-lang/crates.io-index" 990 | checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" 991 | dependencies = [ 992 | "digest 0.10.7", 993 | ] 994 | 995 | [[package]] 996 | name = "rustc-hex" 997 | version = "2.1.0" 998 | source = "registry+https://github.com/rust-lang/crates.io-index" 999 | checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" 1000 | 1001 | [[package]] 1002 | name = "rustc_version" 1003 | version = "0.4.0" 1004 | source = "registry+https://github.com/rust-lang/crates.io-index" 1005 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 1006 | dependencies = [ 1007 | "semver", 1008 | ] 1009 | 1010 | [[package]] 1011 | name = "rustversion" 1012 | version = "1.0.12" 1013 | source = "registry+https://github.com/rust-lang/crates.io-index" 1014 | checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" 1015 | 1016 | [[package]] 1017 | name = "ryu" 1018 | version = "1.0.13" 1019 | source = "registry+https://github.com/rust-lang/crates.io-index" 1020 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 1021 | 1022 | [[package]] 1023 | name = "schemars" 1024 | version = "0.8.12" 1025 | source = "registry+https://github.com/rust-lang/crates.io-index" 1026 | checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" 1027 | dependencies = [ 1028 | "dyn-clone", 1029 | "schemars_derive", 1030 | "serde", 1031 | "serde_json", 1032 | ] 1033 | 1034 | [[package]] 1035 | name = "schemars_derive" 1036 | version = "0.8.12" 1037 | source = "registry+https://github.com/rust-lang/crates.io-index" 1038 | checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" 1039 | dependencies = [ 1040 | "proc-macro2", 1041 | "quote", 1042 | "serde_derive_internals", 1043 | "syn 1.0.109", 1044 | ] 1045 | 1046 | [[package]] 1047 | name = "semver" 1048 | version = "1.0.17" 1049 | source = "registry+https://github.com/rust-lang/crates.io-index" 1050 | checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" 1051 | 1052 | [[package]] 1053 | name = "serde" 1054 | version = "1.0.164" 1055 | source = "registry+https://github.com/rust-lang/crates.io-index" 1056 | checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" 1057 | dependencies = [ 1058 | "serde_derive", 1059 | ] 1060 | 1061 | [[package]] 1062 | name = "serde_derive" 1063 | version = "1.0.164" 1064 | source = "registry+https://github.com/rust-lang/crates.io-index" 1065 | checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" 1066 | dependencies = [ 1067 | "proc-macro2", 1068 | "quote", 1069 | "syn 2.0.18", 1070 | ] 1071 | 1072 | [[package]] 1073 | name = "serde_derive_internals" 1074 | version = "0.26.0" 1075 | source = "registry+https://github.com/rust-lang/crates.io-index" 1076 | checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" 1077 | dependencies = [ 1078 | "proc-macro2", 1079 | "quote", 1080 | "syn 1.0.109", 1081 | ] 1082 | 1083 | [[package]] 1084 | name = "serde_json" 1085 | version = "1.0.97" 1086 | source = "registry+https://github.com/rust-lang/crates.io-index" 1087 | checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" 1088 | dependencies = [ 1089 | "itoa", 1090 | "ryu", 1091 | "serde", 1092 | ] 1093 | 1094 | [[package]] 1095 | name = "sha2" 1096 | version = "0.9.9" 1097 | source = "registry+https://github.com/rust-lang/crates.io-index" 1098 | checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" 1099 | dependencies = [ 1100 | "block-buffer 0.9.0", 1101 | "cfg-if 1.0.0", 1102 | "cpufeatures", 1103 | "digest 0.9.0", 1104 | "opaque-debug", 1105 | ] 1106 | 1107 | [[package]] 1108 | name = "sha2" 1109 | version = "0.10.7" 1110 | source = "registry+https://github.com/rust-lang/crates.io-index" 1111 | checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" 1112 | dependencies = [ 1113 | "cfg-if 1.0.0", 1114 | "cpufeatures", 1115 | "digest 0.10.7", 1116 | ] 1117 | 1118 | [[package]] 1119 | name = "sha3" 1120 | version = "0.10.8" 1121 | source = "registry+https://github.com/rust-lang/crates.io-index" 1122 | checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" 1123 | dependencies = [ 1124 | "digest 0.10.7", 1125 | "keccak", 1126 | ] 1127 | 1128 | [[package]] 1129 | name = "signature" 1130 | version = "1.6.4" 1131 | source = "registry+https://github.com/rust-lang/crates.io-index" 1132 | checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" 1133 | 1134 | [[package]] 1135 | name = "smallvec" 1136 | version = "1.10.0" 1137 | source = "registry+https://github.com/rust-lang/crates.io-index" 1138 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 1139 | 1140 | [[package]] 1141 | name = "smart-default" 1142 | version = "0.6.0" 1143 | source = "registry+https://github.com/rust-lang/crates.io-index" 1144 | checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" 1145 | dependencies = [ 1146 | "proc-macro2", 1147 | "quote", 1148 | "syn 1.0.109", 1149 | ] 1150 | 1151 | [[package]] 1152 | name = "spin" 1153 | version = "0.5.2" 1154 | source = "registry+https://github.com/rust-lang/crates.io-index" 1155 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 1156 | 1157 | [[package]] 1158 | name = "static_assertions" 1159 | version = "1.1.0" 1160 | source = "registry+https://github.com/rust-lang/crates.io-index" 1161 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1162 | 1163 | [[package]] 1164 | name = "strum" 1165 | version = "0.24.1" 1166 | source = "registry+https://github.com/rust-lang/crates.io-index" 1167 | checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" 1168 | dependencies = [ 1169 | "strum_macros", 1170 | ] 1171 | 1172 | [[package]] 1173 | name = "strum_macros" 1174 | version = "0.24.3" 1175 | source = "registry+https://github.com/rust-lang/crates.io-index" 1176 | checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" 1177 | dependencies = [ 1178 | "heck", 1179 | "proc-macro2", 1180 | "quote", 1181 | "rustversion", 1182 | "syn 1.0.109", 1183 | ] 1184 | 1185 | [[package]] 1186 | name = "subtle" 1187 | version = "2.5.0" 1188 | source = "registry+https://github.com/rust-lang/crates.io-index" 1189 | checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" 1190 | 1191 | [[package]] 1192 | name = "syn" 1193 | version = "1.0.109" 1194 | source = "registry+https://github.com/rust-lang/crates.io-index" 1195 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1196 | dependencies = [ 1197 | "proc-macro2", 1198 | "quote", 1199 | "unicode-ident", 1200 | ] 1201 | 1202 | [[package]] 1203 | name = "syn" 1204 | version = "2.0.18" 1205 | source = "registry+https://github.com/rust-lang/crates.io-index" 1206 | checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" 1207 | dependencies = [ 1208 | "proc-macro2", 1209 | "quote", 1210 | "unicode-ident", 1211 | ] 1212 | 1213 | [[package]] 1214 | name = "tap" 1215 | version = "1.0.1" 1216 | source = "registry+https://github.com/rust-lang/crates.io-index" 1217 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" 1218 | 1219 | [[package]] 1220 | name = "thiserror" 1221 | version = "1.0.40" 1222 | source = "registry+https://github.com/rust-lang/crates.io-index" 1223 | checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" 1224 | dependencies = [ 1225 | "thiserror-impl", 1226 | ] 1227 | 1228 | [[package]] 1229 | name = "thiserror-impl" 1230 | version = "1.0.40" 1231 | source = "registry+https://github.com/rust-lang/crates.io-index" 1232 | checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" 1233 | dependencies = [ 1234 | "proc-macro2", 1235 | "quote", 1236 | "syn 2.0.18", 1237 | ] 1238 | 1239 | [[package]] 1240 | name = "time" 1241 | version = "0.1.45" 1242 | source = "registry+https://github.com/rust-lang/crates.io-index" 1243 | checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" 1244 | dependencies = [ 1245 | "libc", 1246 | "wasi 0.10.0+wasi-snapshot-preview1", 1247 | "winapi", 1248 | ] 1249 | 1250 | [[package]] 1251 | name = "toml" 1252 | version = "0.5.11" 1253 | source = "registry+https://github.com/rust-lang/crates.io-index" 1254 | checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" 1255 | dependencies = [ 1256 | "serde", 1257 | ] 1258 | 1259 | [[package]] 1260 | name = "toml_datetime" 1261 | version = "0.6.2" 1262 | source = "registry+https://github.com/rust-lang/crates.io-index" 1263 | checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" 1264 | 1265 | [[package]] 1266 | name = "toml_edit" 1267 | version = "0.19.10" 1268 | source = "registry+https://github.com/rust-lang/crates.io-index" 1269 | checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" 1270 | dependencies = [ 1271 | "indexmap", 1272 | "toml_datetime", 1273 | "winnow", 1274 | ] 1275 | 1276 | [[package]] 1277 | name = "typenum" 1278 | version = "1.16.0" 1279 | source = "registry+https://github.com/rust-lang/crates.io-index" 1280 | checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" 1281 | 1282 | [[package]] 1283 | name = "uint" 1284 | version = "0.9.5" 1285 | source = "registry+https://github.com/rust-lang/crates.io-index" 1286 | checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" 1287 | dependencies = [ 1288 | "byteorder", 1289 | "crunchy", 1290 | "hex", 1291 | "static_assertions", 1292 | ] 1293 | 1294 | [[package]] 1295 | name = "unicode-ident" 1296 | version = "1.0.9" 1297 | source = "registry+https://github.com/rust-lang/crates.io-index" 1298 | checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" 1299 | 1300 | [[package]] 1301 | name = "version_check" 1302 | version = "0.9.4" 1303 | source = "registry+https://github.com/rust-lang/crates.io-index" 1304 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1305 | 1306 | [[package]] 1307 | name = "wasi" 1308 | version = "0.9.0+wasi-snapshot-preview1" 1309 | source = "registry+https://github.com/rust-lang/crates.io-index" 1310 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 1311 | 1312 | [[package]] 1313 | name = "wasi" 1314 | version = "0.10.0+wasi-snapshot-preview1" 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" 1316 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 1317 | 1318 | [[package]] 1319 | name = "wasi" 1320 | version = "0.11.0+wasi-snapshot-preview1" 1321 | source = "registry+https://github.com/rust-lang/crates.io-index" 1322 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1323 | 1324 | [[package]] 1325 | name = "wasm-bindgen" 1326 | version = "0.2.87" 1327 | source = "registry+https://github.com/rust-lang/crates.io-index" 1328 | checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" 1329 | dependencies = [ 1330 | "cfg-if 1.0.0", 1331 | "wasm-bindgen-macro", 1332 | ] 1333 | 1334 | [[package]] 1335 | name = "wasm-bindgen-backend" 1336 | version = "0.2.87" 1337 | source = "registry+https://github.com/rust-lang/crates.io-index" 1338 | checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" 1339 | dependencies = [ 1340 | "bumpalo", 1341 | "log", 1342 | "once_cell", 1343 | "proc-macro2", 1344 | "quote", 1345 | "syn 2.0.18", 1346 | "wasm-bindgen-shared", 1347 | ] 1348 | 1349 | [[package]] 1350 | name = "wasm-bindgen-macro" 1351 | version = "0.2.87" 1352 | source = "registry+https://github.com/rust-lang/crates.io-index" 1353 | checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" 1354 | dependencies = [ 1355 | "quote", 1356 | "wasm-bindgen-macro-support", 1357 | ] 1358 | 1359 | [[package]] 1360 | name = "wasm-bindgen-macro-support" 1361 | version = "0.2.87" 1362 | source = "registry+https://github.com/rust-lang/crates.io-index" 1363 | checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" 1364 | dependencies = [ 1365 | "proc-macro2", 1366 | "quote", 1367 | "syn 2.0.18", 1368 | "wasm-bindgen-backend", 1369 | "wasm-bindgen-shared", 1370 | ] 1371 | 1372 | [[package]] 1373 | name = "wasm-bindgen-shared" 1374 | version = "0.2.87" 1375 | source = "registry+https://github.com/rust-lang/crates.io-index" 1376 | checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" 1377 | 1378 | [[package]] 1379 | name = "wee_alloc" 1380 | version = "0.4.5" 1381 | source = "registry+https://github.com/rust-lang/crates.io-index" 1382 | checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" 1383 | dependencies = [ 1384 | "cfg-if 0.1.10", 1385 | "libc", 1386 | "memory_units", 1387 | "winapi", 1388 | ] 1389 | 1390 | [[package]] 1391 | name = "winapi" 1392 | version = "0.3.9" 1393 | source = "registry+https://github.com/rust-lang/crates.io-index" 1394 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1395 | dependencies = [ 1396 | "winapi-i686-pc-windows-gnu", 1397 | "winapi-x86_64-pc-windows-gnu", 1398 | ] 1399 | 1400 | [[package]] 1401 | name = "winapi-i686-pc-windows-gnu" 1402 | version = "0.4.0" 1403 | source = "registry+https://github.com/rust-lang/crates.io-index" 1404 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1405 | 1406 | [[package]] 1407 | name = "winapi-x86_64-pc-windows-gnu" 1408 | version = "0.4.0" 1409 | source = "registry+https://github.com/rust-lang/crates.io-index" 1410 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1411 | 1412 | [[package]] 1413 | name = "windows" 1414 | version = "0.48.0" 1415 | source = "registry+https://github.com/rust-lang/crates.io-index" 1416 | checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" 1417 | dependencies = [ 1418 | "windows-targets", 1419 | ] 1420 | 1421 | [[package]] 1422 | name = "windows-targets" 1423 | version = "0.48.0" 1424 | source = "registry+https://github.com/rust-lang/crates.io-index" 1425 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 1426 | dependencies = [ 1427 | "windows_aarch64_gnullvm", 1428 | "windows_aarch64_msvc", 1429 | "windows_i686_gnu", 1430 | "windows_i686_msvc", 1431 | "windows_x86_64_gnu", 1432 | "windows_x86_64_gnullvm", 1433 | "windows_x86_64_msvc", 1434 | ] 1435 | 1436 | [[package]] 1437 | name = "windows_aarch64_gnullvm" 1438 | version = "0.48.0" 1439 | source = "registry+https://github.com/rust-lang/crates.io-index" 1440 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1441 | 1442 | [[package]] 1443 | name = "windows_aarch64_msvc" 1444 | version = "0.48.0" 1445 | source = "registry+https://github.com/rust-lang/crates.io-index" 1446 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1447 | 1448 | [[package]] 1449 | name = "windows_i686_gnu" 1450 | version = "0.48.0" 1451 | source = "registry+https://github.com/rust-lang/crates.io-index" 1452 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1453 | 1454 | [[package]] 1455 | name = "windows_i686_msvc" 1456 | version = "0.48.0" 1457 | source = "registry+https://github.com/rust-lang/crates.io-index" 1458 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1459 | 1460 | [[package]] 1461 | name = "windows_x86_64_gnu" 1462 | version = "0.48.0" 1463 | source = "registry+https://github.com/rust-lang/crates.io-index" 1464 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1465 | 1466 | [[package]] 1467 | name = "windows_x86_64_gnullvm" 1468 | version = "0.48.0" 1469 | source = "registry+https://github.com/rust-lang/crates.io-index" 1470 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 1471 | 1472 | [[package]] 1473 | name = "windows_x86_64_msvc" 1474 | version = "0.48.0" 1475 | source = "registry+https://github.com/rust-lang/crates.io-index" 1476 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 1477 | 1478 | [[package]] 1479 | name = "winnow" 1480 | version = "0.4.7" 1481 | source = "registry+https://github.com/rust-lang/crates.io-index" 1482 | checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" 1483 | dependencies = [ 1484 | "memchr", 1485 | ] 1486 | 1487 | [[package]] 1488 | name = "wyz" 1489 | version = "0.2.0" 1490 | source = "registry+https://github.com/rust-lang/crates.io-index" 1491 | checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" 1492 | 1493 | [[package]] 1494 | name = "zeroize" 1495 | version = "1.3.0" 1496 | source = "registry+https://github.com/rust-lang/crates.io-index" 1497 | checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" 1498 | dependencies = [ 1499 | "zeroize_derive", 1500 | ] 1501 | 1502 | [[package]] 1503 | name = "zeroize_derive" 1504 | version = "1.4.2" 1505 | source = "registry+https://github.com/rust-lang/crates.io-index" 1506 | checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" 1507 | dependencies = [ 1508 | "proc-macro2", 1509 | "quote", 1510 | "syn 2.0.18", 1511 | ] 1512 | 1513 | [[package]] 1514 | name = "zeropool-bn" 1515 | version = "0.5.11" 1516 | source = "registry+https://github.com/rust-lang/crates.io-index" 1517 | checksum = "71e61de68ede9ffdd69c01664f65a178c5188b73f78faa21f0936016a888ff7c" 1518 | dependencies = [ 1519 | "borsh", 1520 | "byteorder", 1521 | "crunchy", 1522 | "lazy_static", 1523 | "rand 0.8.5", 1524 | "rustc-hex", 1525 | ] 1526 | --------------------------------------------------------------------------------