{"version":3,"sources":["../../../src/tokens/mainnet/index.ts","../../../src/utils/format.ts","../../../src/types/enum.ts","../../../src/transactions/actions.ts","../../../src/transactions/action_creators.ts","../../../src/units/utils.ts","../../../src/units/gas.ts","../../../src/tokens/ft/format.ts","../../../src/tokens/ft/index.ts"],"sourcesContent":["import { FungibleToken } from '../ft/index.js';\n\nexport const wNEAR = new FungibleToken('wrap.near', {\n    name: 'Wrapped NEAR fungible token',\n    decimals: 24,\n    symbol: 'wNEAR',\n    icon: 'data:image/svg+xml,%3Csvg%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%2216%22%20cy%3D%2216%22%20r%3D%2216%22%20fill%3D%22white%22%3E%3C%2Fcircle%3E%3Cg%20clip-path%3D%22url(%23clip0000000003)%22%3E%3Cpath%20d%3D%22M20.8422%208.84471L17.4978%2013.776C17.4501%2013.847%2017.43%2013.9328%2017.4411%2014.0174C17.4522%2014.102%2017.4938%2014.1798%2017.5582%2014.2363C17.6225%2014.2928%2017.7053%2014.3243%2017.7913%2014.3249C17.8772%2014.3254%2017.9604%2014.2951%2018.0256%2014.2395L21.3178%2011.4036C21.3371%2011.3865%2021.361%2011.3753%2021.3866%2011.3714C21.4122%2011.3675%2021.4383%2011.3711%2021.4619%2011.3818C21.4855%2011.3924%2021.5054%2011.4096%2021.5193%2011.4314C21.5331%2011.4531%2021.5403%2011.4783%2021.54%2011.504V20.3824C21.54%2020.4095%2021.5316%2020.4361%2021.5158%2020.4583C21.5001%2020.4806%2021.4779%2020.4975%2021.4522%2020.5068C21.4265%2020.516%2021.3985%2020.5172%2021.3721%2020.5102C21.3456%2020.5031%2021.322%2020.4882%2021.3044%2020.4673L11.3533%208.63726C11.1933%208.44956%2010.994%208.29873%2010.7693%208.19525C10.5446%208.09178%2010.2999%208.03815%2010.0522%208.03809H9.70444C9.2524%208.03809%208.81887%208.21642%208.49922%208.53386C8.17957%208.8513%208%209.28185%208%209.73078V22.2351C8%2022.684%208.17957%2023.1145%208.49922%2023.432C8.81887%2023.7494%209.2524%2023.9277%209.70444%2023.9277V23.9277C9.99591%2023.9278%2010.2825%2023.8537%2010.537%2023.7125C10.7914%2023.5713%2011.0051%2023.3677%2011.1578%2023.1211L14.5022%2018.1898C14.5499%2018.1188%2014.57%2018.033%2014.5589%2017.9484C14.5478%2017.8638%2014.5062%2017.7861%2014.4418%2017.7295C14.3775%2017.673%2014.2947%2017.6415%2014.2087%2017.641C14.1228%2017.6404%2014.0396%2017.6707%2013.9744%2017.7264L10.6822%2020.5622C10.6629%2020.5794%2010.639%2020.5906%2010.6134%2020.5944C10.5878%2020.5983%2010.5617%2020.5947%2010.5381%2020.5841C10.5145%2020.5734%2010.4946%2020.5562%2010.4807%2020.5345C10.4669%2020.5128%2010.4597%2020.4875%2010.46%2020.4618V11.5813C10.46%2011.5541%2010.4684%2011.5276%2010.4842%2011.5053C10.4999%2011.483%2010.5221%2011.4661%2010.5478%2011.4568C10.5735%2011.4476%2010.6015%2011.4464%2010.6279%2011.4534C10.6544%2011.4605%2010.678%2011.4755%2010.6956%2011.4963L20.6456%2023.3286C20.8056%2023.5163%2021.0049%2023.6671%2021.2296%2023.7706C21.4543%2023.874%2021.699%2023.9277%2021.9467%2023.9277H22.2944C22.5184%2023.9279%2022.7401%2023.8842%2022.947%2023.7992C23.154%2023.7142%2023.342%2023.5895%2023.5004%2023.4324C23.6588%2023.2752%2023.7844%2023.0885%2023.8702%2022.8831C23.9559%2022.6776%2024%2022.4574%2024%2022.2351V9.73078C24%209.28185%2023.8204%208.8513%2023.5008%208.53386C23.1811%208.21642%2022.7476%208.03809%2022.2956%208.03809C22.0041%208.03801%2021.7175%208.11211%2021.4631%208.25332C21.2086%208.39453%2020.9949%208.59814%2020.8422%208.84471V8.84471Z%22%20fill%3D%22black%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip00033%22%3E%3Crect%20width%3D%2216%22%20height%3D%2216%22%20fill%3D%22black%22%20transform%3D%22translate(8%207.9834)%22%3E%3C%2Frect%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E',\n});\n\nexport const USDC = new FungibleToken('17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1', {\n    name: 'USDC',\n    decimals: 6,\n    symbol: 'USDC',\n    icon: 'data:image/svg+xml,%3C%3Fxml version=%221.0%22 encoding=%22utf-8%22%3F%3E%3C!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version=%221.1%22 id=%22Layer_1%22 xmlns=%22http://www.w3.org/2000/svg%22 xmlns:xlink=%22http://www.w3.org/1999/xlink%22 x=%220px%22 y=%220px%22 viewBox=%220 0 256 256%22 style=%22enable-background:new 0 0 256 256;%22 xml:space=%22preserve%22%3E%3Cstyle type=%22text/css%22%3E .st0%7Bfill:%232775CA;%7D .st1%7Bfill:%23FFFFFF;%7D%0A%3C/style%3E%3Ccircle class=%22st0%22 cx=%22128%22 cy=%22128%22 r=%22128%22/%3E%3Cpath class=%22st1%22 d=%22M104,217c0,3-2.4,4.7-5.2,3.8C60,208.4,32,172.2,32,129.3c0-42.8,28-79.1,66.8-91.5c2.9-0.9,5.2,0.8,5.2,3.8 v7.5c0,2-1.5,4.3-3.4,5C69.9,65.4,48,94.9,48,129.3c0,34.5,21.9,63.9,52.6,75.1c1.9,0.7,3.4,3,3.4,5V217z%22/%3E%3Cpath class=%22st1%22 d=%22M136,189.3c0,2.2-1.8,4-4,4h-8c-2.2,0-4-1.8-4-4v-12.6c-17.5-2.4-26-12.1-28.3-25.5c-0.4-2.3,1.4-4.3,3.7-4.3 h9.1c1.9,0,3.5,1.4,3.9,3.2c1.7,7.9,6.3,14,20.3,14c10.3,0,17.7-5.8,17.7-14.4c0-8.6-4.3-11.9-19.5-14.4c-22.4-3-33-9.8-33-27.3 c0-13.5,10.3-24.1,26.1-26.3V69.3c0-2.2,1.8-4,4-4h8c2.2,0,4,1.8,4,4v12.7c12.9,2.3,21.1,9.6,23.8,21.8c0.5,2.3-1.3,4.4-3.7,4.4 h-8.4c-1.8,0-3.3-1.2-3.8-2.9c-2.3-7.7-7.8-11.1-17.4-11.1c-10.6,0-16.1,5.1-16.1,12.3c0,7.6,3.1,11.4,19.4,13.7 c22,3,33.4,9.3,33.4,28c0,14.2-10.6,25.7-27.1,28.3V189.3z%22/%3E%3Cpath class=%22st1%22 d=%22M157.2,220.8c-2.9,0.9-5.2-0.8-5.2-3.8v-7.5c0-2.2,1.3-4.3,3.4-5c30.6-11.2,52.6-40.7,52.6-75.1 c0-34.5-21.9-63.9-52.6-75.1c-1.9-0.7-3.4-3-3.4-5v-7.5c0-3,2.4-4.7,5.2-3.8C196,50.2,224,86.5,224,129.3 C224,172.2,196,208.4,157.2,220.8z%22/%3E%3C/svg%3E%0A',\n});\n\nexport const USDT = new FungibleToken('usdt.tether-token.near', {\n    name: 'Tether USD',\n    decimals: 6,\n    symbol: 'USDt',\n    icon: \"data:image/svg+xml,%3Csvg width='111' height='90' viewBox='0 0 111 90' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M24.4825 0.862305H88.0496C89.5663 0.862305 90.9675 1.64827 91.7239 2.92338L110.244 34.1419C111.204 35.7609 110.919 37.8043 109.549 39.1171L58.5729 87.9703C56.9216 89.5528 54.2652 89.5528 52.6139 87.9703L1.70699 39.1831C0.305262 37.8398 0.0427812 35.7367 1.07354 34.1077L20.8696 2.82322C21.6406 1.60483 23.0087 0.862305 24.4825 0.862305ZM79.8419 14.8003V23.5597H61.7343V29.6329C74.4518 30.2819 83.9934 32.9475 84.0642 36.1425L84.0638 42.803C83.993 45.998 74.4518 48.6635 61.7343 49.3125V64.2168H49.7105V49.3125C36.9929 48.6635 27.4513 45.998 27.3805 42.803L27.381 36.1425C27.4517 32.9475 36.9929 30.2819 49.7105 29.6329V23.5597H31.6028V14.8003H79.8419ZM55.7224 44.7367C69.2943 44.7367 80.6382 42.4827 83.4143 39.4727C81.0601 36.9202 72.5448 34.9114 61.7343 34.3597V40.7183C59.7966 40.8172 57.7852 40.8693 55.7224 40.8693C53.6595 40.8693 51.6481 40.8172 49.7105 40.7183V34.3597C38.8999 34.9114 30.3846 36.9202 28.0304 39.4727C30.8066 42.4827 42.1504 44.7367 55.7224 44.7367Z' fill='%23009393'/%3E%3C/svg%3E\",\n});\n","import { base58, base64 } from '@scure/base';\n\ntype NumericString = `${number}`;\n\n/**\n * Exponent for calculating how many indivisible units are there in one NEAR. See {@link NEAR_NOMINATION}.\n */\nexport const NEAR_NOMINATION_EXP = 24;\n\n/**\n * Number of indivisible units in one NEAR. Derived from {@link NEAR_NOMINATION_EXP}.\n */\nexport const NEAR_NOMINATION = 10n ** BigInt(NEAR_NOMINATION_EXP);\n\n// Pre-calculate offsets used for rounding to different number of digits\nconst ROUNDING_OFFSETS: bigint[] = [];\nconst BN10 = 10n;\nfor (let i = 0, offset = 5n; i < NEAR_NOMINATION_EXP; i++, offset = offset * BN10) {\n    ROUNDING_OFFSETS[i] = offset;\n}\n\n/**\n * @deprecated use {@link units!yoctoToNear} from 'near-api-js' instead.\n *\n * Convert account balance value from internal indivisible units to NEAR. 1 NEAR is defined by {@link NEAR_NOMINATION}.\n * Effectively this divides given amount by {@link NEAR_NOMINATION}.\n *\n * @param balance decimal string representing balance in smallest non-divisible NEAR units (as specified by {@link NEAR_NOMINATION})\n * @param fracDigits number of fractional digits to preserve in formatted string. Balance is rounded to match given number of digits.\n * @returns Value in Ⓝ\n */\nexport function formatNearAmount(balance: string | number | bigint, fracDigits: number = NEAR_NOMINATION_EXP): string {\n    let balanceBN = BigInt(balance);\n    if (fracDigits !== NEAR_NOMINATION_EXP) {\n        // Adjust balance for rounding at given number of digits\n        const roundingExp = NEAR_NOMINATION_EXP - fracDigits - 1;\n        if (roundingExp > 0) {\n            balanceBN += ROUNDING_OFFSETS[roundingExp]!;\n        }\n    }\n\n    balance = balanceBN.toString();\n    const wholeStr = balance.substring(0, balance.length - NEAR_NOMINATION_EXP) || '0';\n    const fractionStr = balance\n        .substring(balance.length - NEAR_NOMINATION_EXP)\n        .padStart(NEAR_NOMINATION_EXP, '0')\n        .substring(0, fracDigits);\n\n    return trimTrailingZeroes(`${formatWithCommas(wholeStr)}.${fractionStr}`);\n}\n\n/**\n * @deprecated use {@link units!nearToYocto} from 'near-api-js' instead.\n *\n * Convert human readable NEAR amount to internal indivisible units.\n * Effectively this multiplies given amount by {@link NEAR_NOMINATION}.\n *\n * @param amount decimal string (potentially fractional) denominated in NEAR.\n * @returns The parsed yoctoⓃ amount\n * @throws {Error} if the amount is empty or invalid\n */\nexport function parseNearAmount(amount: NumericString | number): string {\n    const cleanedAmount = cleanupAmount(amount.toString());\n    if (!cleanedAmount) {\n        throw new Error('Amount cannot be empty');\n    }\n    const split = cleanedAmount.split('.');\n    const wholePart = split[0];\n    const fracPart = split[1] || '';\n    if (split.length > 2 || fracPart.length > NEAR_NOMINATION_EXP) {\n        throw new Error(`Cannot parse '${amount}' as NEAR amount`);\n    }\n    return trimLeadingZeroes(wholePart + fracPart.padEnd(NEAR_NOMINATION_EXP, '0'));\n}\n\n/**\n * Removes commas from the input\n * @param amount A value or amount that may contain commas\n * @returns string The cleaned value\n */\nfunction cleanupAmount(amount: string): string {\n    return amount.replace(/,/g, '').trim();\n}\n\n/**\n * Removes .000… from an input\n * @param value A value that may contain trailing zeroes in the decimals place\n * @returns string The value without the trailing zeros\n */\nfunction trimTrailingZeroes(value: string): string {\n    return value.replace(/\\.?0*$/, '');\n}\n\n/**\n * Removes leading zeroes from an input\n * @param value A value that may contain leading zeroes\n * @returns string The value without the leading zeroes\n */\nfunction trimLeadingZeroes(value: string): string {\n    value = value.replace(/^0+/, '');\n    if (value === '') {\n        return '0';\n    }\n    return value;\n}\n\n/**\n * Returns a human-readable value with commas\n * @param value A value that may not contain commas\n * @returns string A value with commas\n */\nfunction formatWithCommas(value: string): string {\n    const pattern = /(-?\\d+)(\\d{3})/;\n    while (pattern.test(value)) {\n        value = value.replace(pattern, '$1,$2');\n    }\n    return value;\n}\n\n/**\n * Encodes a Uint8Array or string into base58\n * @param value Uint8Array or string representing a borsh encoded object\n * @returns string base58 encoding of the value\n */\nexport function baseEncode(value: Uint8Array | string): string {\n    if (typeof value === 'string') {\n        const bytes: number[] = [];\n        for (let c = 0; c < value.length; c++) {\n            bytes.push(value.charCodeAt(c));\n        }\n        value = new Uint8Array(bytes);\n    }\n    return base58.encode(value);\n}\n\n/**\n * Decodes a base58 string into a Uint8Array\n * @param value base58 encoded string\n * @returns Uint8Array representing the decoded value\n */\nexport function baseDecode(value: string): Uint8Array {\n    return base58.decode(value);\n}\n\n/**\n * Encodes a Uint8Array into a base64 string\n * @param bytes Uint8Array to encode\n * @returns base64 encoded string\n */\nexport function base64Encode(bytes: Uint8Array): string {\n    return base64.encode(bytes);\n}\n\n/**\n * Decodes a base64 string into a Uint8Array\n * @param str base64 encoded string\n * @returns Uint8Array representing the decoded value\n */\nexport function base64Decode(str: string): Uint8Array {\n    return base64.decode(str);\n}\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\n\n/**\n * Encodes a string into a Uint8Array using UTF-8\n * @param str string to encode\n * @returns Uint8Array representing the UTF-8 bytes\n */\nexport function stringToBytes(str: string): Uint8Array {\n    return encoder.encode(str);\n}\n\n/**\n * Decodes a Uint8Array into a string using UTF-8\n * @param bytes Uint8Array to decode\n * @returns decoded string\n */\nexport function bytesToString(bytes: Uint8Array): string {\n    return decoder.decode(bytes);\n}\n","// TODO determine why subclassing is still necessary even though `enum`\n//  cannot be set in the base class or it will not be borsh-serializable\nexport abstract class Enum {\n    abstract enum: string;\n\n    constructor(properties: any) {\n        if (Object.keys(properties).length !== 1) {\n            throw new Error('Enum can only take single value');\n        }\n        Object.keys(properties).forEach((key: string) => {\n            (this as any)[key] = properties[key];\n        });\n    }\n}\n","import type { PublicKey } from '../crypto/index.js';\nimport { Enum } from '../types/index.js';\n\nimport type { DelegateAction } from './delegate.js';\nimport type { Signature } from './signature.js';\n\nexport class FunctionCallPermission {\n    allowance?: bigint;\n    receiverId: string;\n    methodNames: string[];\n\n    constructor({\n        allowance,\n        receiverId,\n        methodNames,\n    }: { allowance?: bigint; receiverId: string; methodNames: string[] }) {\n        this.allowance = allowance;\n        this.receiverId = receiverId;\n        this.methodNames = methodNames;\n    }\n}\n\nexport class FullAccessPermission {}\n\nexport class AccessKeyPermission extends Enum {\n    enum!: string;\n    functionCall?: FunctionCallPermission;\n    fullAccess?: FullAccessPermission;\n\n    constructor(props: any) {\n        super(props);\n        for (const [k, v] of Object.entries(props || {})) {\n            this[k] = v;\n            this.enum = k;\n        }\n    }\n}\n\nexport class AccessKey {\n    nonce: bigint;\n    permission: AccessKeyPermission;\n\n    constructor({ nonce, permission }: { nonce: bigint; permission: AccessKeyPermission }) {\n        this.nonce = nonce;\n        this.permission = permission;\n    }\n}\n\nexport class CreateAccount {}\nexport class DeployContract {\n    code: Uint8Array;\n\n    constructor({ code }: { code: Uint8Array }) {\n        this.code = code;\n    }\n}\nexport class FunctionCall {\n    methodName: string;\n    args: Uint8Array;\n    gas: bigint;\n    deposit: bigint;\n\n    constructor({\n        methodName,\n        args,\n        gas,\n        deposit,\n    }: { methodName: string; args: Uint8Array; gas: bigint; deposit: bigint }) {\n        this.methodName = methodName;\n        this.args = args;\n        this.gas = gas;\n        this.deposit = deposit;\n    }\n}\n\nexport class GlobalContractDeployMode extends Enum {\n    enum!: string;\n    CodeHash?: null;\n    AccountId?: null;\n\n    constructor(props: { CodeHash?: null; AccountId?: null }) {\n        super(props);\n        for (const [k, v] of Object.entries(props || {})) {\n            this[k] = v;\n            this.enum = k;\n        }\n    }\n}\n\nexport class GlobalContractIdentifier extends Enum {\n    enum!: string;\n    CodeHash?: Uint8Array;\n    AccountId?: string;\n\n    constructor(props: { CodeHash?: Uint8Array; AccountId?: string }) {\n        super(props);\n        for (const [k, v] of Object.entries(props || {})) {\n            this[k] = v;\n            this.enum = k;\n        }\n    }\n}\n\nexport class DeployGlobalContract {\n    code: Uint8Array;\n    deployMode: GlobalContractDeployMode;\n\n    constructor({ code, deployMode }: { code: Uint8Array; deployMode: GlobalContractDeployMode }) {\n        this.code = code;\n        this.deployMode = deployMode;\n    }\n}\n\nexport class UseGlobalContract {\n    contractIdentifier: GlobalContractIdentifier;\n\n    constructor({ contractIdentifier }: { contractIdentifier: GlobalContractIdentifier }) {\n        this.contractIdentifier = contractIdentifier;\n    }\n}\nexport class Transfer {\n    deposit: bigint;\n\n    constructor({ deposit }: { deposit: bigint }) {\n        this.deposit = deposit;\n    }\n}\nexport class Stake {\n    stake: bigint;\n    publicKey: PublicKey;\n\n    constructor({ stake, publicKey }: { stake: bigint; publicKey: PublicKey }) {\n        this.stake = stake;\n        this.publicKey = publicKey;\n    }\n}\nexport class AddKey {\n    publicKey: PublicKey;\n    accessKey: AccessKey;\n\n    constructor({ publicKey, accessKey }: { publicKey: PublicKey; accessKey: AccessKey }) {\n        this.publicKey = publicKey;\n        this.accessKey = accessKey;\n    }\n}\nexport class DeleteKey {\n    publicKey: PublicKey;\n\n    constructor({ publicKey }: { publicKey: PublicKey }) {\n        this.publicKey = publicKey;\n    }\n}\nexport class DeleteAccount {\n    beneficiaryId: string;\n\n    constructor({ beneficiaryId }: { beneficiaryId: string }) {\n        this.beneficiaryId = beneficiaryId;\n    }\n}\nexport class SignedDelegate {\n    delegateAction: DelegateAction;\n    signature: Signature;\n\n    constructor({ delegateAction, signature }: { delegateAction: DelegateAction; signature: Signature }) {\n        this.delegateAction = delegateAction;\n        this.signature = signature;\n    }\n}\n\n/**\n * Contains a list of the valid transaction Actions available with this API\n * @see {@link https://nomicon.io/RuntimeSpec/Actions.html | Actions Spec}\n */\nexport class Action extends Enum {\n    enum!: string;\n    createAccount?: CreateAccount;\n    deployContract?: DeployContract;\n    functionCall?: FunctionCall;\n    transfer?: Transfer;\n    stake?: Stake;\n    addKey?: AddKey;\n    deleteKey?: DeleteKey;\n    deleteAccount?: DeleteAccount;\n    signedDelegate?: SignedDelegate;\n    deployGlobalContract?: DeployGlobalContract;\n    useGlobalContract?: UseGlobalContract;\n\n    constructor(props: any) {\n        super(props);\n        for (const [k, v] of Object.entries(props || {})) {\n            this[k] = v;\n            this.enum = k;\n        }\n    }\n}\n","import type { PublicKey } from '../crypto/index.js';\nimport { stringToBytes } from '../utils/index.js';\n\nimport {\n    AccessKey,\n    AccessKeyPermission,\n    Action,\n    AddKey,\n    CreateAccount,\n    DeleteAccount,\n    DeleteKey,\n    DeployContract,\n    DeployGlobalContract,\n    FullAccessPermission,\n    FunctionCall,\n    FunctionCallPermission,\n    GlobalContractDeployMode,\n    GlobalContractIdentifier,\n    SignedDelegate,\n    Stake,\n    Transfer,\n    UseGlobalContract,\n} from './actions.js';\nimport type { DelegateAction } from './delegate.js';\nimport type { Signature } from './signature.js';\n\n/**\n * Creates a full access key with full access permissions.\n * @returns A new full access key.\n */\nfunction fullAccessKey(): AccessKey {\n    return new AccessKey({\n        nonce: 0n,\n        permission: new AccessKeyPermission({\n            fullAccess: new FullAccessPermission(),\n        }),\n    });\n}\n\n/**\n * Creates an access key with function call permission for a specific receiver and method names.\n * @param receiverId The NEAR account ID of the function call receiver.\n * @param methodNames An array of method names allowed for function calls.\n * @param allowance An optional allowance (maximum amount) for the function call. Default: Unlimited.\n * @returns A new access key with function call permission.\n */\nfunction functionCallAccessKey(receiverId: string, methodNames: string[], allowance?: bigint): AccessKey {\n    return new AccessKey({\n        nonce: 0n,\n        permission: new AccessKeyPermission({\n            functionCall: new FunctionCallPermission({\n                receiverId,\n                allowance,\n                methodNames,\n            }),\n        }),\n    });\n}\n\n/**\n * Creates a new action for creating a new NEAR account.\n * @returns A new action for creating a new account.\n */\nfunction createAccount(): Action {\n    return new Action({ createAccount: new CreateAccount() });\n}\n\n/**\n * Creates a new action for deploying a contract with the provided code.\n * @param code The Uint8Array representing the code of the contract.\n * @returns A new action for deploying a contract.\n */\nfunction deployContract(code: Uint8Array): Action {\n    return new Action({ deployContract: new DeployContract({ code }) });\n}\n\n/**\n * Converts an input argument to a Uint8Array, handling cases for both JSON and Uint8Array.\n * @param args The input argument, either JSON object or Uint8Array.\n * @returns A Uint8Array representation of the input argument.\n */\nexport function stringifyJsonOrBytes(args: any): Uint8Array {\n    if (args instanceof Uint8Array) return args;\n    return stringToBytes(JSON.stringify(args));\n}\n\n/**\n * Constructs {@link Action} instance representing contract method call.\n *\n * @param methodName the name of the method to call\n * @param args arguments to pass to method. Can be either plain JS object which gets serialized as JSON automatically\n *  or `Uint8Array` instance which represents bytes passed as is.\n * @param gas max amount of gas that method call can use\n * @param deposit amount of NEAR (in yoctoNEAR) to send together with the call\n * @param stringify Convert input arguments into bytes array.\n */\nfunction functionCall(\n    methodName: string,\n    args: Uint8Array | object,\n    gas = 0n,\n    deposit = 0n,\n    stringify = stringifyJsonOrBytes\n): Action {\n    return new Action({\n        functionCall: new FunctionCall({\n            methodName,\n            args: stringify(args),\n            gas,\n            deposit,\n        }),\n    });\n}\n\n/**\n * Creates a new action for transferring funds, optionally specifying a deposit amount.\n * @param deposit The amount to be deposited along with the transfer. Default: 0.\n * @returns A new action for transferring funds.\n */\nfunction transfer(deposit = 0n): Action {\n    return new Action({ transfer: new Transfer({ deposit }) });\n}\n\n/**\n * Creates a new action for staking tokens, specifying the stake amount and public key.\n * @param stake The amount to be staked. Default: 0.\n * @param publicKey The public key associated with the staking action.\n * @returns A new action for staking tokens.\n */\nfunction stake(stake = 0n, publicKey: PublicKey): Action {\n    return new Action({ stake: new Stake({ stake, publicKey }) });\n}\n\n/**\n * Creates a new action for adding a public key with a specified access key.\n * @param publicKey The public key to be added.\n * @param accessKey The access key associated with the added public key.\n * @returns A new action for adding a public key.\n */\nfunction addKey(publicKey: PublicKey, accessKey: AccessKey): Action {\n    return new Action({ addKey: new AddKey({ publicKey, accessKey }) });\n}\n\n/**\n * Creates a new action for adding a full access key.\n * @param publicKey The public key to be added.\n * @returns A new action for adding a full access key.\n */\nfunction addFullAccessKey(publicKey: PublicKey): Action {\n    return addKey(publicKey, fullAccessKey());\n}\n\n/** * Creates a new action for adding a function call access key.\n * @param publicKey The public key to be added.\n * @param receiverId The NEAR account ID of the function call receiver.\n * @param methodNames An array of method names allowed for function calls.\n * @param allowance An optional allowance (maximum amount) for the function call.\n * @returns A new action for adding a function call access key.\n */\nfunction addFunctionCallAccessKey(\n    publicKey: PublicKey,\n    receiverId: string,\n    methodNames: string[],\n    allowance?: bigint\n): Action {\n    return addKey(publicKey, functionCallAccessKey(receiverId, methodNames, allowance));\n}\n\n/**\n * Creates a new action for deleting a public key.\n * @param publicKey The public key to be deleted.\n * @returns A new action for deleting a public key.\n */\nfunction deleteKey(publicKey: PublicKey): Action {\n    return new Action({ deleteKey: new DeleteKey({ publicKey }) });\n}\n\n/**\n * Creates a new action for deleting an account with the specified beneficiary ID.\n * @param beneficiaryId The NEAR account ID of the beneficiary.\n * @returns A new action for deleting an account.\n */\nfunction deleteAccount(beneficiaryId: string): Action {\n    return new Action({ deleteAccount: new DeleteAccount({ beneficiaryId }) });\n}\n\n/**\n * Creates a new action for a signed delegation, specifying the delegate action and signature.\n * @param options Signed delegate options\n * @param options.delegateAction The delegate action to be performed.\n * @param options.signature The signature associated with the delegate action.\n * @returns A new action for a signed delegation.\n */\nfunction signedDelegate({\n    delegateAction,\n    signature,\n}: {\n    delegateAction: DelegateAction;\n    signature: Signature;\n}): Action {\n    return new Action({\n        signedDelegate: new SignedDelegate({ delegateAction, signature }),\n    });\n}\n\n/**\n * Creates a new action for deploying a global contract with provided code and mode.\n * @param code The Uint8Array representing the contract code.\n * @param deployMode The mode to deploy global contract (CodeHash or AccountId).\n * @returns A new action for deploying a global contract.\n */\nfunction deployGlobalContract(code: Uint8Array, deployMode: 'codeHash' | 'accountId'): Action {\n    const mode =\n        deployMode === 'codeHash'\n            ? new GlobalContractDeployMode({ CodeHash: null })\n            : new GlobalContractDeployMode({ AccountId: null });\n\n    return new Action({ deployGlobalContract: new DeployGlobalContract({ code, deployMode: mode }) });\n}\n\n/**\n * Creates a new action for using a previously deployed global contract.\n * @param contractIdentifier The global contract identifier (hash or account id).\n * @returns A new action for using a global contract.\n */\nfunction useGlobalContract(contractIdentifier: { accountId: string } | { codeHash: string | Uint8Array }): Action {\n    const identifier =\n        'accountId' in contractIdentifier\n            ? new GlobalContractIdentifier({\n                  AccountId: contractIdentifier.accountId,\n              })\n            : new GlobalContractIdentifier({\n                  CodeHash:\n                      typeof contractIdentifier.codeHash === 'string'\n                          ? new Uint8Array(\n                                contractIdentifier.codeHash.match(/.{1,2}/g)!.map((byte) => parseInt(byte, 16))\n                            )\n                          : contractIdentifier.codeHash,\n              });\n    return new Action({ useGlobalContract: new UseGlobalContract({ contractIdentifier: identifier }) });\n}\n\nexport const actions = {\n    addFullAccessKey,\n    addFunctionCallAccessKey,\n    createAccount,\n    deleteAccount,\n    deleteKey,\n    deployContract,\n    fullAccessKey,\n    functionCall,\n    functionCallAccessKey,\n    signedDelegate,\n    stake,\n    transfer,\n    deployGlobalContract,\n    useGlobalContract,\n};\n","import type { NumericString } from './types.js';\n\nexport function toUnits(amount: NumericString | number, exponent: number): bigint {\n    const cleanedAmount = cleanupAmount(`${amount}`);\n    if (!cleanedAmount) {\n        throw new Error('Amount cannot be empty');\n    }\n    const split = cleanedAmount.split('.');\n    const wholePart = split[0];\n    const fracPart = split[1] || '';\n    if (split.length > 2 || fracPart.length > exponent) {\n        throw new Error(`Cannot parse '${amount}'`);\n    }\n    return BigInt(trimLeadingZeroes(wholePart + fracPart.padEnd(exponent, '0')));\n}\n\nfunction cleanupAmount(amount: string): string {\n    return amount.replace(/,/g, '').trim();\n}\n\nfunction trimLeadingZeroes(value: string): string {\n    value = value.replace(/^0+/, '');\n    if (value === '') {\n        return '0';\n    }\n    return value;\n}\n","import type { NumericString } from './types.js';\nimport { toUnits } from './utils.js';\n\nconst GIGA_NOMINATION_EXP = 9;\nconst TERA_NOMINATION_EXP = 12;\n\nexport function gigaToGas(giga: NumericString | number): bigint {\n    return toUnits(giga, GIGA_NOMINATION_EXP);\n}\n\nexport function teraToGas(tera: NumericString | number): bigint {\n    return toUnits(tera, TERA_NOMINATION_EXP);\n}\n","export const MAX_NOMINATION_EXP = 24;\n\n/**\n * Convert internal indivisible units to formatted human-readable amount\n */\nexport function formatAmount(\n    units: string | number | bigint,\n    fracDigits: number,\n    precision: number = fracDigits\n): string {\n    units = cleanupUnits(units);\n\n    const wholeStr = units.substring(0, units.length - fracDigits) || '0';\n    let fractionStr = units\n        .substring(units.length - fracDigits)\n        .substring(0, fracDigits)\n        .padStart(fracDigits, '0');\n\n    fractionStr = fractionStr.substring(0, precision);\n\n    return trimTrailingZeroes(`${wholeStr}.${fractionStr}`);\n}\n\n/**\n * Convert human readable amount to internal indivisible units.\n */\nexport function parseAmount(amount: string, fracDigits: number): string {\n    amount = cleanupAmount(amount);\n    const split = amount.split('.');\n\n    if (split.length > 2) {\n        throw new Error(`Cannot parse amount '${amount}' as it contains more than a single dot`);\n    }\n\n    const wholePart = split[0];\n    const fracPart = split[1] || '';\n\n    if (fracPart.length > MAX_NOMINATION_EXP) {\n        throw new Error(\n            `Cannot parse amount '${amount}' as it exceeds maximum decimal precision of ${MAX_NOMINATION_EXP}`\n        );\n    }\n\n    return trimLeadingZeroes(wholePart + fracPart.substring(0, fracDigits).padEnd(fracDigits, '0'));\n}\n\n/**\n * Removes commas from the input\n * @param amount A value or amount that may contain commas\n * @returns string The cleaned value\n */\nfunction cleanupAmount(amount: string): string {\n    return amount.replace(/,/g, '.').trim();\n}\n\n/**\n * Removes .000… from an input\n * @param value A value that may contain trailing zeroes in the decimals place\n * @returns string The value without the trailing zeros\n */\nfunction trimTrailingZeroes(value: string): string {\n    return value.replace(/\\.?0*$/, '');\n}\n\n/**\n * Removes leading zeroes from an input\n * @param value A value that may contain leading zeroes\n * @returns string The value without the leading zeroes\n */\nfunction trimLeadingZeroes(value: string): string {\n    value = value.replace(/^0+/, '');\n    if (value === '') {\n        return '0';\n    }\n    return value;\n}\n\nfunction cleanupUnits(amount: string | number | bigint): string {\n    return BigInt(amount).toString();\n}\n","import type { Account } from '../../accounts/account.js';\nimport type { Provider } from '../../providers/provider.js';\nimport { actions } from '../../transactions/action_creators.js';\nimport { teraToGas } from '../../units/gas.js';\nimport { formatAmount, parseAmount } from './format.js';\n\ninterface FTMetadata {\n    spec?: string;\n    name: string;\n    decimals: number;\n    symbol: string;\n    icon?: string;\n}\n\nabstract class BaseFT {\n    public readonly metadata: FTMetadata;\n\n    constructor(metadata: FTMetadata) {\n        this.metadata = metadata;\n    }\n\n    /**\n     * Converts a decimal number to indivisible units\n     *\n     * @param amount The amount in decimal format (e.g. \"1.234\")\n     * @returns The amount in indivisible units (e.g. \"1234\")\n     */\n    public toUnits(amount: string | number): bigint {\n        const units = parseAmount(amount.toString(), this.metadata.decimals);\n        return BigInt(units);\n    }\n\n    /**\n     * Converts indivisible units to a decimal number (represented as a string)\n     *\n     * @param amount The amount in indivisible units (e.g. \"1234\")\n     * @param precision (optional) number of digits shown to the right of the decimal point - rounded down\n     * @returns The amount as a decimal string (e.g. \"1.234\")\n     */\n    public toDecimal(amount: bigint | string | number, precision?: number): string {\n        return formatAmount(amount, this.metadata.decimals, precision);\n    }\n\n    /**\n     * Get the available balance of an account in indivisible units\n     *\n     * @param account The account to get the balance of\n     * @returns\n     */\n    abstract getBalance(account: Account): Promise<bigint>;\n\n    /**\n     * Transfer tokens from one account to another\n     *\n     * @param param\n     * @param param.from The Account that will transfer the tokens\n     * @param param.receiverId The AccountID that will receive the tokens\n     * @param param.amount The amount of tokens to transfer in the smallest unit\n     */\n    abstract transfer({\n        from,\n        receiverId,\n        amount,\n    }: {\n        from: Account;\n        receiverId: string;\n        amount: string | number | bigint;\n    }): Promise<any>;\n}\n\nexport class NativeToken extends BaseFT {\n    public async transfer({\n        from,\n        receiverId,\n        amount,\n    }: {\n        from: Account;\n        receiverId: string;\n        amount: string | number | bigint;\n    }): Promise<any> {\n        return from.signAndSendTransaction({\n            receiverId,\n            actions: [actions.transfer(BigInt(amount))],\n        });\n    }\n\n    public async getBalance(account: Account): Promise<bigint> {\n        const {\n            balance: { available },\n        } = await account.getState();\n        return available;\n    }\n}\n\nexport class FungibleToken extends BaseFT {\n    public readonly accountId: string;\n\n    constructor(accountId: string, metadata: FTMetadata) {\n        metadata.spec = metadata.spec || 'ft-1.0.0';\n        super(metadata);\n        this.accountId = accountId;\n    }\n\n    public async transfer({\n        from,\n        receiverId,\n        amount,\n    }: {\n        from: Account;\n        receiverId: string;\n        amount: string | number | bigint;\n    }): Promise<any> {\n        return from.callFunction({\n            contractId: this.accountId,\n            methodName: 'ft_transfer',\n            args: {\n                amount: amount.toString(),\n                receiver_id: receiverId,\n            },\n            gas: teraToGas(30),\n            deposit: 1,\n        });\n    }\n\n    public async getBalance({ accountId, provider }: { accountId: string; provider: Provider }): Promise<bigint> {\n        const balance = await provider.callFunction({\n            contractId: this.accountId,\n            method: 'ft_balance_of',\n            args: { account_id: accountId },\n        });\n        return BigInt(balance as string);\n    }\n\n    /**\n     * Transfer tokens and call a function on the receiver contract,\n     * only works if the receiver implements the `ft_on_transfer` method\n     *\n     * @param param Transfer call parameters\n     * @param param.from The Account that will transfer the tokens\n     * @param param.receiverId The AccountID that will receive the tokens\n     * @param param.amount The amount of tokens to transfer in the smallest unit\n     * @param param.msg The message to send to the `ft_on_transfer` method\n     */\n    public async transferCall({\n        from,\n        receiverId,\n        amount,\n        msg,\n    }: {\n        from: Account;\n        receiverId: string;\n        amount: bigint;\n        msg: string;\n    }): Promise<any> {\n        return from.callFunction({\n            contractId: this.accountId,\n            methodName: 'ft_transfer_call',\n            args: {\n                receiver_id: receiverId,\n                amount: amount.toString(),\n                msg,\n            },\n            gas: teraToGas(30),\n            deposit: 1,\n        });\n    }\n\n    /**\n     * Register an account to the fungible token contract by paying a storage deposit\n     *\n     * @param param\n     * @param param.accountIdToRegister The AccountID to register\n     * @param param.fundingAccount The Account that will fund the registration\n     */\n    public async registerAccount({\n        accountIdToRegister,\n        fundingAccount,\n    }: {\n        accountIdToRegister: string;\n        fundingAccount: Account;\n    }): Promise<any> {\n        const bounds = (await fundingAccount.provider.callFunction({\n            contractId: this.accountId,\n            method: 'storage_balance_bounds',\n            args: {},\n        })) as { min: string; max: string | null };\n\n        const requiredDeposit = bounds.min as string;\n\n        return fundingAccount.callFunction({\n            contractId: this.accountId,\n            methodName: 'storage_deposit',\n            args: {\n                account_id: accountIdToRegister,\n                registration_only: true,\n            },\n            gas: teraToGas(30),\n            deposit: requiredDeposit,\n        });\n    }\n\n    /**\n     * Unregister an account from the fungible token contract by paying a storage deposit\n     *\n     * @param param\n     * @param param.account The Account to unregister\n     * @param param.force Whether to remove the account without claiming the storage deposit\n     */\n    public async unregisterAccount({ account, force = false }: { account: Account; force: boolean }): Promise<any> {\n        return account.callFunction({\n            contractId: this.accountId,\n            methodName: 'storage_unregister',\n            args: { force },\n            gas: teraToGas(30),\n            deposit: 1,\n        });\n    }\n\n    /**\n     * Checks if an account is registered to the fungible token contract\n     *\n     * @param param\n     * @param param.accountId The AccountID to check\n     * @param param.provider A Provider to use for the query\n     * @returns Whether the account is registered\n     */\n    public async isAccountRegistered({\n        accountId,\n        provider,\n    }: {\n        accountId: string;\n        provider: Provider;\n    }): Promise<boolean> {\n        const [storage, required] = await Promise.all([\n            provider.callFunction<{ total: string; available: string }>({\n                contractId: this.accountId,\n                method: 'storage_balance_of',\n                args: { account_id: accountId },\n            }),\n            provider.callFunction<{ min: string; max: string | null }>({\n                contractId: this.accountId,\n                method: 'storage_balance_bounds',\n                args: {},\n            }),\n        ]);\n\n        if (!storage) return false;\n\n        return BigInt(storage.total) >= BigInt(required!.min);\n    }\n}\n\n/**\n * The NEAR token is the native token of the NEAR blockchain\n */\nexport const NEAR = new NativeToken({\n    name: 'NEAR',\n    decimals: 24,\n    symbol: 'NEAR',\n    icon: 'data:image/svg+xml,%3Csvg%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%2216%22%20cy%3D%2216%22%20r%3D%2216%22%20fill%3D%22white%22%3E%3C%2Fcircle%3E%3Cg%20clip-path%3D%22url(%23clip0000000003)%22%3E%3Cpath%20d%3D%22M20.8422%208.84471L17.4978%2013.776C17.4501%2013.847%2017.43%2013.9328%2017.4411%2014.0174C17.4522%2014.102%2017.4938%2014.1798%2017.5582%2014.2363C17.6225%2014.2928%2017.7053%2014.3243%2017.7913%2014.3249C17.8772%2014.3254%2017.9604%2014.2951%2018.0256%2014.2395L21.3178%2011.4036C21.3371%2011.3865%2021.361%2011.3753%2021.3866%2011.3714C21.4122%2011.3675%2021.4383%2011.3711%2021.4619%2011.3818C21.4855%2011.3924%2021.5054%2011.4096%2021.5193%2011.4314C21.5331%2011.4531%2021.5403%2011.4783%2021.54%2011.504V20.3824C21.54%2020.4095%2021.5316%2020.4361%2021.5158%2020.4583C21.5001%2020.4806%2021.4779%2020.4975%2021.4522%2020.5068C21.4265%2020.516%2021.3985%2020.5172%2021.3721%2020.5102C21.3456%2020.5031%2021.322%2020.4882%2021.3044%2020.4673L11.3533%208.63726C11.1933%208.44956%2010.994%208.29873%2010.7693%208.19525C10.5446%208.09178%2010.2999%208.03815%2010.0522%208.03809H9.70444C9.2524%208.03809%208.81887%208.21642%208.49922%208.53386C8.17957%208.8513%208%209.28185%208%209.73078V22.2351C8%2022.684%208.17957%2023.1145%208.49922%2023.432C8.81887%2023.7494%209.2524%2023.9277%209.70444%2023.9277V23.9277C9.99591%2023.9278%2010.2825%2023.8537%2010.537%2023.7125C10.7914%2023.5713%2011.0051%2023.3677%2011.1578%2023.1211L14.5022%2018.1898C14.5499%2018.1188%2014.57%2018.033%2014.5589%2017.9484C14.5478%2017.8638%2014.5062%2017.7861%2014.4418%2017.7295C14.3775%2017.673%2014.2947%2017.6415%2014.2087%2017.641C14.1228%2017.6404%2014.0396%2017.6707%2013.9744%2017.7264L10.6822%2020.5622C10.6629%2020.5794%2010.639%2020.5906%2010.6134%2020.5944C10.5878%2020.5983%2010.5617%2020.5947%2010.5381%2020.5841C10.5145%2020.5734%2010.4946%2020.5562%2010.4807%2020.5345C10.4669%2020.5128%2010.4597%2020.4875%2010.46%2020.4618V11.5813C10.46%2011.5541%2010.4684%2011.5276%2010.4842%2011.5053C10.4999%2011.483%2010.5221%2011.4661%2010.5478%2011.4568C10.5735%2011.4476%2010.6015%2011.4464%2010.6279%2011.4534C10.6544%2011.4605%2010.678%2011.4755%2010.6956%2011.4963L20.6456%2023.3286C20.8056%2023.5163%2021.0049%2023.6671%2021.2296%2023.7706C21.4543%2023.874%2021.699%2023.9277%2021.9467%2023.9277H22.2944C22.5184%2023.9279%2022.7401%2023.8842%2022.947%2023.7992C23.154%2023.7142%2023.342%2023.5895%2023.5004%2023.4324C23.6588%2023.2752%2023.7844%2023.0885%2023.8702%2022.8831C23.9559%2022.6776%2024%2022.4574%2024%2022.2351V9.73078C24%209.28185%2023.8204%208.8513%2023.5008%208.53386C23.1811%208.21642%2022.7476%208.03809%2022.2956%208.03809C22.0041%208.03801%2021.7175%208.11211%2021.4631%208.25332C21.2086%208.39453%2020.9949%208.59814%2020.8422%208.84471V8.84471Z%22%20fill%3D%22black%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip00033%22%3E%3Crect%20width%3D%2216%22%20height%3D%2216%22%20fill%3D%22black%22%20transform%3D%22translate(8%207.9834)%22%3E%3C%2Frect%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E',\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAA+B;AAOxB,IAAM,sBAAsB;AAK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