diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml index c9620aeb..2ec9723d 100644 --- a/.github/workflows/testnet.yml +++ b/.github/workflows/testnet.yml @@ -4,17 +4,15 @@ jobs: tests: strategy: matrix: - platform: [ubuntu-latest] - node-version: ['14'] - toolchain: [stable] - runs-on: ${{ matrix.platform }} + set: ['"*/linkdrop/succ*"', "*/link*/fail*"] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: "${{ matrix.toolchain }} with rustfmt, and wasm32" + - name: "stable with rustfmt, and wasm32" uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: ${{ matrix.toolchain }} + toolchain: stable target: wasm32-unknown-unknown - uses: Swatinem/rust-cache@v1 - name: Add wasm32 target @@ -22,6 +20,6 @@ jobs: - name: install node uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node-version }} + node-version: '16' - name: Run tests - run: npm i && npm run test:linkdrop \ No newline at end of file + run: npm i && npm run test:testnet ${{ matrix.set }} \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a2651bc0..40f1280a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest] - node-version: ['14', '16'] + node-version: ['16'] toolchain: [stable] runs-on: ${{ matrix.platform }} steps: diff --git a/__test__/allowance.ava.ts b/__test__/allowance.ava.ts index 8d834bbb..69ee9d2f 100644 --- a/__test__/allowance.ava.ts +++ b/__test__/allowance.ava.ts @@ -1,4 +1,4 @@ -import { Workspace } from "near-willem-workspaces-ava"; +import { Workspace } from "near-workspaces-ava"; import { NEAR } from "near-units"; import { DEFAULT_SALE, diff --git a/__test__/linkdrop/linkdrop-fail.ava.ts b/__test__/linkdrop/fail.ava.ts similarity index 98% rename from __test__/linkdrop/linkdrop-fail.ava.ts rename to __test__/linkdrop/fail.ava.ts index fb1204d4..61b94883 100644 --- a/__test__/linkdrop/linkdrop-fail.ava.ts +++ b/__test__/linkdrop/fail.ava.ts @@ -2,10 +2,10 @@ import { Workspace, NearAccount, randomAccountId, -} from "near-willem-workspaces-ava"; +} from "near-workspaces-ava"; import { ava -} from "near-willem-workspaces-ava"; +} from "near-workspaces-ava"; import { NEAR, Gas } from "near-units"; import { readFile } from "fs/promises"; import { diff --git a/__test__/linkdrop/linkdrop-success.ava.ts b/__test__/linkdrop/success.ava.ts similarity index 95% rename from __test__/linkdrop/linkdrop-success.ava.ts rename to __test__/linkdrop/success.ava.ts index 88653914..e1eff13d 100644 --- a/__test__/linkdrop/linkdrop-success.ava.ts +++ b/__test__/linkdrop/success.ava.ts @@ -1,23 +1,12 @@ -import { - Workspace, - NearAccount, - randomAccountId, -} from "near-willem-workspaces-ava"; -import { - ava -} from "near-willem-workspaces-ava"; -import { NEAR, Gas } from "near-units"; +import { Workspace, randomAccountId } from "near-workspaces-ava"; +import { ava } from "near-workspaces-ava"; +import { NEAR } from "near-units"; import { readFile } from "fs/promises"; import { - ActualTestnet, createLinkdrop, getTokens, checkKey, - BalanceDelta, claim, - claim_raw, - // repeat, - // zeroDelta, hasDelta, getDelta, create_account_and_claim, @@ -29,8 +18,6 @@ import { const base_cost = NEAR.parse("1 N"); const min_cost = NEAR.parse("0.01 N"); - - if (Workspace.networkIsTestnet()) { const runner = Workspace.init( { initialBalance: NEAR.parse("15 N").toString() }, @@ -69,7 +56,6 @@ if (Workspace.networkIsTestnet()) { ); }); await delta.isGreaterOrEqual(NEAR.from(0)); - t.log(await delta.toHuman()); const tokens = await getTokens(tenk, alice); t.assert(tokens.length == 1, "should contain only one token"); t.log( @@ -114,8 +100,6 @@ if (Workspace.networkIsTestnet()) { } ); - - // runner.test( // "Spam `claim` to send to non-existent account", // async (t, { root, tenk }) => { @@ -185,7 +169,6 @@ if (Workspace.networkIsTestnet()) { // await new_account.delete(root.accountId); } ); - } else { ava("skipped on sandbox", (t) => t.assert(true)); } diff --git a/__test__/mintbase.ts b/__test__/mintbase.ts index 9d8fbf4d..9f3b9455 100644 --- a/__test__/mintbase.ts +++ b/__test__/mintbase.ts @@ -1,4 +1,4 @@ -import { Workspace, NearAccount, ONE_NEAR } from "near-willem-workspaces-ava"; +import { Workspace, NearAccount, ONE_NEAR } from "near-workspaces-ava"; import { NEAR, Gas } from "near-units"; import { nftTokensForOwner } from "./util"; diff --git a/__test__/nft.ava.ts b/__test__/nft.ava.ts index 47710008..f46b2062 100644 --- a/__test__/nft.ava.ts +++ b/__test__/nft.ava.ts @@ -1,4 +1,4 @@ -import { Workspace, NearAccount } from "near-willem-workspaces-ava"; +import { Workspace, NearAccount } from "near-workspaces-ava"; import { NEAR } from "near-units"; import { costPerToken, @@ -34,20 +34,9 @@ const runner = Workspace.init( } ); -runner.test("can get cost per token", async (t, { root, tenk }) => { +runner.test("can get cost per token", async (t, { tenk }) => { const cost = await costPerToken(tenk, 1); - const storageCost = await tokenStorageCost(tenk); - t.log( - "One token costs " + - cost.toHuman() + - "to buy and " + - storageCost.toHuman() + - " to store" - ); - t.deepEqual(cost.toBigInt(), price.add(storageCost).toBigInt()); - // if (cost.toBigInt() > 0) { - // t.assert(cost.gt(await costPerToken(tenk, 24))); - // } + t.deepEqual(cost.toBigInt(), price.toBigInt()); }); async function assertXTokens(t, root: NearAccount, tenk, num) { diff --git a/__test__/paras.ava.ts b/__test__/paras.ava.ts index 5c9cb4cb..918680f5 100644 --- a/__test__/paras.ava.ts +++ b/__test__/paras.ava.ts @@ -1,4 +1,4 @@ -import { Workspace, NearAccount, ONE_NEAR } from "near-willem-workspaces-ava"; +import { Workspace, NearAccount, ONE_NEAR } from "near-workspaces-ava"; import { NEAR, Gas } from "near-units"; import { nftTokensForOwner, diff --git a/__test__/premint.ava.ts b/__test__/premint.ava.ts index 88dd8ae0..74bf95f8 100644 --- a/__test__/premint.ava.ts +++ b/__test__/premint.ava.ts @@ -1,4 +1,4 @@ -import { ONE_NEAR, Workspace } from "near-willem-workspaces-ava"; +import { ONE_NEAR, Workspace } from "near-workspaces-ava"; import { NEAR } from "near-units"; import { claim, diff --git a/__test__/royalties.ava.ts b/__test__/royalties.ava.ts index ffa81fef..efbdc4f8 100644 --- a/__test__/royalties.ava.ts +++ b/__test__/royalties.ava.ts @@ -1,4 +1,4 @@ -import { Workspace, NearAccount } from "near-willem-workspaces-ava"; +import { Workspace, NearAccount } from "near-workspaces-ava"; import { NEAR } from "near-units"; import { DEFAULT_SALE, deploy, getDelta, mint, now, totalCost } from "./util"; import { Royalties, Sale } from ".."; diff --git a/__test__/start_at_one.ts b/__test__/start_at_one.ts index 97c004ad..91367a6e 100644 --- a/__test__/start_at_one.ts +++ b/__test__/start_at_one.ts @@ -1,4 +1,4 @@ -// import { Workspace, NearAccount } from "near-willem-workspaces-ava"; +// import { Workspace, NearAccount } from "near-workspaces-ava"; // import { NEAR } from "near-units"; // import { // costPerToken, diff --git a/__test__/util/delta.ts b/__test__/util/delta.ts index 3094a6e9..48a2f29f 100644 --- a/__test__/util/delta.ts +++ b/__test__/util/delta.ts @@ -1,4 +1,4 @@ -import { NEAR, NearAccount } from "near-willem-workspaces-ava"; +import { NEAR, NearAccount } from "near-workspaces-ava"; export class NEARDelta { static readonly ZERO_NEAR = NEAR.from(0); diff --git a/__test__/util/index.ts b/__test__/util/index.ts index ddd0a8a4..57a30df3 100644 --- a/__test__/util/index.ts +++ b/__test__/util/index.ts @@ -9,8 +9,8 @@ import { KeyPair, PublicKey, AccountManager, -} from "near-willem-workspaces"; -import { ONE_NEAR, TransactionResult } from "near-willem-workspaces-ava"; +} from "near-workspaces"; +import { ONE_NEAR, TransactionResult } from "near-workspaces-ava"; import { binPath } from "./bin"; import { BalanceDelta, getDelta } from "./delta"; import {Contract} from "../.."; diff --git a/ava.config.cjs b/ava.config.cjs index ae10212c..00763f04 100644 --- a/ava.config.cjs +++ b/ava.config.cjs @@ -1 +1 @@ -module.exports = require("near-willem-workspaces-ava/ava.config.cjs") \ No newline at end of file +module.exports = require("near-workspaces-ava/ava.config.cjs") \ No newline at end of file diff --git a/contracts/tenk/dist/index.d.ts b/contracts/tenk/dist/index.d.ts index 4eaab796..01217ba0 100644 --- a/contracts/tenk/dist/index.d.ts +++ b/contracts/tenk/dist/index.d.ts @@ -7,12 +7,38 @@ export interface ChangeMethodOptions { walletCallbackUrl?: string; } export interface ViewFunctionOptions { - parse?: (response: Uint8Array) => any; - stringify?: (input: any) => any; + parse?: any; + stringify?: any; } -/** 64 bit unsigned integer less than 2^53 -1 */ +/** +* @minimum 0 +* @maximum 18446744073709551615 +* @asType integer +*/ declare type u64 = number; /** +* @minimum 0 +* @maximum 255 +* @asType integer +* */ +declare type u8 = number; +/** +* @minimum 0 +* @maximum 65535 +* @asType integer +* */ +declare type u16 = number; +/** +* @minimum 0 +* @maximum 4294967295 +* @asType integer +* */ +declare type u32 = number; +/** +* @pattern ^[0-9]+$ +*/ +export declare type U128 = string; +/** * StorageUsage is used to count the amount of storage used by a contract. */ export declare type StorageUsage = u64; @@ -32,7 +58,10 @@ export declare type Base64VecU8 = string; * Raw type for duration in nanoseconds */ export declare type Duration = u64; -export declare type U128 = string; +/** +* @pattern ^(([a-z\d]+[\-_])*[a-z\d]+\.)*([a-z\d]+[\-_])*[a-z\d]+$ +*/ +export declare type AccountId = string; /** * Public key in a binary format with base58 string serialization with human-readable curve. * The key types currently supported are `secp256k1` and `ed25519`. @@ -40,7 +69,6 @@ export declare type U128 = string; * Ed25519 public keys accepted are 32 bytes and secp256k1 keys are the uncompressed 64 format. */ export declare type PublicKey = string; -export declare type AccountId = string; /** * Raw type for timestamp in nanoseconds */ @@ -56,7 +84,7 @@ export interface FungibleTokenMetadata { icon?: string; reference?: string; reference_hash?: Base64VecU8; - decimals: number; + decimals: u8; } /** * In this implementation, the Token struct takes two extensions standards (metadata and approval) as optional fields, as they are frequently used in modern NFTs. @@ -105,15 +133,6 @@ export interface NftContractMetadata { reference?: string; reference_hash?: Base64VecU8; } -export interface Sale { - royalties?: Royalties; - initial_royalties?: Royalties; - presale_start?: Duration; - public_sale_start?: Duration; - allowance?: number; - presale_price?: U128; - price: U128; -} /** * Current state of contract */ @@ -121,19 +140,19 @@ export declare enum Status { /** * Not open for any sales */ - Closed = 0, + Closed = "Closed", /** * VIP accounts can mint */ - Presale = 1, + Presale = "Presale", /** * Any account can mint */ - Open = 2, + Open = "Open", /** * No more tokens to be minted */ - SoldOut = 3 + SoldOut = "SoldOut" } export interface InitialMetadata { name: string; @@ -169,14 +188,24 @@ export interface SaleInfo { */ price: U128; } -export declare type BasisPoint = number; +export interface Sale { + royalties?: Royalties; + initial_royalties?: Royalties; + presale_start?: Duration; + public_sale_start?: Duration; + allowance?: u32; + presale_price?: U128; + price: U128; + mint_rate_limit?: u32; +} +export declare type BasisPoint = u16; /** * Information about the current sale from user perspective */ export interface UserSaleInfo { sale_info: SaleInfo; is_vip: boolean; - remaining_allowance?: number; + remaining_allowance?: u32; } /** * Copied from https://github.com/near/NEPs/blob/6170aba1c6f4cd4804e9ad442caeae9dc47e7d44/specs/Standards/NonFungibleToken/Payout.md#reference-level-explanation @@ -202,13 +231,13 @@ export declare class Contract { public_key: PublicKey; }, options?: ViewFunctionOptions): Promise; update_allowance(args: { - allowance: number; + allowance: u32; }, options?: ChangeMethodOptions): Promise; update_allowanceRaw(args: { - allowance: number; + allowance: u32; }, options?: ChangeMethodOptions): Promise; update_allowanceTx(args: { - allowance: number; + allowance: u32; }, options?: ChangeMethodOptions): transactions.Action; whitelisted(args: { account_id: AccountId; @@ -262,13 +291,13 @@ export declare class Contract { price?: U128; }, options?: ChangeMethodOptions): transactions.Action; nft_mint_many(args: { - num: number; + num: u32; }, options?: ChangeMethodOptions): Promise; nft_mint_manyRaw(args: { - num: number; + num: u32; }, options?: ChangeMethodOptions): Promise; nft_mint_manyTx(args: { - num: number; + num: u32; }, options?: ChangeMethodOptions): transactions.Action; update_uri(args: { uri: string; @@ -303,7 +332,7 @@ export declare class Contract { nft_payout(args: { token_id: string; balance: U128; - max_len_payout?: number; + max_len_payout?: u32; }, options?: ViewFunctionOptions): Promise; nft_transfer_payout(args: { receiver_id: AccountId; @@ -311,7 +340,7 @@ export declare class Contract { approval_id?: u64; memo?: string; balance: U128; - max_len_payout?: number; + max_len_payout?: u32; }, options?: ChangeMethodOptions): Promise; nft_transfer_payoutRaw(args: { receiver_id: AccountId; @@ -319,7 +348,7 @@ export declare class Contract { approval_id?: u64; memo?: string; balance: U128; - max_len_payout?: number; + max_len_payout?: u32; }, options?: ChangeMethodOptions): Promise; nft_transfer_payoutTx(args: { receiver_id: AccountId; @@ -327,7 +356,7 @@ export declare class Contract { approval_id?: u64; memo?: string; balance: U128; - max_len_payout?: number; + max_len_payout?: u32; }, options?: ChangeMethodOptions): transactions.Action; /** * Returns the balance associated with given key. @@ -353,32 +382,32 @@ export declare class Contract { }, options?: ChangeMethodOptions): transactions.Action; add_whitelist_accounts(args: { accounts: AccountId[]; - allowance?: number; + allowance?: u32; }, options?: ChangeMethodOptions): Promise; add_whitelist_accountsRaw(args: { accounts: AccountId[]; - allowance?: number; + allowance?: u32; }, options?: ChangeMethodOptions): Promise; add_whitelist_accountsTx(args: { accounts: AccountId[]; - allowance?: number; + allowance?: u32; }, options?: ChangeMethodOptions): transactions.Action; new(args: { owner_id: AccountId; metadata: NftContractMetadata; - size: number; + size: u32; sale: Sale; }, options?: ChangeMethodOptions): Promise; newRaw(args: { owner_id: AccountId; metadata: NftContractMetadata; - size: number; + size: u32; sale: Sale; }, options?: ChangeMethodOptions): Promise; newTx(args: { owner_id: AccountId; metadata: NftContractMetadata; - size: number; + size: u32; sale: Sale; }, options?: ChangeMethodOptions): transactions.Action; start_presale(args: { @@ -425,26 +454,26 @@ export declare class Contract { minter: AccountId; }, options?: ViewFunctionOptions): Promise; total_cost(args: { - num: number; + num: u32; minter: AccountId; }, options?: ViewFunctionOptions): Promise; get_linkdrop_contract(args?: {}, options?: ViewFunctionOptions): Promise; new_default_meta(args: { owner_id: AccountId; metadata: InitialMetadata; - size: number; + size: u32; sale?: Sale; }, options?: ChangeMethodOptions): Promise; new_default_metaRaw(args: { owner_id: AccountId; metadata: InitialMetadata; - size: number; + size: u32; sale?: Sale; }, options?: ChangeMethodOptions): Promise; new_default_metaTx(args: { owner_id: AccountId; metadata: InitialMetadata; - size: number; + size: u32; sale?: Sale; }, options?: ChangeMethodOptions): transactions.Action; nft_revoke(args: { @@ -460,6 +489,7 @@ export declare class Contract { account_id: AccountId; }, options?: ChangeMethodOptions): transactions.Action; nft_metadata(args?: {}, options?: ViewFunctionOptions): Promise; + mint_rate_limit(args?: {}, options?: ViewFunctionOptions): Promise; nft_is_approved(args: { token_id: TokenId; approved_account_id: AccountId; @@ -467,7 +497,7 @@ export declare class Contract { }, options?: ViewFunctionOptions): Promise; remaining_allowance(args: { account_id: AccountId; - }, options?: ViewFunctionOptions): Promise; + }, options?: ViewFunctionOptions): Promise; nft_mint(args: { token_id: TokenId; token_owner_id: AccountId; @@ -493,17 +523,17 @@ export declare class Contract { }, options?: ViewFunctionOptions): Promise; add_whitelist_account_ungaurded(args: { account_id: AccountId; - allowance: number; + allowance: u32; }, options?: ChangeMethodOptions): Promise; add_whitelist_account_ungaurdedRaw(args: { account_id: AccountId; - allowance: number; + allowance: u32; }, options?: ChangeMethodOptions): Promise; add_whitelist_account_ungaurdedTx(args: { account_id: AccountId; - allowance: number; + allowance: u32; }, options?: ChangeMethodOptions): transactions.Action; - tokens_left(args?: {}, options?: ViewFunctionOptions): Promise; + tokens_left(args?: {}, options?: ViewFunctionOptions): Promise; nft_supply_for_owner(args: { account_id: AccountId; }, options?: ViewFunctionOptions): Promise; @@ -520,4 +550,324 @@ export declare class Contract { nft_mint_oneRaw(args?: {}, options?: ChangeMethodOptions): Promise; nft_mint_oneTx(args?: {}, options?: ChangeMethodOptions): transactions.Action; } +/** +* +* @contractMethod view +*/ +export interface CheckKey { + public_key: PublicKey; +} +/** +* +* @contractMethod change +*/ +export interface UpdateAllowance { + allowance: u32; +} +/** +* +* @contractMethod view +*/ +export interface Whitelisted { + account_id: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface GetSaleInfo { +} +/** +* +* @contractMethod view +*/ +export interface CostPerToken { + minter: AccountId; +} +/** +* +* @contractMethod change +*/ +export interface TransferOwnership { + new_owner: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface NftTotalSupply { +} +/** +* +* @contractMethod view +*/ +export interface NftTokens { + from_index?: U128; + limit?: u64; +} +/** +* +* @contractMethod view +*/ +export interface NftToken { + token_id: TokenId; +} +/** +* +* @contractMethod change +*/ +export interface CloseContract { +} +/** +* +* @contractMethod change +*/ +export interface NftApprove { + token_id: TokenId; + account_id: AccountId; + msg?: string; +} +/** +* +* @contractMethod change +*/ +export interface StartSale { + price?: U128; +} +/** +* +* @contractMethod change +*/ +export interface NftMintMany { + num: u32; +} +/** +* +* @contractMethod change +*/ +export interface UpdateUri { + uri: string; +} +/** +* +* @contractMethod change +*/ +export interface NftTransferCall { + receiver_id: AccountId; + token_id: TokenId; + approval_id?: u64; + memo?: string; + msg: string; +} +/** +* +* @contractMethod view +*/ +export interface NftPayout { + token_id: string; + balance: U128; + max_len_payout?: u32; +} +/** +* +* @contractMethod change +*/ +export interface NftTransferPayout { + receiver_id: AccountId; + token_id: string; + approval_id?: u64; + memo?: string; + balance: U128; + max_len_payout?: u32; +} +/** +* Returns the balance associated with given key. +* +* @contractMethod view +*/ +export interface GetKeyBalance { +} +/** +* Create a pending token that can be claimed with corresponding private key +* +* @contractMethod change +*/ +export interface CreateLinkdrop { + public_key: PublicKey; +} +/** +* +* @contractMethod change +*/ +export interface AddWhitelistAccounts { + accounts: AccountId[]; + allowance?: u32; +} +/** +* +* @contractMethod change +*/ +export interface New { + owner_id: AccountId; + metadata: NftContractMetadata; + size: u32; + sale: Sale; +} +/** +* +* @contractMethod change +*/ +export interface StartPresale { + public_sale_start?: Duration; + presale_price?: U128; +} +/** +* +* @contractMethod view +*/ +export interface TokenStorageCost { +} +/** +* +* @contractMethod change +*/ +export interface NftTransfer { + receiver_id: AccountId; + token_id: TokenId; + approval_id?: u64; + memo?: string; +} +/** +* +* @contractMethod change +*/ +export interface NftRevokeAll { + token_id: TokenId; +} +/** +* +* @contractMethod view +*/ +export interface CostOfLinkdrop { + minter: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface TotalCost { + num: u32; + minter: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface GetLinkdropContract { +} +/** +* +* @contractMethod change +*/ +export interface NewDefaultMeta { + owner_id: AccountId; + metadata: InitialMetadata; + size: u32; + sale?: Sale; +} +/** +* +* @contractMethod change +*/ +export interface NftRevoke { + token_id: TokenId; + account_id: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface NftMetadata { +} +/** +* +* @contractMethod view +*/ +export interface MintRateLimit { +} +/** +* +* @contractMethod view +*/ +export interface NftIsApproved { + token_id: TokenId; + approved_account_id: AccountId; + approval_id?: u64; +} +/** +* +* @contractMethod view +*/ +export interface RemainingAllowance { + account_id: AccountId; +} +/** +* +* @contractMethod change +*/ +export interface NftMint { + token_id: TokenId; + token_owner_id: AccountId; + token_metadata: TokenMetadata; +} +/** +* +* @contractMethod view +*/ +export interface GetUserSaleInfo { + account_id: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface NftTokensForOwner { + account_id: AccountId; + from_index?: U128; + limit?: u64; +} +/** +* +* @contractMethod change +*/ +export interface AddWhitelistAccountUngaurded { + account_id: AccountId; + allowance: u32; +} +/** +* +* @contractMethod view +*/ +export interface TokensLeft { +} +/** +* +* @contractMethod view +*/ +export interface NftSupplyForOwner { + account_id: AccountId; +} +/** +* +* @contractMethod change +*/ +export interface UpdateRoyalties { + royalties: Royalties; +} +/** +* +* @contractMethod change +*/ +export interface NftMintOne { +} export {}; diff --git a/contracts/tenk/dist/index.js b/contracts/tenk/dist/index.js index 34be94ca..461e553c 100644 --- a/contracts/tenk/dist/index.js +++ b/contracts/tenk/dist/index.js @@ -61,19 +61,19 @@ var Status; /** * Not open for any sales */ - Status[Status["Closed"] = 0] = "Closed"; + Status["Closed"] = "Closed"; /** * VIP accounts can mint */ - Status[Status["Presale"] = 1] = "Presale"; + Status["Presale"] = "Presale"; /** * Any account can mint */ - Status[Status["Open"] = 2] = "Open"; + Status["Open"] = "Open"; /** * No more tokens to be minted */ - Status[Status["SoldOut"] = 3] = "SoldOut"; + Status["SoldOut"] = "SoldOut"; })(Status = exports.Status || (exports.Status = {})); var Contract = /** @class */ (function () { function Contract(account, contractId) { @@ -483,6 +483,10 @@ var Contract = /** @class */ (function () { if (args === void 0) { args = {}; } return this.account.viewFunction(this.contractId, "nft_metadata", args, options); }; + Contract.prototype.mint_rate_limit = function (args, options) { + if (args === void 0) { args = {}; } + return this.account.viewFunction(this.contractId, "mint_rate_limit", args, options); + }; Contract.prototype.nft_is_approved = function (args, options) { return this.account.viewFunction(this.contractId, "nft_is_approved", args, options); }; diff --git a/contracts/tenk/index.wit b/contracts/tenk/index.wit index 7b4257bd..cd140860 100644 --- a/contracts/tenk/index.wit +++ b/contracts/tenk/index.wit @@ -1,6 +1,9 @@ // This is a generated file by witgen (https://github.com/bnjjj/witgen), please do not edit yourself, you can generate a new one thanks to cargo witgen generate command. (witme v0.1.0) -// This is a generated file by witgen (https://github.com/bnjjj/witgen), please do not edit yourself, you can generate a new one thanks to cargo witgen generate command. (cargo-witgen v0.0.2) +// This is a generated file by witgen (https://github.com/bnjjj/witgen), please do not edit yourself, you can generate a new one thanks to cargo witgen generate command. (cargo-witgen v0.9.0) + +/// @pattern ^[0-9]+$ +type u128 = string /// StorageUsage is used to count the amount of storage used by a contract. type storage-usage = u64 @@ -17,7 +20,8 @@ type base64-vec-u8 = string /// Raw type for duration in nanoseconds type duration = u64 -type u128 = string +/// @pattern ^(([a-z\d]+[\-_])*[a-z\d]+\.)*([a-z\d]+[\-_])*[a-z\d]+$ +type account-id = string /// Public key in a binary format with base58 string serialization with human-readable curve. /// The key types currently supported are `secp256k1` and `ed25519`. @@ -25,12 +29,10 @@ type u128 = string /// Ed25519 public keys accepted are 32 bytes and secp256k1 keys are the uncompressed 64 format. type public-key = string -type account-id = string - /// Raw type for timestamp in nanoseconds type timestamp = u64 -// This is a generated file by witgen (https://github.com/bnjjj/witgen), please do not edit yourself, you can generate a new one thanks to cargo witgen generate command. (cargo-witgen v0.0.2) +// This is a generated file by witgen (https://github.com/bnjjj/witgen), please do not edit yourself, you can generate a new one thanks to cargo witgen generate command. (cargo-witgen v0.9.0) record storage-balance-bounds { min: u128, @@ -104,16 +106,6 @@ whitelisted: function(account-id: account-id) -> bool get-sale-info: function() -> sale-info -record sale { - royalties: option, - initial-royalties: option, - presale-start: option, - public-sale-start: option, - allowance: option, - presale-price: option, - price: u128 -} - cost-per-token: function(minter: account-id) -> u128 @@ -232,9 +224,23 @@ new-default-meta: function(owner-id: account-id, metadata: initial-metadata, siz /// change nft-revoke: function(token-id: token-id, account-id: account-id) +record sale { + royalties: option, + initial-royalties: option, + presale-start: option, + public-sale-start: option, + allowance: option, + presale-price: option, + price: u128, + mint-rate-limit: option +} + nft-metadata: function() -> nft-contract-metadata +mint-rate-limit: function() -> option + + nft-is-approved: function(token-id: token-id, approved-account-id: account-id, approval-id: option) -> bool diff --git a/contracts/tenk/schema.json b/contracts/tenk/schema.json new file mode 100644 index 00000000..e2f15736 --- /dev/null +++ b/contracts/tenk/schema.json @@ -0,0 +1,1045 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "AccountId": { + "pattern": "^(([a-z\\d]+[\\-_])*[a-z\\d]+\\.)*([a-z\\d]+[\\-_])*[a-z\\d]+$", + "type": "string" + }, + "AddWhitelistAccountUngaurded": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "account_id": { + "$ref": "#/definitions/AccountId" + }, + "allowance": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "account_id", + "allowance" + ], + "type": "object" + }, + "AddWhitelistAccounts": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "accounts": { + "items": { + "$ref": "#/definitions/AccountId" + }, + "type": "array" + }, + "allowance": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "accounts" + ], + "type": "object" + }, + "Balance": { + "$ref": "#/definitions/U128", + "description": "Balance is a type for storing amounts of tokens, specified in yoctoNEAR." + }, + "Base64VecU8": { + "description": "base64 string.", + "type": "string" + }, + "BasisPoint": { + "maximum": 65535, + "minimum": 0, + "type": "integer" + }, + "ChangeMethodOptions": { + "additionalProperties": false, + "properties": { + "attachedDeposit": { + "additionalProperties": false, + "type": "object" + }, + "gas": { + "additionalProperties": false, + "type": "object" + }, + "walletCallbackUrl": { + "type": "string" + }, + "walletMeta": { + "type": "string" + } + }, + "type": "object" + }, + "CheckKey": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "public_key": { + "$ref": "#/definitions/PublicKey" + } + }, + "required": [ + "public_key" + ], + "type": "object" + }, + "CloseContract": { + "additionalProperties": false, + "contractMethod": "change", + "type": "object" + }, + "CostOfLinkdrop": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "minter": { + "$ref": "#/definitions/AccountId" + } + }, + "required": [ + "minter" + ], + "type": "object" + }, + "CostPerToken": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "minter": { + "$ref": "#/definitions/AccountId" + } + }, + "required": [ + "minter" + ], + "type": "object" + }, + "CreateLinkdrop": { + "additionalProperties": false, + "contractMethod": "change", + "description": "Create a pending token that can be claimed with corresponding private key", + "properties": { + "public_key": { + "$ref": "#/definitions/PublicKey" + } + }, + "required": [ + "public_key" + ], + "type": "object" + }, + "Duration": { + "description": "Raw type for duration in nanoseconds", + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + }, + "FungibleTokenMetadata": { + "additionalProperties": false, + "properties": { + "decimals": { + "maximum": 255, + "minimum": 0, + "type": "integer" + }, + "icon": { + "type": "string" + }, + "name": { + "type": "string" + }, + "reference": { + "type": "string" + }, + "reference_hash": { + "$ref": "#/definitions/Base64VecU8" + }, + "spec": { + "type": "string" + }, + "symbol": { + "type": "string" + } + }, + "required": [ + "spec", + "name", + "symbol", + "decimals" + ], + "type": "object" + }, + "Gas": { + "description": "Represents the amount of NEAR tokens in \"gas units\" which are used to fund transactions.", + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + }, + "GetKeyBalance": { + "additionalProperties": false, + "contractMethod": "view", + "description": "Returns the balance associated with given key.", + "type": "object" + }, + "GetLinkdropContract": { + "additionalProperties": false, + "contractMethod": "view", + "type": "object" + }, + "GetSaleInfo": { + "additionalProperties": false, + "contractMethod": "view", + "type": "object" + }, + "GetUserSaleInfo": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "account_id": { + "$ref": "#/definitions/AccountId" + } + }, + "required": [ + "account_id" + ], + "type": "object" + }, + "InitialMetadata": { + "additionalProperties": false, + "properties": { + "icon": { + "type": "string" + }, + "name": { + "type": "string" + }, + "reference": { + "type": "string" + }, + "reference_hash": { + "$ref": "#/definitions/Base64VecU8" + }, + "spec": { + "type": "string" + }, + "symbol": { + "type": "string" + }, + "uri": { + "type": "string" + } + }, + "required": [ + "name", + "symbol", + "uri" + ], + "type": "object" + }, + "MintRateLimit": { + "additionalProperties": false, + "contractMethod": "view", + "type": "object" + }, + "New": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "metadata": { + "$ref": "#/definitions/NftContractMetadata" + }, + "owner_id": { + "$ref": "#/definitions/AccountId" + }, + "sale": { + "$ref": "#/definitions/Sale" + }, + "size": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "owner_id", + "metadata", + "size", + "sale" + ], + "type": "object" + }, + "NewDefaultMeta": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "metadata": { + "$ref": "#/definitions/InitialMetadata" + }, + "owner_id": { + "$ref": "#/definitions/AccountId" + }, + "sale": { + "$ref": "#/definitions/Sale" + }, + "size": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "owner_id", + "metadata", + "size" + ], + "type": "object" + }, + "NftApprove": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "account_id": { + "$ref": "#/definitions/AccountId" + }, + "msg": { + "type": "string" + }, + "token_id": { + "$ref": "#/definitions/TokenId" + } + }, + "required": [ + "token_id", + "account_id" + ], + "type": "object" + }, + "NftContractMetadata": { + "additionalProperties": false, + "description": "Metadata for the NFT contract itself.", + "properties": { + "base_uri": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "name": { + "type": "string" + }, + "reference": { + "type": "string" + }, + "reference_hash": { + "$ref": "#/definitions/Base64VecU8" + }, + "spec": { + "type": "string" + }, + "symbol": { + "type": "string" + } + }, + "required": [ + "spec", + "name", + "symbol" + ], + "type": "object" + }, + "NftIsApproved": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "approval_id": { + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + }, + "approved_account_id": { + "$ref": "#/definitions/AccountId" + }, + "token_id": { + "$ref": "#/definitions/TokenId" + } + }, + "required": [ + "token_id", + "approved_account_id" + ], + "type": "object" + }, + "NftMetadata": { + "additionalProperties": false, + "contractMethod": "view", + "type": "object" + }, + "NftMint": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "token_id": { + "$ref": "#/definitions/TokenId" + }, + "token_metadata": { + "$ref": "#/definitions/TokenMetadata" + }, + "token_owner_id": { + "$ref": "#/definitions/AccountId" + } + }, + "required": [ + "token_id", + "token_owner_id", + "token_metadata" + ], + "type": "object" + }, + "NftMintMany": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "num": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "num" + ], + "type": "object" + }, + "NftMintOne": { + "additionalProperties": false, + "contractMethod": "change", + "type": "object" + }, + "NftPayout": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "balance": { + "$ref": "#/definitions/U128" + }, + "max_len_payout": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + }, + "token_id": { + "type": "string" + } + }, + "required": [ + "token_id", + "balance" + ], + "type": "object" + }, + "NftRevoke": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "account_id": { + "$ref": "#/definitions/AccountId" + }, + "token_id": { + "$ref": "#/definitions/TokenId" + } + }, + "required": [ + "token_id", + "account_id" + ], + "type": "object" + }, + "NftRevokeAll": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "token_id": { + "$ref": "#/definitions/TokenId" + } + }, + "required": [ + "token_id" + ], + "type": "object" + }, + "NftSupplyForOwner": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "account_id": { + "$ref": "#/definitions/AccountId" + } + }, + "required": [ + "account_id" + ], + "type": "object" + }, + "NftToken": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "token_id": { + "$ref": "#/definitions/TokenId" + } + }, + "required": [ + "token_id" + ], + "type": "object" + }, + "NftTokens": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "from_index": { + "$ref": "#/definitions/U128" + }, + "limit": { + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + } + }, + "type": "object" + }, + "NftTokensForOwner": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "account_id": { + "$ref": "#/definitions/AccountId" + }, + "from_index": { + "$ref": "#/definitions/U128" + }, + "limit": { + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "account_id" + ], + "type": "object" + }, + "NftTotalSupply": { + "additionalProperties": false, + "contractMethod": "view", + "type": "object" + }, + "NftTransfer": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "approval_id": { + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + }, + "memo": { + "type": "string" + }, + "receiver_id": { + "$ref": "#/definitions/AccountId" + }, + "token_id": { + "$ref": "#/definitions/TokenId" + } + }, + "required": [ + "receiver_id", + "token_id" + ], + "type": "object" + }, + "NftTransferCall": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "approval_id": { + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + }, + "memo": { + "type": "string" + }, + "msg": { + "type": "string" + }, + "receiver_id": { + "$ref": "#/definitions/AccountId" + }, + "token_id": { + "$ref": "#/definitions/TokenId" + } + }, + "required": [ + "receiver_id", + "token_id", + "msg" + ], + "type": "object" + }, + "NftTransferPayout": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "approval_id": { + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + }, + "balance": { + "$ref": "#/definitions/U128" + }, + "max_len_payout": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + }, + "memo": { + "type": "string" + }, + "receiver_id": { + "$ref": "#/definitions/AccountId" + }, + "token_id": { + "type": "string" + } + }, + "required": [ + "receiver_id", + "token_id", + "balance" + ], + "type": "object" + }, + "Payout": { + "additionalProperties": false, + "description": "Copied from https://github.com/near/NEPs/blob/6170aba1c6f4cd4804e9ad442caeae9dc47e7d44/specs/Standards/NonFungibleToken/Payout.md#reference-level-explanation A mapping of NEAR accounts to the amount each should be paid out, in the event of a token-sale. The payout mapping MUST be shorter than the maximum length specified by the financial contract obtaining this payout data. Any mapping of length 10 or less MUST be accepted by financial contracts, so 10 is a safe upper limit. This currently deviates from the standard but is in the process of updating to use this type", + "properties": { + "payout": { + "additionalProperties": { + "$ref": "#/definitions/U128" + }, + "type": "object" + } + }, + "required": [ + "payout" + ], + "type": "object" + }, + "PublicKey": { + "description": "Public key in a binary format with base58 string serialization with human-readable curve. The key types currently supported are `secp256k1` and `ed25519`.\n\nEd25519 public keys accepted are 32 bytes and secp256k1 keys are the uncompressed 64 format.", + "type": "string" + }, + "RemainingAllowance": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "account_id": { + "$ref": "#/definitions/AccountId" + } + }, + "required": [ + "account_id" + ], + "type": "object" + }, + "Royalties": { + "additionalProperties": false, + "properties": { + "accounts": { + "additionalProperties": { + "$ref": "#/definitions/BasisPoint" + }, + "type": "object" + }, + "percent": { + "$ref": "#/definitions/BasisPoint" + } + }, + "required": [ + "accounts", + "percent" + ], + "type": "object" + }, + "Sale": { + "additionalProperties": false, + "properties": { + "allowance": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + }, + "initial_royalties": { + "$ref": "#/definitions/Royalties" + }, + "mint_rate_limit": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + }, + "presale_price": { + "$ref": "#/definitions/U128" + }, + "presale_start": { + "$ref": "#/definitions/Duration" + }, + "price": { + "$ref": "#/definitions/U128" + }, + "public_sale_start": { + "$ref": "#/definitions/Duration" + }, + "royalties": { + "$ref": "#/definitions/Royalties" + } + }, + "required": [ + "price" + ], + "type": "object" + }, + "SaleInfo": { + "additionalProperties": false, + "description": "Information about the current sale", + "properties": { + "presale_start": { + "$ref": "#/definitions/Duration", + "description": "Start of the VIP sale" + }, + "price": { + "$ref": "#/definitions/U128", + "description": "Current price for one token" + }, + "sale_start": { + "$ref": "#/definitions/Duration", + "description": "Start of public sale" + }, + "status": { + "$ref": "#/definitions/Status", + "description": "Current state of contract" + }, + "token_final_supply": { + "description": "Total tokens that could be minted", + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "status", + "presale_start", + "sale_start", + "token_final_supply", + "price" + ], + "type": "object" + }, + "StartPresale": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "presale_price": { + "$ref": "#/definitions/U128" + }, + "public_sale_start": { + "$ref": "#/definitions/Duration" + } + }, + "type": "object" + }, + "StartSale": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "price": { + "$ref": "#/definitions/U128" + } + }, + "type": "object" + }, + "Status": { + "description": "Current state of contract", + "enum": [ + "Closed", + "Presale", + "Open", + "SoldOut" + ], + "type": "string" + }, + "StorageBalance": { + "additionalProperties": false, + "properties": { + "available": { + "$ref": "#/definitions/U128" + }, + "total": { + "$ref": "#/definitions/U128" + } + }, + "required": [ + "total", + "available" + ], + "type": "object" + }, + "StorageBalanceBounds": { + "additionalProperties": false, + "properties": { + "max": { + "$ref": "#/definitions/U128" + }, + "min": { + "$ref": "#/definitions/U128" + } + }, + "required": [ + "min" + ], + "type": "object" + }, + "StorageUsage": { + "description": "StorageUsage is used to count the amount of storage used by a contract.", + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + }, + "Timestamp": { + "description": "Raw type for timestamp in nanoseconds", + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + }, + "Token": { + "additionalProperties": false, + "description": "In this implementation, the Token struct takes two extensions standards (metadata and approval) as optional fields, as they are frequently used in modern NFTs.", + "properties": { + "approved_account_ids": { + "additionalProperties": { + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + }, + "type": "object" + }, + "metadata": { + "$ref": "#/definitions/TokenMetadata" + }, + "owner_id": { + "$ref": "#/definitions/AccountId" + }, + "token_id": { + "$ref": "#/definitions/TokenId" + } + }, + "required": [ + "token_id", + "owner_id" + ], + "type": "object" + }, + "TokenId": { + "description": "Note that token IDs for NFTs are strings on NEAR. It's still fine to use autoincrementing numbers as unique IDs if desired, but they should be stringified. This is to make IDs more future-proof as chain-agnostic conventions and standards arise, and allows for more flexibility with considerations like bridging NFTs across chains, etc.", + "type": "string" + }, + "TokenMetadata": { + "additionalProperties": false, + "description": "Metadata on the individual token level.", + "properties": { + "copies": { + "maximum": 18446744073709552000, + "minimum": 0, + "type": "integer" + }, + "description": { + "type": "string" + }, + "expires_at": { + "type": "string" + }, + "extra": { + "type": "string" + }, + "issued_at": { + "type": "string" + }, + "media": { + "type": "string" + }, + "media_hash": { + "$ref": "#/definitions/Base64VecU8" + }, + "reference": { + "type": "string" + }, + "reference_hash": { + "$ref": "#/definitions/Base64VecU8" + }, + "starts_at": { + "type": "string" + }, + "title": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + }, + "type": "object" + }, + "TokenStorageCost": { + "additionalProperties": false, + "contractMethod": "view", + "type": "object" + }, + "TokensLeft": { + "additionalProperties": false, + "contractMethod": "view", + "type": "object" + }, + "TotalCost": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "minter": { + "$ref": "#/definitions/AccountId" + }, + "num": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "num", + "minter" + ], + "type": "object" + }, + "TransferOwnership": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "new_owner": { + "$ref": "#/definitions/AccountId" + } + }, + "required": [ + "new_owner" + ], + "type": "object" + }, + "U128": { + "pattern": "^[0-9]+$", + "type": "string" + }, + "UpdateAllowance": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "allowance": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "allowance" + ], + "type": "object" + }, + "UpdateRoyalties": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "royalties": { + "$ref": "#/definitions/Royalties" + } + }, + "required": [ + "royalties" + ], + "type": "object" + }, + "UpdateUri": { + "additionalProperties": false, + "contractMethod": "change", + "properties": { + "uri": { + "type": "string" + } + }, + "required": [ + "uri" + ], + "type": "object" + }, + "UserSaleInfo": { + "additionalProperties": false, + "description": "Information about the current sale from user perspective", + "properties": { + "is_vip": { + "type": "boolean" + }, + "remaining_allowance": { + "maximum": 4294967295, + "minimum": 0, + "type": "integer" + }, + "sale_info": { + "$ref": "#/definitions/SaleInfo" + } + }, + "required": [ + "sale_info", + "is_vip" + ], + "type": "object" + }, + "ViewFunctionOptions": { + "additionalProperties": false, + "properties": { + "parse": {}, + "stringify": {} + }, + "type": "object" + }, + "Whitelisted": { + "additionalProperties": false, + "contractMethod": "view", + "properties": { + "account_id": { + "$ref": "#/definitions/AccountId" + } + }, + "required": [ + "account_id" + ], + "type": "object" + }, + "WrappedDuration": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/contracts/tenk/src/lib.rs b/contracts/tenk/src/lib.rs index e3cb377f..f739b987 100644 --- a/contracts/tenk/src/lib.rs +++ b/contracts/tenk/src/lib.rs @@ -117,6 +117,7 @@ pub struct Sale { allowance: Option, presale_price: Option, price: U128, + mint_rate_limit: Option, } impl Default for Sale { @@ -130,6 +131,7 @@ impl Default for Sale { public_sale_start: Default::default(), allowance: Default::default(), presale_price: Default::default(), + mint_rate_limit: Default::default(), } } } @@ -285,6 +287,9 @@ impl Contract { #[payable] pub fn nft_mint_many(&mut self, num: u32) -> Vec { + self.sale + .mint_rate_limit + .map(|limit| require!(num <= limit, "over mint limit")); let owner_id = &env::signer_account_id(); let num = self.assert_can_mint(owner_id, num); let tokens = self.nft_mint_many_ungaurded(num, owner_id, false); @@ -327,7 +332,7 @@ impl Contract { } pub fn cost_of_linkdrop(&self, minter: &AccountId) -> U128 { - (self.full_link_price(minter) + self.total_cost(1, minter).0).into() + (self.full_link_price(minter) + self.total_cost(1, minter).0 + self.token_storage_cost().0).into() } pub fn total_cost(&self, num: u32, minter: &AccountId) -> U128 { @@ -335,12 +340,11 @@ impl Contract { } pub fn cost_per_token(&self, minter: &AccountId) -> U128 { - let base_cost = if self.is_owner(minter) { + if self.is_owner(minter) { 0 } else { self.price() - }; - (base_cost + self.token_storage_cost().0).into() + }.into() } pub fn token_storage_cost(&self) -> U128 { @@ -359,6 +363,10 @@ impl Contract { self.whitelist.get(account_id) } + pub fn mint_rate_limit(&self) -> Option { + self.sale.mint_rate_limit + } + // Owner private methods pub fn transfer_ownership(&mut self, new_owner: AccountId) { @@ -511,16 +519,16 @@ impl Contract { let reference = Some(format!("{}.json", token_id)); let title = Some(token_id.to_string()); TokenMetadata { - title, // ex. "Arch Nemesis: Mail Carrier" or "Parcel #5055" + title, // ex. "Arch Nemesis: Mail Carrier" or "Parcel #5055" media, // URL to associated media, preferably to decentralized, content-addressed storage issued_at: Some(env::block_timestamp().to_string()), // ISO 8601 datetime when token was issued or minted - reference, // URL to an off-chain JSON file with more info. - description: None, // free-form description + reference, // URL to an off-chain JSON file with more info. + description: None, // free-form description media_hash: None, // Base64-encoded sha256 hash of content referenced by the `media` field. Required if `media` is included. copies: None, // number of copies of this set of metadata in existence when token was minted. - expires_at: None, // ISO 8601 datetime when token expires - starts_at: None, // ISO 8601 datetime when token starts being valid - updated_at: None, // ISO 8601 datetime when token was last updated + expires_at: None, // ISO 8601 datetime when token expires + starts_at: None, // ISO 8601 datetime when token starts being valid + updated_at: None, // ISO 8601 datetime when token was last updated extra: None, // anything extra the NFT wants to store on-chain. Can be stringified JSON. reference_hash: None, // Base64-encoded sha256 hash of JSON from reference field. Required if `reference` is included. } @@ -677,7 +685,7 @@ mod tests { let contract = new_contract(); assert_eq!( contract.cost_per_token(&account()).0, - TEN + contract.token_storage_cost().0 + TEN ); } } diff --git a/contracts/tenk/ts/index.ts b/contracts/tenk/ts/index.ts index e9d91d47..1f9c5932 100644 --- a/contracts/tenk/ts/index.ts +++ b/contracts/tenk/ts/index.ts @@ -9,14 +9,83 @@ export interface ChangeMethodOptions { walletCallbackUrl?: string; } export interface ViewFunctionOptions { - parse?: (response: Uint8Array) => any; - stringify?: (input: any) => any; + // TODO currently JSON schema generator doesn't like function types + parse?: any; + // TODO currently JSON schema generator doesn't like function types + stringify?: any; } -/** 64 bit unsigned integer less than 2^53 -1 */ +/** +* @minimum 0 +* @maximum 18446744073709551615 +* @asType integer +*/ type u64 = number; -/** 64 bit signed integer less than 2^53 -1 */ +/** +* @minimum -9223372036854775808 +* @maximum 9223372036854775807 +* @asType integer +*/ type i64 = number; + +/** +* @minimum 0 +* @maximum 255 +* @asType integer +* */ +type u8 = number; +/** +* @minimum -128 +* @maximum 127 +* @asType integer +* */ +type i8 = number; +/** +* @minimum 0 +* @maximum 65535 +* @asType integer +* */ +type u16 = number; +/** +* @minimum -32768 +* @maximum 32767 +* @asType integer +* */ +type i16 = number; +/** +* @minimum 0 +* @maximum 4294967295 +* @asType integer +* */ +type u32 = number; +/** +* @minimum 0 +* @maximum 4294967295 +* @asType integer +* */ +type usize = number; +/** +* @minimum -2147483648 +* @maximum 2147483647 +* @asType integer +* */ +type i32 = number; + +/** +* @minimum -3.40282347E+38 +* @maximum 3.40282347E+38 +*/ +type f32 = number; + +/** +* @minimum -1.7976931348623157E+308 +* @maximum 1.7976931348623157E+308 +*/ +type f64 = number; +/** +* @pattern ^[0-9]+$ +*/ +export type U128 = string; /** * StorageUsage is used to count the amount of storage used by a contract. */ @@ -37,7 +106,10 @@ export type Base64VecU8 = string; * Raw type for duration in nanoseconds */ export type Duration = u64; -export type U128 = string; +/** +* @pattern ^(([a-z\d]+[\-_])*[a-z\d]+\.)*([a-z\d]+[\-_])*[a-z\d]+$ +*/ +export type AccountId = string; /** * Public key in a binary format with base58 string serialization with human-readable curve. * The key types currently supported are `secp256k1` and `ed25519`. @@ -45,79 +117,69 @@ export type U128 = string; * Ed25519 public keys accepted are 32 bytes and secp256k1 keys are the uncompressed 64 format. */ export type PublicKey = string; -export type AccountId = string; /** * Raw type for timestamp in nanoseconds */ export type Timestamp = u64; export interface StorageBalanceBounds { - min: U128, - max?: U128, + min: U128; + max?: U128; } export interface FungibleTokenMetadata { - spec: string, - name: string, - symbol: string, - icon?: string, - reference?: string, - reference_hash?: Base64VecU8, - decimals: number, + spec: string; + name: string; + symbol: string; + icon?: string; + reference?: string; + reference_hash?: Base64VecU8; + decimals: u8; } /** * In this implementation, the Token struct takes two extensions standards (metadata and approval) as optional fields, as they are frequently used in modern NFTs. */ export interface Token { - token_id: TokenId, - owner_id: AccountId, - metadata?: TokenMetadata, - approved_account_ids?: Record, + token_id: TokenId; + owner_id: AccountId; + metadata?: TokenMetadata; + approved_account_ids?: Record; } /** * Note that token IDs for NFTs are strings on NEAR. It's still fine to use autoincrementing numbers as unique IDs if desired, but they should be stringified. This is to make IDs more future-proof as chain-agnostic conventions and standards arise, and allows for more flexibility with considerations like bridging NFTs across chains, etc. */ export type TokenId = string; export interface StorageBalance { - total: U128, - available: U128, + total: U128; + available: U128; } export type WrappedDuration = string; /** * Metadata on the individual token level. */ export interface TokenMetadata { - title?: string, - description?: string, - media?: string, - media_hash?: Base64VecU8, - copies?: u64, - issued_at?: string, - expires_at?: string, - starts_at?: string, - updated_at?: string, - extra?: string, - reference?: string, - reference_hash?: Base64VecU8, + title?: string; + description?: string; + media?: string; + media_hash?: Base64VecU8; + copies?: u64; + issued_at?: string; + expires_at?: string; + starts_at?: string; + updated_at?: string; + extra?: string; + reference?: string; + reference_hash?: Base64VecU8; } /** * Metadata for the NFT contract itself. */ export interface NftContractMetadata { - spec: string, - name: string, - symbol: string, - icon?: string, - base_uri?: string, - reference?: string, - reference_hash?: Base64VecU8, -} -export interface Sale { - royalties?: Royalties, - initial_royalties?: Royalties, - presale_start?: Duration, - public_sale_start?: Duration, - allowance?: number, - presale_price?: U128, - price: U128, + spec: string; + name: string; + symbol: string; + icon?: string; + base_uri?: string; + reference?: string; + reference_hash?: Base64VecU8; } /** * Current state of contract @@ -126,28 +188,28 @@ export enum Status { /** * Not open for any sales */ - Closed = 0, + Closed = "Closed", /** * VIP accounts can mint */ - Presale = 1, + Presale = "Presale", /** * Any account can mint */ - Open = 2, + Open = "Open", /** * No more tokens to be minted */ - SoldOut = 3, + SoldOut = "SoldOut", } export interface InitialMetadata { - name: string, - symbol: string, - uri: string, - icon?: string, - spec?: string, - reference?: string, - reference_hash?: Base64VecU8, + name: string; + symbol: string; + uri: string; + icon?: string; + spec?: string; + reference?: string; + reference_hash?: Base64VecU8; } /** * Information about the current sale @@ -156,32 +218,42 @@ export interface SaleInfo { /** * Current state of contract */ - status: Status, + status: Status; /** * Start of the VIP sale */ - presale_start: Duration, + presale_start: Duration; /** * Start of public sale */ - sale_start: Duration, + sale_start: Duration; /** * Total tokens that could be minted */ - token_final_supply: u64, + token_final_supply: u64; /** * Current price for one token */ - price: U128, + price: U128; +} +export interface Sale { + royalties?: Royalties; + initial_royalties?: Royalties; + presale_start?: Duration; + public_sale_start?: Duration; + allowance?: u32; + presale_price?: U128; + price: U128; + mint_rate_limit?: u32; } -export type BasisPoint = number; +export type BasisPoint = u16; /** * Information about the current sale from user perspective */ export interface UserSaleInfo { - sale_info: SaleInfo, - is_vip: boolean, - remaining_allowance?: number, + sale_info: SaleInfo; + is_vip: boolean; + remaining_allowance?: u32; } /** * Copied from https://github.com/near/NEPs/blob/6170aba1c6f4cd4804e9ad442caeae9dc47e7d44/specs/Standards/NonFungibleToken/Payout.md#reference-level-explanation @@ -193,276 +265,839 @@ export interface UserSaleInfo { * This currently deviates from the standard but is in the process of updating to use this type */ export interface Payout { - payout: Record, + payout: Record; } export interface Royalties { - accounts: Record, - percent: BasisPoint, + accounts: Record; + percent: BasisPoint; } export class Contract { constructor(public account: Account, public readonly contractId: string){} - check_key(args: {public_key: PublicKey}, options?: ViewFunctionOptions): Promise { + check_key(args: { + public_key: PublicKey; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "check_key", args, options); } - async update_allowance(args: {allowance: number}, options?: ChangeMethodOptions): Promise { + async update_allowance(args: { + allowance: u32; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.update_allowanceRaw(args, options)); } - update_allowanceRaw(args: {allowance: number}, options?: ChangeMethodOptions): Promise { + update_allowanceRaw(args: { + allowance: u32; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "update_allowance", args, ...options}); } - update_allowanceTx(args: {allowance: number}, options?: ChangeMethodOptions): transactions.Action { + update_allowanceTx(args: { + allowance: u32; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("update_allowance", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - whitelisted(args: {account_id: AccountId}, options?: ViewFunctionOptions): Promise { + whitelisted(args: { + account_id: AccountId; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "whitelisted", args, options); } - get_sale_info(args: {} = {}, options?: ViewFunctionOptions): Promise { + get_sale_info(args: { + } = {}, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "get_sale_info", args, options); } - cost_per_token(args: {minter: AccountId}, options?: ViewFunctionOptions): Promise { + cost_per_token(args: { + minter: AccountId; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "cost_per_token", args, options); } - async transfer_ownership(args: {new_owner: AccountId}, options?: ChangeMethodOptions): Promise { + async transfer_ownership(args: { + new_owner: AccountId; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.transfer_ownershipRaw(args, options)); } - transfer_ownershipRaw(args: {new_owner: AccountId}, options?: ChangeMethodOptions): Promise { + transfer_ownershipRaw(args: { + new_owner: AccountId; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "transfer_ownership", args, ...options}); } - transfer_ownershipTx(args: {new_owner: AccountId}, options?: ChangeMethodOptions): transactions.Action { + transfer_ownershipTx(args: { + new_owner: AccountId; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("transfer_ownership", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - nft_total_supply(args: {} = {}, options?: ViewFunctionOptions): Promise { + nft_total_supply(args: { + } = {}, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "nft_total_supply", args, options); } - nft_tokens(args: {from_index?: U128, limit?: u64}, options?: ViewFunctionOptions): Promise { + nft_tokens(args: { + from_index?: U128; + limit?: u64; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "nft_tokens", args, options); } - nft_token(args: {token_id: TokenId}, options?: ViewFunctionOptions): Promise { + nft_token(args: { + token_id: TokenId; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "nft_token", args, options); } - async close_contract(args: {} = {}, options?: ChangeMethodOptions): Promise { + async close_contract(args: { + } = {}, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.close_contractRaw(args, options)); } - close_contractRaw(args: {} = {}, options?: ChangeMethodOptions): Promise { + close_contractRaw(args: { + } = {}, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "close_contract", args, ...options}); } - close_contractTx(args: {} = {}, options?: ChangeMethodOptions): transactions.Action { + close_contractTx(args: { + } = {}, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("close_contract", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async nft_approve(args: {token_id: TokenId, account_id: AccountId, msg?: string}, options?: ChangeMethodOptions): Promise { + async nft_approve(args: { + token_id: TokenId; + account_id: AccountId; + msg?: string; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.nft_approveRaw(args, options)); } - nft_approveRaw(args: {token_id: TokenId, account_id: AccountId, msg?: string}, options?: ChangeMethodOptions): Promise { + nft_approveRaw(args: { + token_id: TokenId; + account_id: AccountId; + msg?: string; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "nft_approve", args, ...options}); } - nft_approveTx(args: {token_id: TokenId, account_id: AccountId, msg?: string}, options?: ChangeMethodOptions): transactions.Action { + nft_approveTx(args: { + token_id: TokenId; + account_id: AccountId; + msg?: string; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("nft_approve", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async start_sale(args: {price?: U128}, options?: ChangeMethodOptions): Promise { + async start_sale(args: { + price?: U128; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.start_saleRaw(args, options)); } - start_saleRaw(args: {price?: U128}, options?: ChangeMethodOptions): Promise { + start_saleRaw(args: { + price?: U128; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "start_sale", args, ...options}); } - start_saleTx(args: {price?: U128}, options?: ChangeMethodOptions): transactions.Action { + start_saleTx(args: { + price?: U128; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("start_sale", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async nft_mint_many(args: {num: number}, options?: ChangeMethodOptions): Promise { + async nft_mint_many(args: { + num: u32; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.nft_mint_manyRaw(args, options)); } - nft_mint_manyRaw(args: {num: number}, options?: ChangeMethodOptions): Promise { + nft_mint_manyRaw(args: { + num: u32; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "nft_mint_many", args, ...options}); } - nft_mint_manyTx(args: {num: number}, options?: ChangeMethodOptions): transactions.Action { + nft_mint_manyTx(args: { + num: u32; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("nft_mint_many", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async update_uri(args: {uri: string}, options?: ChangeMethodOptions): Promise { + async update_uri(args: { + uri: string; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.update_uriRaw(args, options)); } - update_uriRaw(args: {uri: string}, options?: ChangeMethodOptions): Promise { + update_uriRaw(args: { + uri: string; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "update_uri", args, ...options}); } - update_uriTx(args: {uri: string}, options?: ChangeMethodOptions): transactions.Action { + update_uriTx(args: { + uri: string; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("update_uri", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async nft_transfer_call(args: {receiver_id: AccountId, token_id: TokenId, approval_id?: u64, memo?: string, msg: string}, options?: ChangeMethodOptions): Promise { + async nft_transfer_call(args: { + receiver_id: AccountId; + token_id: TokenId; + approval_id?: u64; + memo?: string; + msg: string; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.nft_transfer_callRaw(args, options)); } - nft_transfer_callRaw(args: {receiver_id: AccountId, token_id: TokenId, approval_id?: u64, memo?: string, msg: string}, options?: ChangeMethodOptions): Promise { + nft_transfer_callRaw(args: { + receiver_id: AccountId; + token_id: TokenId; + approval_id?: u64; + memo?: string; + msg: string; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "nft_transfer_call", args, ...options}); } - nft_transfer_callTx(args: {receiver_id: AccountId, token_id: TokenId, approval_id?: u64, memo?: string, msg: string}, options?: ChangeMethodOptions): transactions.Action { + nft_transfer_callTx(args: { + receiver_id: AccountId; + token_id: TokenId; + approval_id?: u64; + memo?: string; + msg: string; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("nft_transfer_call", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - nft_payout(args: {token_id: string, balance: U128, max_len_payout?: number}, options?: ViewFunctionOptions): Promise { + nft_payout(args: { + token_id: string; + balance: U128; + max_len_payout?: u32; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "nft_payout", args, options); } - async nft_transfer_payout(args: {receiver_id: AccountId, token_id: string, approval_id?: u64, memo?: string, balance: U128, max_len_payout?: number}, options?: ChangeMethodOptions): Promise { + async nft_transfer_payout(args: { + receiver_id: AccountId; + token_id: string; + approval_id?: u64; + memo?: string; + balance: U128; + max_len_payout?: u32; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.nft_transfer_payoutRaw(args, options)); } - nft_transfer_payoutRaw(args: {receiver_id: AccountId, token_id: string, approval_id?: u64, memo?: string, balance: U128, max_len_payout?: number}, options?: ChangeMethodOptions): Promise { + nft_transfer_payoutRaw(args: { + receiver_id: AccountId; + token_id: string; + approval_id?: u64; + memo?: string; + balance: U128; + max_len_payout?: u32; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "nft_transfer_payout", args, ...options}); } - nft_transfer_payoutTx(args: {receiver_id: AccountId, token_id: string, approval_id?: u64, memo?: string, balance: U128, max_len_payout?: number}, options?: ChangeMethodOptions): transactions.Action { + nft_transfer_payoutTx(args: { + receiver_id: AccountId; + token_id: string; + approval_id?: u64; + memo?: string; + balance: U128; + max_len_payout?: u32; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("nft_transfer_payout", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } /** * Returns the balance associated with given key. */ - get_key_balance(args: {} = {}, options?: ViewFunctionOptions): Promise { + get_key_balance(args: { + } = {}, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "get_key_balance", args, options); } /** * Create a pending token that can be claimed with corresponding private key */ - async create_linkdrop(args: {public_key: PublicKey}, options?: ChangeMethodOptions): Promise { + async create_linkdrop(args: { + public_key: PublicKey; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.create_linkdropRaw(args, options)); } /** * Create a pending token that can be claimed with corresponding private key */ - create_linkdropRaw(args: {public_key: PublicKey}, options?: ChangeMethodOptions): Promise { + create_linkdropRaw(args: { + public_key: PublicKey; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "create_linkdrop", args, ...options}); } /** * Create a pending token that can be claimed with corresponding private key */ - create_linkdropTx(args: {public_key: PublicKey}, options?: ChangeMethodOptions): transactions.Action { + create_linkdropTx(args: { + public_key: PublicKey; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("create_linkdrop", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async add_whitelist_accounts(args: {accounts: AccountId[], allowance?: number}, options?: ChangeMethodOptions): Promise { + async add_whitelist_accounts(args: { + accounts: AccountId[]; + allowance?: u32; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.add_whitelist_accountsRaw(args, options)); } - add_whitelist_accountsRaw(args: {accounts: AccountId[], allowance?: number}, options?: ChangeMethodOptions): Promise { + add_whitelist_accountsRaw(args: { + accounts: AccountId[]; + allowance?: u32; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "add_whitelist_accounts", args, ...options}); } - add_whitelist_accountsTx(args: {accounts: AccountId[], allowance?: number}, options?: ChangeMethodOptions): transactions.Action { + add_whitelist_accountsTx(args: { + accounts: AccountId[]; + allowance?: u32; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("add_whitelist_accounts", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async new(args: {owner_id: AccountId, metadata: NftContractMetadata, size: number, sale: Sale}, options?: ChangeMethodOptions): Promise { + async new(args: { + owner_id: AccountId; + metadata: NftContractMetadata; + size: u32; + sale: Sale; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.newRaw(args, options)); } - newRaw(args: {owner_id: AccountId, metadata: NftContractMetadata, size: number, sale: Sale}, options?: ChangeMethodOptions): Promise { + newRaw(args: { + owner_id: AccountId; + metadata: NftContractMetadata; + size: u32; + sale: Sale; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "new", args, ...options}); } - newTx(args: {owner_id: AccountId, metadata: NftContractMetadata, size: number, sale: Sale}, options?: ChangeMethodOptions): transactions.Action { + newTx(args: { + owner_id: AccountId; + metadata: NftContractMetadata; + size: u32; + sale: Sale; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("new", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async start_presale(args: {public_sale_start?: Duration, presale_price?: U128}, options?: ChangeMethodOptions): Promise { + async start_presale(args: { + public_sale_start?: Duration; + presale_price?: U128; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.start_presaleRaw(args, options)); } - start_presaleRaw(args: {public_sale_start?: Duration, presale_price?: U128}, options?: ChangeMethodOptions): Promise { + start_presaleRaw(args: { + public_sale_start?: Duration; + presale_price?: U128; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "start_presale", args, ...options}); } - start_presaleTx(args: {public_sale_start?: Duration, presale_price?: U128}, options?: ChangeMethodOptions): transactions.Action { + start_presaleTx(args: { + public_sale_start?: Duration; + presale_price?: U128; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("start_presale", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - token_storage_cost(args: {} = {}, options?: ViewFunctionOptions): Promise { + token_storage_cost(args: { + } = {}, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "token_storage_cost", args, options); } - async nft_transfer(args: {receiver_id: AccountId, token_id: TokenId, approval_id?: u64, memo?: string}, options?: ChangeMethodOptions): Promise { + async nft_transfer(args: { + receiver_id: AccountId; + token_id: TokenId; + approval_id?: u64; + memo?: string; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.nft_transferRaw(args, options)); } - nft_transferRaw(args: {receiver_id: AccountId, token_id: TokenId, approval_id?: u64, memo?: string}, options?: ChangeMethodOptions): Promise { + nft_transferRaw(args: { + receiver_id: AccountId; + token_id: TokenId; + approval_id?: u64; + memo?: string; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "nft_transfer", args, ...options}); } - nft_transferTx(args: {receiver_id: AccountId, token_id: TokenId, approval_id?: u64, memo?: string}, options?: ChangeMethodOptions): transactions.Action { + nft_transferTx(args: { + receiver_id: AccountId; + token_id: TokenId; + approval_id?: u64; + memo?: string; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("nft_transfer", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async nft_revoke_all(args: {token_id: TokenId}, options?: ChangeMethodOptions): Promise { + async nft_revoke_all(args: { + token_id: TokenId; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.nft_revoke_allRaw(args, options)); } - nft_revoke_allRaw(args: {token_id: TokenId}, options?: ChangeMethodOptions): Promise { + nft_revoke_allRaw(args: { + token_id: TokenId; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "nft_revoke_all", args, ...options}); } - nft_revoke_allTx(args: {token_id: TokenId}, options?: ChangeMethodOptions): transactions.Action { + nft_revoke_allTx(args: { + token_id: TokenId; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("nft_revoke_all", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - cost_of_linkdrop(args: {minter: AccountId}, options?: ViewFunctionOptions): Promise { + cost_of_linkdrop(args: { + minter: AccountId; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "cost_of_linkdrop", args, options); } - total_cost(args: {num: number, minter: AccountId}, options?: ViewFunctionOptions): Promise { + total_cost(args: { + num: u32; + minter: AccountId; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "total_cost", args, options); } - get_linkdrop_contract(args: {} = {}, options?: ViewFunctionOptions): Promise { + get_linkdrop_contract(args: { + } = {}, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "get_linkdrop_contract", args, options); } - async new_default_meta(args: {owner_id: AccountId, metadata: InitialMetadata, size: number, sale?: Sale}, options?: ChangeMethodOptions): Promise { + async new_default_meta(args: { + owner_id: AccountId; + metadata: InitialMetadata; + size: u32; + sale?: Sale; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.new_default_metaRaw(args, options)); } - new_default_metaRaw(args: {owner_id: AccountId, metadata: InitialMetadata, size: number, sale?: Sale}, options?: ChangeMethodOptions): Promise { + new_default_metaRaw(args: { + owner_id: AccountId; + metadata: InitialMetadata; + size: u32; + sale?: Sale; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "new_default_meta", args, ...options}); } - new_default_metaTx(args: {owner_id: AccountId, metadata: InitialMetadata, size: number, sale?: Sale}, options?: ChangeMethodOptions): transactions.Action { + new_default_metaTx(args: { + owner_id: AccountId; + metadata: InitialMetadata; + size: u32; + sale?: Sale; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("new_default_meta", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async nft_revoke(args: {token_id: TokenId, account_id: AccountId}, options?: ChangeMethodOptions): Promise { + async nft_revoke(args: { + token_id: TokenId; + account_id: AccountId; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.nft_revokeRaw(args, options)); } - nft_revokeRaw(args: {token_id: TokenId, account_id: AccountId}, options?: ChangeMethodOptions): Promise { + nft_revokeRaw(args: { + token_id: TokenId; + account_id: AccountId; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "nft_revoke", args, ...options}); } - nft_revokeTx(args: {token_id: TokenId, account_id: AccountId}, options?: ChangeMethodOptions): transactions.Action { + nft_revokeTx(args: { + token_id: TokenId; + account_id: AccountId; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("nft_revoke", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - nft_metadata(args: {} = {}, options?: ViewFunctionOptions): Promise { + nft_metadata(args: { + } = {}, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "nft_metadata", args, options); } - nft_is_approved(args: {token_id: TokenId, approved_account_id: AccountId, approval_id?: u64}, options?: ViewFunctionOptions): Promise { + mint_rate_limit(args: { + } = {}, options?: ViewFunctionOptions): Promise { + return this.account.viewFunction(this.contractId, "mint_rate_limit", args, options); + } + nft_is_approved(args: { + token_id: TokenId; + approved_account_id: AccountId; + approval_id?: u64; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "nft_is_approved", args, options); } - remaining_allowance(args: {account_id: AccountId}, options?: ViewFunctionOptions): Promise { + remaining_allowance(args: { + account_id: AccountId; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "remaining_allowance", args, options); } - async nft_mint(args: {token_id: TokenId, token_owner_id: AccountId, token_metadata: TokenMetadata}, options?: ChangeMethodOptions): Promise { + async nft_mint(args: { + token_id: TokenId; + token_owner_id: AccountId; + token_metadata: TokenMetadata; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.nft_mintRaw(args, options)); } - nft_mintRaw(args: {token_id: TokenId, token_owner_id: AccountId, token_metadata: TokenMetadata}, options?: ChangeMethodOptions): Promise { + nft_mintRaw(args: { + token_id: TokenId; + token_owner_id: AccountId; + token_metadata: TokenMetadata; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "nft_mint", args, ...options}); } - nft_mintTx(args: {token_id: TokenId, token_owner_id: AccountId, token_metadata: TokenMetadata}, options?: ChangeMethodOptions): transactions.Action { + nft_mintTx(args: { + token_id: TokenId; + token_owner_id: AccountId; + token_metadata: TokenMetadata; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("nft_mint", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - get_user_sale_info(args: {account_id: AccountId}, options?: ViewFunctionOptions): Promise { + get_user_sale_info(args: { + account_id: AccountId; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "get_user_sale_info", args, options); } - nft_tokens_for_owner(args: {account_id: AccountId, from_index?: U128, limit?: u64}, options?: ViewFunctionOptions): Promise { + nft_tokens_for_owner(args: { + account_id: AccountId; + from_index?: U128; + limit?: u64; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "nft_tokens_for_owner", args, options); } - async add_whitelist_account_ungaurded(args: {account_id: AccountId, allowance: number}, options?: ChangeMethodOptions): Promise { + async add_whitelist_account_ungaurded(args: { + account_id: AccountId; + allowance: u32; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.add_whitelist_account_ungaurdedRaw(args, options)); } - add_whitelist_account_ungaurdedRaw(args: {account_id: AccountId, allowance: number}, options?: ChangeMethodOptions): Promise { + add_whitelist_account_ungaurdedRaw(args: { + account_id: AccountId; + allowance: u32; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "add_whitelist_account_ungaurded", args, ...options}); } - add_whitelist_account_ungaurdedTx(args: {account_id: AccountId, allowance: number}, options?: ChangeMethodOptions): transactions.Action { + add_whitelist_account_ungaurdedTx(args: { + account_id: AccountId; + allowance: u32; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("add_whitelist_account_ungaurded", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - tokens_left(args: {} = {}, options?: ViewFunctionOptions): Promise { + tokens_left(args: { + } = {}, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "tokens_left", args, options); } - nft_supply_for_owner(args: {account_id: AccountId}, options?: ViewFunctionOptions): Promise { + nft_supply_for_owner(args: { + account_id: AccountId; + }, options?: ViewFunctionOptions): Promise { return this.account.viewFunction(this.contractId, "nft_supply_for_owner", args, options); } - async update_royalties(args: {royalties: Royalties}, options?: ChangeMethodOptions): Promise { + async update_royalties(args: { + royalties: Royalties; + }, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.update_royaltiesRaw(args, options)); } - update_royaltiesRaw(args: {royalties: Royalties}, options?: ChangeMethodOptions): Promise { + update_royaltiesRaw(args: { + royalties: Royalties; + }, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "update_royalties", args, ...options}); } - update_royaltiesTx(args: {royalties: Royalties}, options?: ChangeMethodOptions): transactions.Action { + update_royaltiesTx(args: { + royalties: Royalties; + }, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("update_royalties", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } - async nft_mint_one(args: {} = {}, options?: ChangeMethodOptions): Promise { + async nft_mint_one(args: { + } = {}, options?: ChangeMethodOptions): Promise { return providers.getTransactionLastResult(await this.nft_mint_oneRaw(args, options)); } - nft_mint_oneRaw(args: {} = {}, options?: ChangeMethodOptions): Promise { + nft_mint_oneRaw(args: { + } = {}, options?: ChangeMethodOptions): Promise { return this.account.functionCall({contractId: this.contractId, methodName: "nft_mint_one", args, ...options}); } - nft_mint_oneTx(args: {} = {}, options?: ChangeMethodOptions): transactions.Action { + nft_mint_oneTx(args: { + } = {}, options?: ChangeMethodOptions): transactions.Action { return transactions.functionCall("nft_mint_one", args, options?.gas ?? DEFAULT_FUNCTION_CALL_GAS, options?.attachedDeposit ?? new BN(0)) } } +/** +* +* @contractMethod view +*/ +export interface CheckKey { + public_key: PublicKey; +} +/** +* +* @contractMethod change +*/ +export interface UpdateAllowance { + allowance: u32; +} +/** +* +* @contractMethod view +*/ +export interface Whitelisted { + account_id: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface GetSaleInfo { +} +/** +* +* @contractMethod view +*/ +export interface CostPerToken { + minter: AccountId; +} +/** +* +* @contractMethod change +*/ +export interface TransferOwnership { + new_owner: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface NftTotalSupply { +} +/** +* +* @contractMethod view +*/ +export interface NftTokens { + from_index?: U128; + limit?: u64; +} +/** +* +* @contractMethod view +*/ +export interface NftToken { + token_id: TokenId; +} +/** +* +* @contractMethod change +*/ +export interface CloseContract { +} +/** +* +* @contractMethod change +*/ +export interface NftApprove { + token_id: TokenId; + account_id: AccountId; + msg?: string; +} +/** +* +* @contractMethod change +*/ +export interface StartSale { + price?: U128; +} +/** +* +* @contractMethod change +*/ +export interface NftMintMany { + num: u32; +} +/** +* +* @contractMethod change +*/ +export interface UpdateUri { + uri: string; +} +/** +* +* @contractMethod change +*/ +export interface NftTransferCall { + receiver_id: AccountId; + token_id: TokenId; + approval_id?: u64; + memo?: string; + msg: string; +} +/** +* +* @contractMethod view +*/ +export interface NftPayout { + token_id: string; + balance: U128; + max_len_payout?: u32; +} +/** +* +* @contractMethod change +*/ +export interface NftTransferPayout { + receiver_id: AccountId; + token_id: string; + approval_id?: u64; + memo?: string; + balance: U128; + max_len_payout?: u32; +} +/** +* Returns the balance associated with given key. +* +* @contractMethod view +*/ +export interface GetKeyBalance { +} +/** +* Create a pending token that can be claimed with corresponding private key +* +* @contractMethod change +*/ +export interface CreateLinkdrop { + public_key: PublicKey; +} +/** +* +* @contractMethod change +*/ +export interface AddWhitelistAccounts { + accounts: AccountId[]; + allowance?: u32; +} +/** +* +* @contractMethod change +*/ +export interface New { + owner_id: AccountId; + metadata: NftContractMetadata; + size: u32; + sale: Sale; +} +/** +* +* @contractMethod change +*/ +export interface StartPresale { + public_sale_start?: Duration; + presale_price?: U128; +} +/** +* +* @contractMethod view +*/ +export interface TokenStorageCost { +} +/** +* +* @contractMethod change +*/ +export interface NftTransfer { + receiver_id: AccountId; + token_id: TokenId; + approval_id?: u64; + memo?: string; +} +/** +* +* @contractMethod change +*/ +export interface NftRevokeAll { + token_id: TokenId; +} +/** +* +* @contractMethod view +*/ +export interface CostOfLinkdrop { + minter: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface TotalCost { + num: u32; + minter: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface GetLinkdropContract { +} +/** +* +* @contractMethod change +*/ +export interface NewDefaultMeta { + owner_id: AccountId; + metadata: InitialMetadata; + size: u32; + sale?: Sale; +} +/** +* +* @contractMethod change +*/ +export interface NftRevoke { + token_id: TokenId; + account_id: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface NftMetadata { +} +/** +* +* @contractMethod view +*/ +export interface MintRateLimit { +} +/** +* +* @contractMethod view +*/ +export interface NftIsApproved { + token_id: TokenId; + approved_account_id: AccountId; + approval_id?: u64; +} +/** +* +* @contractMethod view +*/ +export interface RemainingAllowance { + account_id: AccountId; +} +/** +* +* @contractMethod change +*/ +export interface NftMint { + token_id: TokenId; + token_owner_id: AccountId; + token_metadata: TokenMetadata; +} +/** +* +* @contractMethod view +*/ +export interface GetUserSaleInfo { + account_id: AccountId; +} +/** +* +* @contractMethod view +*/ +export interface NftTokensForOwner { + account_id: AccountId; + from_index?: U128; + limit?: u64; +} +/** +* +* @contractMethod change +*/ +export interface AddWhitelistAccountUngaurded { + account_id: AccountId; + allowance: u32; +} +/** +* +* @contractMethod view +*/ +export interface TokensLeft { +} +/** +* +* @contractMethod view +*/ +export interface NftSupplyForOwner { + account_id: AccountId; +} +/** +* +* @contractMethod change +*/ +export interface UpdateRoyalties { + royalties: Royalties; +} +/** +* +* @contractMethod change +*/ +export interface NftMintOne { +} diff --git a/package.json b/package.json index 8d3350a0..393dd700 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,9 @@ "test:unit": "cargo test", "test:ci": "yarn test:unit && yarn test", "lint": "yarn eslint . --ext .ts", - "wit": "(cd contracts/tenk; witme wit -t ts/ --standards && tsc)", + "wit": "(cd contracts/tenk; witme near wit -t ts/ --standards && tsc)", + "schema": "(cd contracts/tenk; ts-json-schema-generator -f ./tsconfig.json --validation-keywords contractMethod -o schema.json)", + "wit:schema": "yarn wit && yarn schema", "docs": "yarn wit && typedoc contracts/tenk/ts/index.ts --tsconfig contracts/tenk/tsconfig.json", "pack-car": "ipfs-car --wrapWithDirectory false", "upload-car": "ts-node ./scripts/car-uploader.ts" @@ -37,7 +39,7 @@ "near-api-js": "git+https://github.com/ahalabs/near-api-js#beta", "near-cli": "git+https://github.com/ahalabs/near-cli#beta", "near-units": "^0.1.9", - "near-willem-workspaces-ava": "^1.0.3-alpha.0", + "near-workspaces-ava": "^1.1.0", "nft.storage": "^5.0.0", "ts-node": "^10.4.0", "typedoc": "^0.22.11", diff --git a/scripts/deploy.ts b/scripts/deploy.ts index 801a581e..373ac9c6 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -13,6 +13,10 @@ const metadata: tenk.InitialMetadata = { const price = NEAR.parse("1 N").toJSON(); const sale: tenk.Sale = { + price, + mint_rate_limit: 3, + public_sale_start: Date.now(), + // public_sale_start: Date.now() + 1000 * 3600, // is_premint_over: true, // initial_royalties: { // percent: 10_000, diff --git a/tsconfig.json b/tsconfig.json index 2de11dc2..a76082f6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "near-willem-workspaces-ava/tsconfig.ava.json" + "extends": "near-workspaces-ava/tsconfig.ava.json" } diff --git a/yarn.lock b/yarn.lock index ed320597..ab712fd8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3585,23 +3585,23 @@ near-units@^0.1.9: dependencies: bn.js "^5.2.0" -near-willem-workspaces-ava@^1.0.3-alpha.0: - version "1.0.3-alpha.0" - resolved "https://registry.yarnpkg.com/near-willem-workspaces-ava/-/near-willem-workspaces-ava-1.0.3-alpha.0.tgz#75e1e171fcef905b3568bd8998ebbba2b04ed030" - integrity sha512-vsWLfOskQgSgYzg2TU+KxBsB4yaJoULEPWyDAqx4OouC155y7H5y7GL0oZB0vu4bCm0WBs1VEPFei1RgVtOuWQ== +near-workspaces-ava@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/near-workspaces-ava/-/near-workspaces-ava-1.1.0.tgz#63874bdaca74759de94f04228f220bbc8096dded" + integrity sha512-gEcR/hg9LMxfc+8PFxzN5p+sdlxGNiUtnSK7rM65uplJE4WaO8fxTRyC00499krC47ya2t/mMEvLt9SqqOE5pg== dependencies: "@ava/typescript" "^2.0.0" "@types/bn.js" "^5.1.0" "@types/node" "^16.4.10" ava "3.15.0" - near-willem-workspaces "^1.0.3-alpha.0" + near-workspaces "^1.1.0" ts-node "^10.1.0" typescript "^4.3.5" -near-willem-workspaces@^1.0.3-alpha.0: - version "1.0.3-alpha.0" - resolved "https://registry.yarnpkg.com/near-willem-workspaces/-/near-willem-workspaces-1.0.3-alpha.0.tgz#b80495f183d1ac57ca0ca3f58b21774a370a6580" - integrity sha512-5JPhXZ82uIXumJKUWEI2CXUjtzk0XSxql0Crnx+whc8BA1x26JOYRp98iNELCOV4+pREoeSKTDKCNpYsanX2Hw== +near-workspaces@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/near-workspaces/-/near-workspaces-1.1.0.tgz#95167230d10233063224a69ee97dd2b469871669" + integrity sha512-cmn3k44Ce+INWhz9JUR9RlPGqVWKoM7ETSnKSXXpUZmVNj6smu7DtWQTAoSjPGvHCnftv7wu/6Gn1qq5F2KnFA== dependencies: base64url "^3.0.1" bn.js "^5.2.0" @@ -3653,14 +3653,7 @@ node-addon-api@^4.2.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.3.0.tgz#52a1a0b475193e0928e98e0426a0d1254782b77f" integrity sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ== -node-fetch@^2.6.1: - version "2.6.7" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" - integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== - dependencies: - whatwg-url "^5.0.0" - -"node-fetch@https://registry.npmjs.org/@achingbrain/node-fetch/-/node-fetch-2.6.7.tgz": +node-fetch@^2.6.1, "node-fetch@https://registry.npmjs.org/@achingbrain/node-fetch/-/node-fetch-2.6.7.tgz": version "2.6.7" resolved "https://registry.npmjs.org/@achingbrain/node-fetch/-/node-fetch-2.6.7.tgz#1b5d62978f2ed07b99444f64f0df39f960a6d34d" @@ -4822,11 +4815,6 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= - trim-newlines@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" @@ -5109,24 +5097,11 @@ web-streams-polyfill@^3.1.1: resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz#a6b74026b38e4885869fb5c589e90b95ccfc7965" integrity sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA== -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= - well-known-symbols@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/well-known-symbols/-/well-known-symbols-2.0.0.tgz#e9c7c07dbd132b7b84212c8174391ec1f9871ba5" integrity sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q== -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - which-boxed-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6"