-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js.map
1 lines (1 loc) · 133 KB
/
main.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./libs/interfaces/src/index.ts","webpack:///external \"tslib\"","webpack:///./libs/errors/src/index.ts","webpack:///./libs/utils/src/index.ts","webpack:///external \"near-api-js\"","webpack:///external \"typedjson\"","webpack:///external \"tsoa\"","webpack:///./libs/crypto/src/index.ts","webpack:///external \"buffer\"","webpack:///external \"bn.js\"","webpack:///./apps/api/src/app/config/constants.ts","webpack:///./libs/near/src/lib/contract.ts","webpack:///./libs/global-contract/src/index.ts","webpack:///external \"tweetnacl\"","webpack:///./libs/crypto/src/lib/hash.ts","webpack:///./libs/near/src/lib/convert.ts","webpack:///./libs/torus/src/common/constants.ts","webpack:///./libs/near/src/lib/rpc.ts","webpack:///./libs/utils/src/lib/bytes.ts","webpack:///./libs/near/src/lib/utils.ts","webpack:///external \"axios\"","webpack:///./libs/global-state/src/index.ts","webpack:///./apps/api/src/environments/environment.test.ts","webpack:///./libs/crypto/src/lib/keys.ts","webpack:///./libs/crypto/src/lib/sign.ts","webpack:///./libs/utils/src/lib/types.ts","webpack:///./libs/near/src/lib/constants.ts","webpack:///external \"elliptic\"","webpack:///./libs/near/src/index.ts","webpack:///./apps/api/src/app/controllers/NearController.ts","webpack:///./apps/api/src/app/service/near.ts","webpack:///external \"body-parser\"","webpack:///external \"@tsoa/runtime\"","webpack:///external \"bs58\"","webpack:///external \"near-api-js/lib/account_creator\"","webpack:///external \"near-api-js/lib/key_stores\"","webpack:///external \"@toruslabs/torus.js\"","webpack:///./libs/interfaces/src/lib/configs.ts","webpack:///./libs/interfaces/src/lib/chains.ts","webpack:///./libs/interfaces/src/lib/chain-info.ts","webpack:///./libs/interfaces/src/lib/keysource.ts","webpack:///./libs/interfaces/src/lib/crypto.ts","webpack:///./libs/interfaces/src/lib/tx.ts","webpack:///./libs/crypto/src/lib/crypto.ts","webpack:///./libs/crypto/src/lib/index.ts","webpack:///./libs/errors/src/lib/errors.ts","webpack:///./libs/utils/src/lib/utils.ts","webpack:///./libs/utils/src/lib/chains.ts","webpack:///./libs/utils/src/lib/conversions.ts","webpack:///./libs/utils/src/lib/discord.ts","webpack:///./libs/utils/src/lib/user-verifier.ts","webpack:///./libs/utils/src/lib/serialize.ts","webpack:///./libs/crypto/src/lib/utils.ts","webpack:///./libs/near/src/lib/near.ts","webpack:///./libs/global-contract/src/lib/global-contract.ts","webpack:///./libs/global-contract/src/lib/constants.ts","webpack:///./libs/chain-info/src/lib/chain-info.ts","webpack:///./libs/global-state/src/lib/singletons.ts","webpack:///./libs/torus/src/common/torus.ts","webpack:///external \"express\"","webpack:///./apps/api/build/routes.ts","webpack:///./apps/api/src/app/controllers/DiscordController.ts","webpack:///./apps/api/src/app/service/discord.ts","webpack:///external \"form-data\"","webpack:///external \"js-sha3\"","webpack:///external \"js-sha256\"","webpack:///./libs/near/src/lib/tx.ts","webpack:///./libs/near/src/lib/accounts.ts","webpack:///external \"near-api-js/lib/utils\"","webpack:///./libs/chain-info/src/index.ts","webpack:///external \"thunky/promise\"","webpack:///external \"dotenv\"","webpack:///./libs/torus/src/common/index.ts","webpack:///external \"@toruslabs/fetch-node-details\"","webpack:///external \"node-fetch\"","webpack:///external \"cors\"","webpack:///./apps/api/src/main.ts","webpack:///external \"reflect-metadata\""],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QAC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AAI,EAAE,GAAG,EAAE;QACnC,OAAO,CAAC,GAAG,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AACD,IAAI,EAAE,CAAC;;;;;;;AC5DP,6C","file":"main.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 79);\n","export * from './lib/platforms';\nexport * from './lib/configs';\nexport * from './lib/chains';\nexport * from './lib/chain-info';\nexport * from './lib/keysource';\nexport * from './lib/crypto';\nexport * from './lib/frontend';\nexport * from './lib/tx';\n","module.exports = require(\"tslib\");","export * from './lib/errors';\n","export * from './lib/utils';\n","module.exports = require(\"near-api-js\");","module.exports = require(\"typedjson\");","module.exports = require(\"tsoa\");","export * from './lib/crypto';\n","module.exports = require(\"buffer\");","module.exports = require(\"bn.js\");","import { ed25519, ed25519Marker, Encoding, Env } from '@baf-wallet/interfaces';\nimport { keyPairFromSk, skFromString } from '@baf-wallet/crypto';\nimport {\n NearInitParams,\n getNearNetworkID,\n getNearSupportedContractTokens,\n} from '@baf-wallet/near';\nimport { environment, initDotEnv } from '../../environments/environment';\n\ninitDotEnv();\n\nexport const constants = {\n env: environment.env,\n chainParams: {\n near: {\n keyPair: keyPairFromSk<ed25519>(\n skFromString(process.env.NEAR_SK, ed25519Marker, Encoding.BS58)\n ),\n networkID: getNearNetworkID(environment.env),\n masterAccountID: process.env.NEAR_MASTER_ACCOUNT_ID,\n } as NearInitParams,\n },\n discord: {\n clientId: process.env.DISCORD_CLIENT_ID,\n clientSecret: process.env.DISCORD_CLIENT_SECRET,\n },\n torus: {\n verifierName: 'discord',\n network: environment.env === Env.PROD ? 'mainnet' : 'testnet',\n proxyAddress: process.env.TORUS_PROXY_ADDRESS,\n },\n};\n","import { ContractInterface } from '@baf-wallet/interfaces';\nimport BN from 'bn.js';\nimport { Account, Contract as NearNativeContract } from 'near-api-js';\nimport { NearAccountID } from './accounts';\n\nimport { NearState } from './near';\n\ninterface NearNFTToken {\n id: string;\n owner_id: string;\n}\n\nexport interface TokenMetadata {\n id: string;\n name: string;\n symbol: string;\n decimals: number;\n icon: string;\n}\n\n/**\n * The following are definitions for standard Near Contracts\n */\nexport interface NEP141Contract extends NearContract {\n // TODO: fill in, see https://github.com/bafnetwork/baf-wallet-v2/issues/69\n ft_balance_of: (args: { account_id: NearAccountID }) => Promise<string>;\n ft_total_supply: () => Promise<string>;\n storage_balance_of: (args: { account_id: NearAccountID }) => Promise<string>;\n // 1 Yocto Near is the standard accepted attached deposit for ft_transfer\n ft_transfer: (\n args: {\n receiver_id: NearAccountID;\n amount: string;\n memo?: string;\n },\n gas: string,\n attachedDeposit: string\n ) => Promise<void>;\n ft_metadata: () => Promise<TokenMetadata>;\n}\n\nexport interface NEP171Contract extends NearContract {\n nft_transfer: (\n args: {\n receiver_id: NearAccountID;\n token_id: string;\n approval_id: BN | null;\n memo?: string;\n },\n gas: string,\n attachedDeposit: string\n ) => Promise<void>;\n nft_transfer_call: (\n args: {\n receiver_id: NearAccountID;\n token_id: string;\n approval_id: BN | null;\n memo?: string;\n msg: string;\n },\n gas: string,\n attachedDeposit: string\n ) => Promise<void>;\n nft_token: (args: { token_id: string }) => Promise<NearNFTToken>;\n}\n\ntype contractViewMethod = (args: any) => Promise<any>;\ntype contractChangeMethod = (\n args: any,\n gas?: string,\n attachedDeposit?: string\n) => Promise<any>;\n\n/**\n * End definitions for standard Near Contracts\n */\nexport type NearContract = {\n [fn_name: string]: contractViewMethod | contractChangeMethod;\n};\n\nexport interface NearInitContractParams {\n callerAccount?: Account;\n viewMethods: string[];\n changeMethods: string[];\n}\n\nexport const initContract = (\n nearMasterAccount: Account,\n contractAccountID\n) => async <Contract>(params: NearInitContractParams) => {\n const contract = new NearNativeContract(\n params.callerAccount ?? nearMasterAccount,\n contractAccountID,\n {\n viewMethods: params.viewMethods,\n changeMethods: params.changeMethods,\n }\n );\n return (contract as unknown) as Contract;\n};\n\nexport function getContract<\n Contract,\n ContractInitParams extends NearInitContractParams\n>(\n nearState: NearState,\n contractAccountID: string\n): ContractInterface<Contract, ContractInitParams> {\n return {\n init: initContract(nearState.nearMasterAccount, contractAccountID),\n };\n}\n","export * from './lib/global-contract';\nexport * from './lib/constants';\n","module.exports = require(\"tweetnacl\");","import * as sha3 from 'js-sha3';\nimport { sha256 as js_sha256 } from 'js-sha256';\n\nexport function keccak256(msg: Buffer): Buffer {\n return Buffer.from(sha3.keccak256(msg), 'hex');\n}\n\nexport function sha256(msg: Buffer): Buffer {\n return Buffer.from(js_sha256(msg), 'hex');\n}\n\n// add more wrappers here as needed\n","import {\n Converter,\n KeyPair,\n PublicKey,\n Encoding,\n} from '@baf-wallet/interfaces';\nimport { KeyPair as NearKeyPair, utils as NearUtils } from 'near-api-js';\nimport { bufferConverter, encodeBytes, formatBytes } from '@baf-wallet/utils';\nimport { Buffer } from 'buffer';\nimport { BafError } from '@baf-wallet/errors';\n\nexport const nearConverter: Converter<\n NearUtils.PublicKey,\n Buffer,\n NearKeyPair\n> = {\n ...bufferConverter,\n\n pkToUnified<Curve>(\n pk: NearUtils.PublicKey,\n curveMarker: Curve\n ): PublicKey<Curve> {\n if (curveMarker.toString() !== 'ed25519') {\n throw BafError.UnsupportedKeyCurve('ed25519');\n }\n const data = Buffer.from(pk.data);\n return {\n curve: curveMarker,\n data: data,\n format: (fmt: Encoding) => formatBytes(data, fmt),\n };\n },\n\n pkFromUnified: <Curve>(unifiedPk: PublicKey<Curve>): NearUtils.PublicKey =>\n NearUtils.PublicKey.fromString(unifiedPk.format(Encoding.BS58) as string),\n\n keyPairToUnified<Curve>(\n keyPair: NearKeyPair,\n curveMarker: Curve\n ): KeyPair<Curve> {\n const skFmt = keyPair.toString();\n if (!skFmt.startsWith(curveMarker.toString())) {\n throw BafError.UnsupportedKeyCurve('ed25519');\n }\n\n const skStr = skFmt.split(':')[1];\n const skData = encodeBytes(skStr, Encoding.BS58);\n const pkData = Buffer.from(keyPair.getPublicKey().data);\n\n return {\n curve: curveMarker,\n pk: {\n curve: curveMarker,\n data: pkData,\n format: (fmt: Encoding) => formatBytes(pkData, fmt),\n },\n sk: {\n curve: curveMarker,\n data: skData,\n format: (fmt: Encoding) => formatBytes(skData, fmt),\n },\n };\n },\n\n keyPairFromUnified<Curve>(unifiedKeyPair: KeyPair<Curve>): NearKeyPair {\n const prefix = unifiedKeyPair.curve.toString();\n const skStr = unifiedKeyPair.sk.format(Encoding.BS58);\n return NearKeyPair.fromString(`${prefix}:${skStr}`);\n },\n};\n","import { LOGIN_TYPE } from '@toruslabs/torus-direct-web-sdk';\n\ntype VerifierInfo = {\n [login_type in LOGIN_TYPE]?: {\n verifier: string;\n clientId: string;\n };\n};\n\nexport const torusConstants = {\n network: 'ropsten',\n proxyAddress: process.env.TORUS_PROXY_ADDRESS,\n verifierInfo: {\n discord: {\n verifier: process.env.TORUS_VERIFIER_NAME,\n clientId: process.env.DISCORD_CLIENT_ID,\n },\n } as VerifierInfo,\n};\n\nexport type TORUS_LOGIN_TYPE = LOGIN_TYPE;\n","import { RpcInterface } from '@baf-wallet/interfaces';\nimport { transactions } from 'near-api-js';\nimport { NearNetworkID, stringToNetworkID } from './utils';\nimport { NearState } from './near';\nimport { network } from 'near-api-js/lib/utils';\n\nexport type NearRpcInterface = RpcInterface<\n transactions.Transaction,\n transactions.SignedTransaction,\n NearSendOpts,\n NearSendResult\n>;\n\n// TODO: go spelunking in near's jsonRpcProvider and see what options it takes\n// and see what kind of stuff it actually returns so we can do better than 'any'\n// eslint-disable-next-line\nexport interface NearSendOpts {}\n\nexport type NearSendResult = any;\n\n// * add more RPC methods as they are needed\n\nexport function nearRpc(_innerSdk: NearState): NearRpcInterface {\n return {\n endpoint: getRPCUrl,\n };\n}\n\nexport function getWalletUrl(network?: string): string {\n const networkID: NearNetworkID = stringToNetworkID(network ?? 'mainnet');\n return `https://wallet.${networkID}.near.org`;\n}\n\nexport function getRPCUrl(network?: string): string {\n const networkID: NearNetworkID = stringToNetworkID(network ?? 'mainnet');\n return `https://rpc.${networkID}.near.org`;\n}\n\nexport const getHelperUrl = (networkID: string) =>\n `https://helper.${networkID}.near.org`;\n\nexport const getExplorerUrl = (networkID: string) =>\n `https://explorer.${networkID}.near.org`;\n","import { Encoding, PublicKey, SecretKey } from '@baf-wallet/interfaces';\nimport { BafError } from '@baf-wallet/errors';\nimport * as bs58 from 'bs58';\n\nexport function formatBytes(\n buf: Buffer,\n fmt = Encoding.HEX\n): string | number[] {\n switch (fmt) {\n case Encoding.HEX:\n return Buffer.from(buf).toString('hex');\n case Encoding.BS58:\n return bs58.encode(Buffer.from(buf));\n case Encoding.ARRAY:\n return [...buf];\n default:\n throw BafError.UnsupportedEncoding(fmt);\n }\n}\n\nexport function encodeBytes(str: string, fmt: Encoding): Buffer {\n switch (fmt) {\n case Encoding.HEX:\n return Buffer.from(str, 'hex');\n case Encoding.BS58:\n return bs58.decode(str);\n case Encoding.UTF8:\n return Buffer.from(str, 'utf8');\n default:\n throw BafError.UnsupportedEncoding(fmt);\n }\n}\n","import { BafError } from '@baf-wallet/errors';\nimport { Env } from '@baf-wallet/interfaces';\nimport { utils } from 'near-api-js';\n\nexport enum NearNetworkID {\n DEVNET = 'testnet',\n TESTNET = 'testnet',\n MAINNET = 'mainnet',\n}\n\nexport function stringToNetworkID(str: string): NearNetworkID {\n switch (str) {\n case NearNetworkID.DEVNET:\n return NearNetworkID.DEVNET;\n case NearNetworkID.TESTNET:\n return NearNetworkID.TESTNET;\n case NearNetworkID.MAINNET:\n return NearNetworkID.MAINNET;\n default:\n throw BafError.UnknownNetworkIdent;\n }\n}\n\nexport function getNearNetworkID(env: Env): NearNetworkID {\n switch (env) {\n case Env.DEV:\n return NearNetworkID.DEVNET;\n case Env.TEST:\n return NearNetworkID.TESTNET;\n case Env.PROD:\n return NearNetworkID.MAINNET;\n default:\n return NearNetworkID.DEVNET;\n }\n}\n\nexport function nearToYoctoNear(amount: number): string {\n const amountYoctoNearBN = utils.format.NEAR_NOMINATION.muln(amount);\n return amountYoctoNearBN.toString(10);\n}\n","module.exports = require(\"axios\");","export * from './lib/singletons';\n","import { Env } from '@baf-wallet/interfaces';\nimport { config as dotenvConfig } from 'dotenv';\n\nexport function initDotEnv() {\n if (!process.env.NON_LOCAL) dotenvConfig({ path: './env/.env.test' });\n}\n\nexport const environment = {\n env: Env.TEST,\n production: false,\n};\n","import { BafError } from '@baf-wallet/errors';\nimport {\n PublicKey,\n SecretKey,\n KeyPair,\n SECP256K1_STR,\n ED25519_STR,\n secp256k1,\n secp256k1Marker,\n} from '@baf-wallet/interfaces';\nimport { bufferConverter } from '@baf-wallet/utils';\nimport { ec as EC } from 'elliptic';\nimport * as nacl from 'tweetnacl';\n\nconst ellipticSecp256k1 = new EC('secp256k1');\n\nexport function pkSecpFromXY(x: string, y: string): PublicKey<secp256k1> {\n const key = ellipticSecp256k1.keyFromPublic({ x, y }, 'hex');\n return bufferConverter.pkToUnified(\n Buffer.from(key.getPublic('array')),\n secp256k1Marker\n );\n}\n\nexport function keyPairFromSk<Curve>(sk: SecretKey<Curve>): KeyPair<Curve> {\n const pk = pkFromSk(sk);\n return {\n curve: sk.curve,\n pk,\n sk,\n };\n}\n\nexport function pkFromSk<Curve>(sk: SecretKey<Curve>): PublicKey<Curve> {\n switch (sk.curve.toString()) {\n case SECP256K1_STR: {\n const data = Buffer.from(\n ellipticSecp256k1.keyFromPrivate(sk.data).getPublic(false, 'hex'),\n 'hex'\n );\n\n return bufferConverter.pkToUnified(data, sk.curve);\n }\n case ED25519_STR: {\n const data = Buffer.from(\n nacl.sign.keyPair.fromSecretKey(new Uint8Array(sk.data)).publicKey\n );\n\n return bufferConverter.pkToUnified(data, sk.curve);\n }\n default:\n throw BafError.UnsupportedKeyCurve(sk.curve.toString());\n }\n}\n\nexport function skFromSeed<Curve>(\n seed: Uint8Array,\n curveMarker: Curve\n): SecretKey<Curve> {\n switch (curveMarker.toString()) {\n case SECP256K1_STR: {\n const entropy = nacl.hash(seed);\n const ellipticSk = ellipticSecp256k1\n .genKeyPair({ entropy })\n .getPrivate('hex');\n\n const data = Buffer.from(ellipticSk, 'hex');\n return bufferConverter.skToUnified(data, curveMarker);\n }\n case ED25519_STR: {\n const data = Buffer.from(\n nacl.sign.keyPair.fromSeed(new Uint8Array(Buffer.from(seed))).secretKey\n );\n\n return bufferConverter.pkToUnified(data, curveMarker);\n }\n default:\n throw BafError.UnsupportedKeyCurve(curveMarker.toString());\n }\n}\n\nexport function skFromRng<Curve>(curveMarker: Curve): SecretKey<Curve> {\n switch (curveMarker.toString()) {\n case ED25519_STR: {\n const data = Buffer.from(nacl.sign.keyPair().secretKey);\n return bufferConverter.skToUnified(data, curveMarker);\n }\n case SECP256K1_STR: {\n const data = Buffer.from(\n ellipticSecp256k1.genKeyPair().getPrivate('hex'),\n 'hex'\n );\n return bufferConverter.pkToUnified(data, curveMarker);\n }\n default:\n throw BafError.UnsupportedKeyCurve(curveMarker.toString());\n }\n}\n","import {\n SecretKey,\n PublicKey,\n ED25519_STR,\n SECP256K1_STR,\n Encoding,\n} from '@baf-wallet/interfaces';\nimport { keccak256, sha256 } from './hash';\nimport { ec as EC } from 'elliptic';\nimport * as nacl from 'tweetnacl';\nimport { encodeBytes } from '@baf-wallet/utils';\nimport { BafError } from '@baf-wallet/errors';\n\nconst ellipticSecp256k1 = new EC('secp256k1');\n\nexport function verifySignature<Curve>(\n pk: PublicKey<Curve>,\n msg: Buffer | string,\n signedMsg: Buffer,\n hashFn: (buf: Buffer) => Buffer = keccak256\n): boolean {\n const msgFormat =\n typeof msg === 'string' ? encodeBytes(msg, Encoding.UTF8) : msg;\n switch (pk.curve.toString()) {\n case SECP256K1_STR: {\n const msgHash = hashFn(msgFormat);\n let validSig = ellipticSecp256k1.verify(msgHash, signedMsg, pk.data);\n return validSig;\n }\n case ED25519_STR: {\n const msgHash = hashFn(msgFormat);\n return nacl.sign.detached.verify(\n new Uint8Array(msgHash),\n new Uint8Array(signedMsg),\n new Uint8Array(pk.data)\n );\n }\n default:\n throw BafError.UnsupportedKeyCurve(pk.curve.toString());\n }\n}\n\nexport function signMsg<Curve>(\n sk: SecretKey<Curve>,\n msg: Buffer | string,\n GlobalContractFormat = false,\n hashFn: (buf: Buffer) => Buffer = keccak256\n): Buffer {\n const msgFormat =\n typeof msg === 'string' ? encodeBytes(msg, Encoding.UTF8) : msg;\n switch (sk.curve.toString()) {\n case SECP256K1_STR: {\n const msgHash = hashFn(msgFormat);\n const ellipticSig = ellipticSecp256k1.sign(msgHash, sk.data, 'hex', {\n canonical: true,\n });\n return GlobalContractFormat\n ? encodeSecpSigRustContract(ellipticSig)\n : Buffer.from(ellipticSig.toDER('hex'), 'hex');\n }\n case ED25519_STR: {\n const msgHash = hashFn(msgFormat);\n return Buffer.from(\n nacl.sign.detached(new Uint8Array(msgHash), new Uint8Array(sk.data))\n );\n }\n default:\n throw BafError.UnsupportedKeyCurve(sk.curve.toString());\n }\n}\n\nexport function encodeSecpSigRustContract(sig: EC.Signature): Buffer {\n return Buffer.from(\n `${sig.r.toString('hex', 64)}${sig.s.toString('hex', 64)}`,\n 'hex'\n );\n}\n","export type Pair<T, U> = {\n fst: T;\n snd: U;\n};\n\nexport const getEnumValues = (enumObj: any) =>\n Object.keys(enumObj).map((key) => enumObj[key]);\n\nexport const arrayToObject = (array: { key: string; val: any }[]): any => {\n return array.reduce((prev, v) => {\n prev[v.key] = v.val;\n return prev;\n }, {});\n};\n\nexport type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;\n","import { Env, TokenInfo } from '@baf-wallet/interfaces';\nimport { Chain, ChainConstants } from '@baf-wallet/interfaces';\nimport { getTokenInfo } from '@baf-wallet/chain-info';\nimport thunky from 'thunky/promise';\nimport { arrayToObject } from '@baf-wallet/utils';\nimport { Account } from 'near-api-js';\nimport {\n getContract,\n initContract,\n NearInitContractParams,\n NEP141Contract,\n} from './contract';\nimport { NearState } from './near';\n\nconst bridgeContractsProd = [\n '6b175474e89094c44da98b954eedeac495271d0f.factory.bridge.near',\n 'dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near',\n '1f9840a85d5af5bf1d1762f925bdaddc4201f984.factory.bridge.near',\n '514910771af9ca656af840dff83e8264ecf986ca.factory.bridge.near',\n 'a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near',\n '2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near',\n '7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9.factory.bridge.near',\n 'a0b73e1ff0b80914ab6fe0444e65848c4c34450b.factory.bridge.near',\n '50d1c9771902476076ecfc8b2a83ad6b9355a4c9.factory.bridge.near',\n '4fabb145d64652a948d72533023f6e7a623c7c53.factory.bridge.near',\n '6f259637dcd74c767781e37bc6133cd6a68aa161.factory.bridge.near',\n '6b3595068778dd592e39a122f4f5a5cf09c90fe2.factory.bridge.near',\n 'c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f.factory.bridge.near',\n 'c944e90c64b2c07662a292be6244bdf05cda44a7.factory.bridge.near',\n '9f8f72aa9304c8b593d555f12ef6589cc3a579a2.factory.bridge.near',\n '0bc529c00c6401aef6d220be8c6ea1667f6ad93e.factory.bridge.near',\n 'c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.factory.bridge.near',\n '0316eb71485b0ab14103307bf65a021042c6d380.factory.bridge.near',\n '111111111117dc0aa78b770fa6a738034120c302.factory.bridge.near',\n];\n\nexport const getNearSupportedContractTokens = (networkId: string) => {\n switch (networkId) {\n case 'mainnet':\n return ['berryclub.ek.near', 'wrap.near', ...bridgeContractsProd];\n case 'testnet':\n default:\n return ['ft.levtester.testnet', 'wrap.testnet'];\n }\n};\n\nexport async function getChainConstants(\n nearState: NearState\n): Promise<ChainConstants> {\n const tokenContracts = getNearSupportedContractTokens(nearState.networkID);\n const ft_metadatas = await Promise.all(\n tokenContracts.map((contractID) =>\n getContract<NEP141Contract, NearInitContractParams>(nearState, contractID)\n .init({\n viewMethods: ['ft_metadata'],\n changeMethods: [],\n })\n .then((contract) => contract.ft_metadata())\n )\n );\n const tokensContractMapping = tokenContracts.map((tokenContract, i) => {\n return {\n key: tokenContract,\n val: async (): Promise<TokenInfo> => {\n return {\n ...ft_metadatas[i],\n contractAddress: tokenContract,\n chain: Chain.NEAR,\n type: 'COIN',\n };\n },\n };\n });\n const tokens = tokenContracts.map((tokenContract, i) => {\n return {\n key: ft_metadatas[i].symbol,\n val: async (): Promise<TokenInfo> => {\n return {\n ...ft_metadatas[i],\n contractAddress: tokenContract,\n chain: Chain.NEAR,\n type: 'COIN',\n };\n },\n };\n });\n return {\n nativeTokenInfo: thunky(() => getTokenInfo(Chain.NEAR)),\n tokens: {\n ...arrayToObject(tokens),\n ...arrayToObject(tokensContractMapping),\n },\n supportedContractTokenContracts: tokenContracts,\n };\n}\n","module.exports = require(\"elliptic\");","export * from './lib/near';\nexport * from './lib/utils';\nexport * from './lib/constants';\nexport * from './lib/rpc';\n","import {\n Body,\n Controller,\n Get,\n Path,\n Post,\n Query,\n Route,\n SuccessResponse,\n} from 'tsoa';\n\nimport {\n createNearAccount,\n // createNearAccount,\n getAccountInfoFromSecpPK,\n getAccountNonce,\n NearAccountInfo,\n} from '../service/near';\nimport {\n ed25519Marker,\n Encoding,\n PublicKey,\n secp256k1Marker,\n} from '@baf-wallet/interfaces';\nimport { getTorusPublicAddress } from '@baf-wallet/torus';\nimport { hexString } from './common';\nimport { pkFromString } from '@baf-wallet/crypto';\n\ninterface CreateNearAccountParams {\n userID: string;\n nonce: hexString;\n secpSigHex: hexString;\n secpSig_s: hexString;\n edPubkey: hexString;\n edSigHex: hexString;\n accountID: string;\n}\n\n@Route('near')\nexport class NearController extends Controller {\n @SuccessResponse('204')\n @Post('account')\n public async createNearAccount(\n @Body() requestBody: CreateNearAccountParams\n ): Promise<void> {\n const secpPubkey = await getTorusPublicAddress(\n requestBody.userID,\n 'discord'\n );\n\n await createNearAccount(\n secpPubkey,\n pkFromString(requestBody.edPubkey, ed25519Marker, Encoding.HEX),\n requestBody.userID,\n requestBody.nonce,\n requestBody.secpSigHex,\n requestBody.secpSig_s,\n requestBody.edSigHex,\n requestBody.accountID\n );\n }\n\n @SuccessResponse('200')\n @Get('account/{secpPubkeyB58}/nonce')\n public async getAccountNonce(@Path() secpPubkeyB58: string): Promise<string> {\n const pk = pkFromString(secpPubkeyB58, secp256k1Marker, Encoding.BS58);\n return await getAccountNonce(pk);\n }\n\n @SuccessResponse('200')\n @Get('account/{secpPubkeyB58}/id')\n public async getAccountInfo(\n @Path() secpPubkeyB58: string\n ): Promise<NearAccountInfo> {\n const pk = pkFromString(secpPubkeyB58, secp256k1Marker, Encoding.BS58);\n return await getAccountInfoFromSecpPK(pk);\n }\n}\n","import {\n ed25519,\n Encoding,\n PublicKey,\n secp256k1,\n} from '@baf-wallet/interfaces';\nimport {\n getGlobalContract,\n setGlobalContract,\n} from '@baf-wallet/global-contract';\nimport { createUserVerifyMessage, encodeBytes } from '@baf-wallet/utils';\nimport { verifySignature } from '@baf-wallet/crypto';\nimport { BafError } from '@baf-wallet/errors';\nimport { getNearChain } from '@baf-wallet/global-state';\n\nexport interface NearAccountInfo {\n near_id: string | null;\n}\n\n// Check the found public key verifies the signature produced by (nonce + userId)\nexport async function createNearAccount(\n secpPK: PublicKey<secp256k1>,\n edPK: PublicKey<ed25519>,\n userId: string,\n nonce: string,\n secpSig: string,\n rustEncodedSecpSig: string,\n edSig: string,\n accountID: string\n) {\n const msg = createUserVerifyMessage(userId, nonce);\n if (!verifySignature(secpPK, msg, encodeBytes(secpSig, Encoding.HEX))) {\n throw BafError.InvalidSignature(secpPK);\n }\n if (!verifySignature(edPK, msg, encodeBytes(edSig, Encoding.HEX))) {\n throw BafError.InvalidSignature(edPK);\n }\n\n const near = await getNearChain();\n\n const nearAccount = near.accounts;\n await nearAccount.create({\n accountID,\n newAccountPk: edPK,\n });\n\n const CommunityContract = await getGlobalContract();\n await CommunityContract.set_account_info({\n secp_pk: secpPK.format(Encoding.ARRAY) as number[],\n user_name: userId,\n secp_sig_s: [...encodeBytes(rustEncodedSecpSig, Encoding.HEX)],\n new_account_id: accountID,\n });\n}\n\nexport async function getAccountNonce(\n pk: PublicKey<secp256k1>\n): Promise<string> {\n return await getGlobalContract().get_account_nonce({\n secp_pk: pk.format(Encoding.ARRAY) as number[],\n });\n}\n\nexport async function getAccountInfoFromSecpPK(\n pk: PublicKey<secp256k1>\n): Promise<NearAccountInfo> {\n return {\n near_id: await getGlobalContract().getAccountId(pk),\n };\n}\n","module.exports = require(\"body-parser\");","module.exports = require(\"@tsoa/runtime\");","module.exports = require(\"bs58\");","module.exports = require(\"near-api-js/lib/account_creator\");","module.exports = require(\"near-api-js/lib/key_stores\");","module.exports = require(\"@toruslabs/torus.js\");","export enum Env {\n DEV,\n TEST,\n PROD,\n}\n","import { PublicKey, SecretKey, KeyPair, secp256k1, ed25519 } from './crypto';\nimport { Pair } from '@baf-wallet/utils';\nimport { Account as NearAccount, Contract } from 'near-api-js';\nimport { GenericTxAction, GenericTxParams } from './tx';\nimport { Env } from './configs';\nimport { TokenInfo } from '..';\n\nexport enum Chain {\n NEAR = 'near',\n}\n\n// Or the type with all the supported chain account types\nexport type ChainAccount = NearAccount;\n\nexport type Balance = string;\n\nexport interface ChainBalance {\n chain: Chain;\n balance: Balance;\n}\n\nexport interface CommonInitParams {\n supportedContractTokens: string[];\n}\n\nexport type ExplorerLink = string;\n\n/**\n * It is encouraged to store mappings from both token symbols to token infos and from\n * token contract addresses to infos\n */\nexport interface ContractTokensConstant {\n [tokenSymbolOrAddress: string]: () => Promise<TokenInfo>;\n}\nexport interface ChainConstants {\n nativeTokenInfo: () => Promise<TokenInfo>;\n tokens: ContractTokensConstant;\n supportedContractTokenContracts: string[];\n}\n\nexport interface AccountsInterface<Account, LookupParams, CreateParams> {\n lookup: (params: LookupParams) => Promise<Account>;\n create: (params: CreateParams) => Promise<Account>;\n masterAccount: Account;\n getGenericMasterAccount: () => GenericAccount;\n associatedKeys: <T>(account: Account) => Promise<PublicKey<T>[]>;\n}\n\nexport type AccountContractTokenBalFn = (\n contractAddress: string\n) => Promise<Balance>;\n\nexport interface GenericAccount {\n getBalance: () => Promise<Balance>;\n getContractTokenBalance: AccountContractTokenBalFn;\n}\n\n// bare minimum interface representing direct RPC methods to the chain\n// chains are expected to extend this with their own functions and/or values\nexport interface RpcInterface<Tx, SignedTx, SendOpts, SendResult> {\n endpoint: (network?: string) => string;\n}\n\n// minimum interface representing all transaction-related operations\n// chains are expected to extend this with their own functions and/or values\nexport interface TxInterface<\n Tx,\n BuildTxParams,\n SignedTx,\n SignOpts,\n SendOpts,\n SendResult\n> {\n build: (params: BuildTxParams) => Promise<Tx>;\n sign: <Curve>(\n tx: Tx,\n keyPair: KeyPair<Curve>,\n opts?: SignOpts\n ) => Promise<SignedTx>;\n send: (\n tx: Tx | SignedTx,\n opts?: SendOpts\n ) => Promise<Pair<SendResult, ExplorerLink>>;\n buildParamsFromGenericTx: (\n params: GenericTxParams,\n senderPkEd: PublicKey<ed25519>,\n recipientPk?: PublicKey<secp256k1> | null\n ) => Promise<BuildTxParams>;\n extractGenericActionsFromTx: (params: BuildTxParams) => GenericTxAction[];\n}\n\nexport interface ContractInterface<Contract, ContractInitParams> {\n init: (params: ContractInitParams) => Promise<Contract>;\n}\n\n// utility for going to/from key BAF Wallet unified types\n// each instance expected to be specific to a particular sdk so that\n// we aren't ever locked into using BAF types and reimplementing wheelsA\n// chains are expected to extend this with their own functions and/or values\nexport interface Converter<PK, SK, KP> {\n skFromUnified: <Curve>(unifiedSk: SecretKey<Curve>) => SK;\n skToUnified: <Curve>(sk: SK, curveMarker: Curve) => PublicKey<Curve>;\n pkFromUnified: <Curve>(unifiedPk: PublicKey<Curve>) => PK;\n pkToUnified: <Curve>(pk: PK, curveMarker: Curve) => SecretKey<Curve>;\n keyPairFromUnified: <Curve>(unifiedKeyPair: KeyPair<Curve>) => KP;\n keyPairToUnified: <Curve>(\n unifiedKeyPair: KP,\n curveMaker: Curve\n ) => KeyPair<Curve>;\n // add more methods for converting shit as necessary\n}\n","import { jsonObject, jsonMember, jsonArrayMember } from 'typedjson';\nimport { Chain } from '..';\n@jsonObject\nexport class SocialMediaInfo {\n @jsonMember(String)\n public name: string; // platform\n @jsonMember(String)\n public url: string;\n @jsonMember(String)\n public handle: string;\n}\n\n// The structure associated with the token info's found on https://github.com/bafnetwork/assets\n@jsonObject\nexport class TokenInfoAssets {\n @jsonMember(String)\n public name: string;\n @jsonMember(String)\n public website?: string;\n @jsonMember(String)\n public source_code?: string;\n @jsonMember(String)\n public white_paper?: string;\n @jsonMember(String)\n public description?: string;\n @jsonArrayMember(SocialMediaInfo)\n public socials?: SocialMediaInfo[];\n @jsonMember(String)\n public explorer?: string;\n @jsonMember(String)\n public symbol: string;\n @jsonMember(String)\n public type: 'COIN' | 'NFT';\n @jsonMember(Number)\n public decimals: number;\n @jsonMember(String)\n public status?: 'active' | 'abandoned';\n @jsonArrayMember(String)\n public tags?: string[];\n}\n\nexport interface TokenInfo extends TokenInfoAssets {\n chain: Chain;\n contractAddress: string;\n}\n","import { SupportedCurve, KeyPair } from './crypto';\n\nexport enum KeySourceMethod {\n TORUS,\n LOCAL_STORAGE,\n // e.g. file, ledger, brain, etc, as they are implemented\n}\n\n// `KeyID` is a type that represents the type used to \"look up\" a key\n// in theory this could be the public key itself, but some source mechanisms\n// may offer different ways of doing so, for instance the key for use in localStorage.setItem\n// a file path, or a derived account number for a keypair stored on a ledger nano\nexport interface KeySource<KeyID> {\n method: KeySourceMethod;\n getKeyPair: <Curve>(\n keyID: KeyID,\n curveMarker: Curve\n ) => Promise<KeyPair<Curve> | null>;\n\n // these methods are for the off-chance that you don't know which curve a particular key-pair is on\n // to use this, you'd typically call this and then case on the returned value\n // for the vast majority of cases there will be only one curve used by a particular key source mechansim\n // so these method aren't required.\n // implementors are expected to implement either all of these methods or none of them.\n getKeyCurve?: (keyID: KeyID) => Promise<SupportedCurve>;\n getKeyPairUnknownCurve?: (keyID: KeyID) => Promise<KeyPair<SupportedCurve>>;\n}\n\n// then every keySource implementation should provide this function\nexport type KeySourceInitFn<KeyID, InitParams> = (\n params: InitParams\n) => Promise<KeySource<KeyID>>;\n\nexport type KeySourceInferKeyID<T> = T extends KeySource<infer KeyID>\n ? KeyID\n : never;\nexport type KeySourceInitFnInferInitParams<T> = T extends KeySourceInitFn<\n infer _,\n infer InitParams\n>\n ? InitParams\n : never;\n","import { Buffer } from 'buffer';\n\nexport type secp256k1 = {\n toString: () => 'secp256k1';\n};\n\nexport type ed25519 = {\n toString: () => 'ed25519';\n};\n\nexport const ED25519_STR = 'ed25519';\nexport const SECP256K1_STR = 'secp256k1';\n\nexport const secp256k1Marker: secp256k1 = { toString: () => SECP256K1_STR };\nexport const ed25519Marker: ed25519 = { toString: () => ED25519_STR };\n\nexport type SupportedCurve = secp256k1 | ed25519;\n\nexport enum Encoding {\n BS58,\n HEX,\n UTF8,\n ARRAY,\n}\n\nexport interface PublicKey<Curve> {\n data: Buffer;\n curve: Curve;\n format: (fmt: Encoding) => string | number[];\n}\n\nexport interface SecretKey<Curve> {\n data: Buffer;\n curve: Curve;\n format: (fmt: Encoding) => string | number[];\n}\n\nexport interface KeyPair<Curve> {\n curve: Curve;\n sk: SecretKey<Curve>;\n pk: PublicKey<Curve>;\n}\n/**\n * A hex encoded string for the signature where sig.s is concated with sig.r\n */\nexport type RustEncodedSecpSig = number[];\n","import { ed25519, PublicKey, secp256k1 } from './crypto';\nimport { PLATFORM } from './platforms';\n\nexport enum GenericTxSupportedActions {\n TRANSFER = 'transfer',\n TRANSFER_CONTRACT_TOKEN = 'transfer contract token',\n TRANSFER_NFT = 'transfer nft',\n CONTRACT_CALL = 'contract call',\n}\n\n/**\n * Either the recipientUserId or recipientAddress has to be provided\n */\nexport interface GenericTxParams {\n recipientAddress?: string;\n recipientUserId?: string;\n oauthProvider?: PLATFORM;\n actions: GenericTxAction[];\n}\n\ninterface GenericTxActionBase {\n type: GenericTxSupportedActions;\n}\n\nexport interface GenericTxActionTransfer extends GenericTxActionBase {\n type: GenericTxSupportedActions.TRANSFER;\n // Amount is the quantity of the minimal sendable unit for a currency\n amount: string;\n}\n\nexport interface GenericTxActionContractCall extends GenericTxActionBase {\n type: GenericTxSupportedActions.CONTRACT_CALL;\n functionName: string;\n functionArgs: any;\n // a number in string form\n gasFee?: string;\n // a number in string form\n deposit?: string;\n}\n\n// An NFT connotes an ERC721 NFT, NEP 4 NFT, etc\nexport interface GenericTxActionTransferNFT extends GenericTxActionBase {\n type: GenericTxSupportedActions.TRANSFER_NFT;\n // The token's id\n tokenId: string;\n // Contract Address or Account ID\n contractAddress: string;\n // Amount is the number of NFTs to send if the contract support semi-fungible NFTs,\n // the amount should default to 1\n amount?: string;\n // An optional string with which to associate a transfer. Some chains support this as a feature\n memo?: string;\n // An optional string which is used with approval management standards which some chains have\n // like Near\n approvalId?: string;\n}\n// A contract token connotes an ERC21 token, SPL token, NEP 141 token etc\nexport interface GenericTxActionTransferContractToken\n extends GenericTxActionBase {\n type: GenericTxSupportedActions.TRANSFER_CONTRACT_TOKEN;\n // Contract Address or Account ID\n contractAddress: string;\n // Amount is the quantity of the minimal sendable unit for a currency\n amount: string;\n // An optional string with which to associate a transfer. Some chains support this as a feature\n memo?: string;\n}\n\n// To be or'd with whatever other actions we use\nexport type GenericTxAction =\n | GenericTxActionTransfer\n | GenericTxActionTransferContractToken\n | GenericTxActionTransferNFT\n | GenericTxActionContractCall;\n\nexport enum SupportedTransferTypes {\n NativeToken = 'Native Token',\n ContractToken = 'Contract Token',\n}\n","export * from './hash';\nexport * from './index';\nexport * from './keys';\nexport * from './sign';\nexport * from './utils';\n","export * from './keys';\nexport * from './hash';\nexport * from './sign';\n","import {\n Chain,\n PublicKey,\n ed25519,\n secp256k1,\n Encoding,\n} from '@baf-wallet/interfaces';\n\nexport namespace BafError {\n export const UninitChain = (chain: Chain) =>\n emitError(`You must initialize your account on ${chain} first.`);\n export const InvalidSignature = (pk: PublicKey<ed25519 | secp256k1>) =>\n emitError(\n `An invalid signature has been provided for ${pk.format(Encoding.HEX)}`\n );\n export const Unimplemented = () => emitError('Unimplemented');\n export const InvalidTransactionApproveRedirect = () =>\n emitError(\n \"The transaction must be either in the url or passed in through the component's state\"\n );\n export const InvalidPackedKey = () =>\n emitError('The key in storage has an invalid format');\n export const UnsupportedKeyCurve = (supportedCurve: string) =>\n emitError(`Only ${supportedCurve} keys are supported`);\n export const BlockedByCors = () => emitError('Not allowed by CORS policy');\n export const UninitGlobalContract = () =>\n emitError(\n 'Global Contract is not initialized yet, please call setGlobalContract'\n );\n export const UnintCommunityContract = () =>\n emitError(\n 'Community Contract is not initialized yet, please call setCommunityContract'\n );\n export const UnsupportedToken = (tokenName: string) =>\n emitError(`Unsupported token ${tokenName}`);\n export const UnsupportedChain = (chainName: string) =>\n emitError(`Unsupported blockchain ${chainName}`);\n export const MissingInitBalance = (chain: Chain) =>\n emitError(\n `An initial balance must be specified when initializing an account on ${chain}`\n );\n export const MissingKeyPair = () => {\n emitError('A key path or key pair must be provided');\n };\n export const UnknownNetworkIdent = (identifier: string) =>\n emitError(`Unknown network identifier ${identifier}`);\n export const InvalidChainTokenListJSON = (err: any) =>\n emitError(\n `Received invalid tokenlist.json: ${err}. See \\`ChainInfo\\` in chain-info/src/lib/chain-info.ts for more information`\n );\n export const InvalidChainInfoJSON = (err: any) =>\n emitError(\n `Received invalid info.json: ${err}. See \\`ChainInfo\\` in chain-info/src/lib/chain-info.ts for more information`\n );\n export const UnsupportedEncoding = (fmt: any) =>\n emitError(`Encoding for format ${fmt} is unsupported`);\n export const GenericTxRequiresOauthInfo = () =>\n emitError(\n `The generic transaction requires the recipient user id, its readable form, and the oauth provider`\n );\n export const SecpPKNotAssociatedWithAccount = (chain: Chain) =>\n emitError(\n `The provided public key is not associated with an account on ${chain}`\n );\n export const NonuniformTxActionRecipients = (chain: Chain) =>\n emitError(`${chain} only supports one recipient for a set of Tx Actions`);\n export const MissingContractAddress = () =>\n emitError(`The contract address must be specified`);\n export const InvalidTokenContractAddress = (addr: string) =>\n emitError(`Address ${addr} does not exist or is not a token contract`);\n export const InvalidContractAddress = (addr: string) =>\n emitError(`Address ${addr} does not exist or is not a contract`);\n}\n\n// A wrapper function to emit an error, this would allow us to do things such as easier Sentry logging\nfunction emitError(errStr: string) {\n return new Error(errStr);\n}\n","export * from './bytes';\nexport * from './chains';\nexport * from './conversions';\nexport * from './discord';\nexport * from './types';\nexport * from './user-verifier';\nexport * from './serialize';\n","import { Chain } from '@baf-wallet/interfaces';\nimport { getEnumValues } from './types';\nimport { BafError } from '@baf-wallet/errors';\nimport BN from 'bn.js';\n\nexport const strToChain = (chain: string): Chain | null => {\n return getEnumValues(Chain).includes(chain.toLowerCase())\n ? (chain as Chain)\n : null;\n};\n\nexport function formatTokenAmountToIndivisibleUnit(\n amount: number,\n decimals: number\n): string {\n const expStr = `${1}${new Array(decimals).fill('0').join('')}`;\n const exp = new BN(expStr);\n console.log(exp.muln(amount), amount);\n return exp.muln(amount).toString(10);\n}\n","import {\n Converter,\n SecretKey,\n PublicKey,\n Encoding,\n KeyPair,\n} from '@baf-wallet/interfaces';\nimport { formatBytes } from './bytes';\nimport { Pair } from './types';\nimport { Buffer } from 'buffer';\n\nexport const bufferConverter: Converter<\n Buffer,\n Buffer,\n Pair<Buffer, Buffer>\n> = {\n skFromUnified,\n skToUnified,\n pkFromUnified,\n pkToUnified,\n keyPairFromUnified,\n keyPairToUnified,\n};\n\nfunction skFromUnified<Curve>(unifiedSk: SecretKey<Curve>): Buffer {\n return Buffer.from(unifiedSk.data);\n}\n\nfunction skToUnified<Curve>(sk: Buffer, curveMarker: Curve): SecretKey<Curve> {\n const data = Buffer.from(sk);\n return {\n data,\n curve: curveMarker,\n format: (fmt: Encoding) => formatBytes(data, fmt),\n };\n}\n\nfunction pkFromUnified<Curve>(bafPk: PublicKey<Curve>): Buffer {\n return Buffer.from(bafPk.data);\n}\n\nfunction pkToUnified<Curve>(pk: Buffer, curveMarker: Curve): PublicKey<Curve> {\n const data = Buffer.from(pk);\n return {\n data,\n curve: curveMarker,\n format: (fmt: Encoding) => formatBytes(data, fmt),\n };\n}\n\nfunction keyPairFromUnified<Curve>(\n unifiedKeyPair: KeyPair<Curve>\n): Pair<Buffer, Buffer> {\n const { pk, sk } = unifiedKeyPair;\n return {\n fst: Buffer.from(sk.data),\n snd: Buffer.from(pk.data),\n };\n}\n\nfunction keyPairToUnified<Curve>(\n keyPair: Pair<Buffer, Buffer>,\n curveMarker: Curve\n): KeyPair<Curve> {\n const skBytes = keyPair.fst;\n const pkBytes = keyPair.snd;\n return {\n curve: curveMarker,\n sk: skToUnified(skBytes, curveMarker),\n pk: pkToUnified(pkBytes, curveMarker),\n };\n}\n","/**\n *\n * @param recipient the snowflake ID recieved by the discord bot. Ex, <@86890631690977280>\n * @returns the snowflake ID, ex 86890631690977280\n */\nexport const parseDiscordRecipient = (recipient: string): string | null => {\n try {\n const recipientParsed = recipient.split('<@!')[1].split('>')[0];\n return recipientParsed;\n } catch (e) {\n return null;\n }\n};\n\nexport const createDiscordErrMsg = (err: any): string => {\n return `🚧 an error has occurred 🚧:\n \\n\\`${err}\\`\n \\nPlease create an issue at https://github.com/bafnetwork/baf-wallet-v2/issues and HODL tight until we fix it.`;\n};\n","export function createUserVerifyMessage(userId: string, nonce: string) {\n return `${userId}:${nonce}`;\n}\n","export const serializeData = (data: any) => JSON.stringify(data);\n// TODO: add type checking. See https://github.com/bafnetwork/baf-wallet-v2/issues/36\nexport const deserializeData = <T>(uriEncoded: string) =>\n JSON.parse(uriEncoded) as T;\n","import { Encoding, PublicKey, SecretKey } from '@baf-wallet/interfaces';\nimport { encodeBytes, formatBytes } from '@baf-wallet/utils';\n\nexport function pkToString<Curve>(\n key: PublicKey<Curve>,\n keyFormat = Encoding.HEX\n): string {\n return formatBytes(key.data, keyFormat) as string;\n}\n\nexport function pkFromString<Curve>(\n key: string,\n curve: Curve,\n keyFormat = Encoding.HEX\n): PublicKey<Curve> {\n const data = encodeBytes(key, keyFormat);\n return {\n data,\n curve,\n format: (fmt: Encoding) => formatBytes(data, fmt),\n };\n}\n\nexport function skFromString<Curve>(\n key: string,\n curve: Curve,\n keyFormat = Encoding.HEX\n): SecretKey<Curve> {\n const data = encodeBytes(key, keyFormat);\n return {\n data,\n curve,\n format: (fmt: Encoding) => formatBytes(data, fmt),\n };\n}\n","import { ed25519, Encoding, KeyPair } from '@baf-wallet/interfaces';\nimport {\n Account,\n connect,\n ConnectConfig,\n KeyPair as NearKeyPair,\n Near,\n providers,\n transactions,\n utils as NearUtils,\n} from 'near-api-js';\n\nimport { NearBuildTxParams, NearSignTxOpts, nearTx } from './tx';\nimport {\n initContract,\n NearInitContractParams,\n NEP141Contract,\n} from './contract';\nimport {\n getHelperUrl,\n getRPCUrl,\n nearRpc,\n NearSendOpts,\n NearSendResult,\n} from './rpc';\nimport {\n NearAccountID,\n nearAccounts,\n NearCreateAccountParams,\n} from './accounts';\nimport { nearConverter } from './convert';\nimport { NearNetworkID } from './utils';\nimport { InMemoryKeyStore } from 'near-api-js/lib/key_stores';\nimport { KeyPairEd25519 as NearKeyPairEd25519 } from 'near-api-js/lib/utils';\nimport { BafError } from '@baf-wallet/errors';\nimport { getContract } from './contract';\nimport { getChainConstants } from './constants';\nimport { ThenArg } from '@baf-wallet/utils';\n\nexport type { NearAccountID, NearCreateAccountParams } from './accounts';\nexport type {\n NearTransaction,\n NearBuildTxParams,\n NearAction,\n NearSupportedActionTypes,\n} from './tx';\nexport interface NearState {\n near: Near;\n rpcProvider: providers.JsonRpcProvider;\n networkID: NearNetworkID;\n nearMasterAccount: Account;\n getFungibleTokenContract: (contractName: string) => Promise<NEP141Contract>;\n}\n\nexport interface NearInitParams {\n networkID: NearNetworkID;\n masterAccountID: NearAccountID;\n keyPath?: string;\n keyPair?: KeyPair<ed25519>;\n}\n\nexport const getNearChainInterface = async (params: NearInitParams) => {\n const state = await init(params);\n return {\n accounts: nearAccounts(state),\n tx: nearTx(state),\n convert: nearConverter,\n rpc: nearRpc,\n getContract,\n constants: await getChainConstants(state),\n };\n};\nexport type NearChainInterface = ThenArg<\n ReturnType<typeof getNearChainInterface>\n>;\n\nasync function init({\n networkID,\n masterAccountID,\n keyPath,\n keyPair,\n}: NearInitParams): Promise<NearState> {\n const nodeUrl = getRPCUrl(networkID);\n const connectConfig = {\n networkId: networkID,\n nodeUrl,\n helperUrl: getHelperUrl(networkID),\n masterAccount: masterAccountID,\n keyPath,\n } as ConnectConfig;\n if (keyPair) {\n const keyStore = new InMemoryKeyStore();\n const nearKp = new NearKeyPairEd25519(\n keyPair.sk.format(Encoding.BS58) as string\n );\n keyStore.setKey(networkID, masterAccountID, nearKp);\n connectConfig.deps = {\n keyStore: keyStore,\n };\n connectConfig.keyStore = keyStore;\n } else if (keyPath) {\n const keyStore = new InMemoryKeyStore();\n connectConfig.deps = {\n keyStore: keyStore,\n };\n } else {\n throw BafError.MissingKeyPair();\n }\n\n const near = await connect(connectConfig);\n\n const nearMasterAccount = await near.account(masterAccountID);\n return {\n near,\n networkID,\n rpcProvider: new providers.JsonRpcProvider(nodeUrl),\n nearMasterAccount,\n getFungibleTokenContract: (contractAccountID: string) =>\n initContract(\n nearMasterAccount,\n contractAccountID\n )({\n viewMethods: ['ft_balance_of', 'ft_total_supply', 'storage_balance_of'],\n changeMethods: ['ft_transfer'],\n }),\n };\n}\n","import { Account, Contract } from 'near-api-js';\nimport { BafError } from '@baf-wallet/errors';\nimport ContractConfig from '../../config.json';\nimport {\n Encoding,\n PublicKey,\n RustEncodedSecpSig,\n secp256k1,\n} from '@baf-wallet/interfaces';\nimport { NearAccountID } from '@baf-wallet/near';\nimport { initContract, NearContract } from 'libs/near/src/lib/contract';\n\nexport const GlobalContractConfig = { ...ContractConfig };\n\ninterface GlobalContract extends NearContract {\n getAccountId: (pk: PublicKey<secp256k1>) => Promise<string>;\n get_account_info: (args: {\n secp_pk: number[];\n }) => Promise<{\n user_name: string;\n account_id: string;\n }>;\n get_account_nonce: (args: { secp_pk: number[] }) => Promise<string>;\n set_account_info: (args: {\n secp_pk: number[];\n user_name: string;\n secp_sig_s: RustEncodedSecpSig;\n new_account_id: NearAccountID;\n }) => Promise<void>;\n delete_account_info: (args: {\n secp_pk: number[];\n user_name: string;\n secp_sig_s: RustEncodedSecpSig;\n }) => Promise<void>;\n get_community_contract: (args: { server: string }) => Promise<string>;\n get_community_default_nft_contract: (args: {\n server: string;\n }) => Promise<string>;\n set_community_default_nft_contract: (args: {\n server: string;\n nft_contract: string;\n }) => Promise<void>;\n}\n\nlet globalContract: GlobalContract;\n\nexport async function setGlobalContract(\n account: Account\n): Promise<GlobalContract> {\n globalContract = await buildGlobalContract(account);\n return globalContract;\n}\n\nexport function getGlobalContract(): GlobalContract {\n if (globalContract) return globalContract;\n throw BafError.UninitGlobalContract();\n}\n\nasync function buildGlobalContract(account: Account): Promise<GlobalContract> {\n const contract = await initContract(\n account,\n ContractConfig.contractName\n )<GlobalContract>({\n viewMethods: [\n 'get_account_info',\n 'get_account_nonce',\n 'get_community_contract',\n 'get_community_default_nft_contract',\n ],\n changeMethods: [\n 'set_account_info',\n 'delete_account_info',\n 'set_community_default_nft_contract',\n ],\n });\n return {\n ...contract,\n getAccountId: async (pk) =>\n (\n await contract.get_account_info({\n secp_pk: pk.format(Encoding.ARRAY) as number[],\n })\n )?.account_id,\n };\n}\n","export const globalContractConstants = {\n // :)\n beneficiaryId: 'lev.near',\n};\n","import axios from 'axios';\nimport { BafError } from '@baf-wallet/errors';\nimport 'reflect-metadata';\nimport { jsonObject, jsonMember, TypedJSON, jsonArrayMember } from 'typedjson';\nimport {\n Chain,\n ContractTokensConstant,\n TokenInfo,\n TokenInfoAssets,\n} from '@baf-wallet/interfaces';\n\nconst baseRawUrl = 'https://raw.githubusercontent.com/bafnetwork/assets/master';\nconst contentsApiUrl =\n 'https://api.github.com/repos/bafnetwork/assets/contents';\n\n// typed JSON objects for parsing info.json's from trustwallet's assets repo\n// e.g. https://github.com/trustwallet/assets/blob/master/blockchains/bitcoin/info/info.json\n\n// TODO: have some intelligent way to get the rest\nexport type DappUrl =\n | '0x.org'\n | '1inch.exchange'\n | 'aave.com'\n | 'aavegotchi.com'\n | 'app.aave.com'\n | 'app.compound.finance'\n | 'app.ens.domains'\n | 'app.paraswap.io'\n | 'app.pooltogether.com'\n | 'app.uniswap.org'\n | 'axieinfinity.com'\n | 'balancer.finance'\n | 'bank.spankchain.com'\n | 'cdp.makerdao'\n | 'compound.finance'\n | 'curve.fi'\n | 'dydx.exhange'\n | 'ens.domains'\n | 'info.uniswap.org'\n | 'instadapp.io'\n | 'kyber.network'\n | 'kyber.org'\n | 'market.decentraland.org'\n | 'marketplace.axieinfinity.com'\n | 'opensea.io'\n | 'pooltogether.com'\n | 'pooltogether.us'\n | 'rarible.com'\n | 'snark.art'\n | 'uniswap.io'\n | 'uniswap.exchange'\n | 'yearn.finance';\n\nexport const getChainFolderPrefix = (chain: Chain): string =>\n `${baseRawUrl}/blockchains/${chain}`;\n\nconst getNonNativeTokenInfoUrl = (\n chain: Chain,\n contractAddress: string\n): string =>\n `${getChainFolderPrefix(chain)}/assets/${contractAddress}/info.json`;\n\nconst getChainInfoUrl = (chain: Chain): string =>\n `${getChainFolderPrefix(chain)}/info/info.json`;\n\nconst getNonNativeTokenLogoUrl = (\n chain: Chain,\n contractAddress: string\n): string =>\n `${getChainFolderPrefix(chain)}/assets/${contractAddress}/logo.png`;\n\nconst getChainLogoUrl = (chain: Chain): string =>\n `${getChainFolderPrefix(chain)}/info/logo.png`;\n\nexport const getTokenLogoUrl = (chain: Chain, contractAddress?: string) =>\n chain === contractAddress || !contractAddress\n ? getChainLogoUrl(chain)\n : getNonNativeTokenLogoUrl(chain, contractAddress);\n\nexport const getDappLogoUrl = (dappUrl: DappUrl): string =>\n `${baseRawUrl}/dapps/${dappUrl}.png`;\n\nexport async function getContractAddresses(\n chain: Chain,\n filterFn?: (contractInfoJSON: any) => boolean\n): Promise<string[]> {\n const url = `${contentsApiUrl}/blockchains/${chain}/assets`;\n try {\n const res = await axios.get(url);\n const { data } = res;\n\n if (filterFn) {\n return data.filter(filterFn).map((infoJSON) => infoJSON.name);\n }\n\n return data.map((infoJSON) => infoJSON.name);\n } catch (err) {\n console.error(`could not fetch addresses: ${err}`);\n return null;\n }\n}\n\nexport async function getTokenInfo(\n chain: Chain,\n contractAddress?: string\n): Promise<TokenInfo> {\n const tokenIsChain = chain === contractAddress || !contractAddress;\n const url = tokenIsChain\n ? getChainInfoUrl(chain)\n : getNonNativeTokenInfoUrl(chain, contractAddress);\n try {\n const res = await axios.get(url);\n const { data } = res;\n\n // remove binance shill link\n if (data.research !== undefined) {\n delete data.research;\n }\n\n const serializer = new TypedJSON(TokenInfoAssets);\n const _tokInfo = serializer.parse(data);\n return {\n ..._tokInfo,\n contractAddress,\n chain,\n };\n } catch (err) {\n if (err.isAxiosError) {\n console.error(\n `Chain not found: only chains in ${baseRawUrl} are supported.`\n );\n return null;\n }\n throw BafError.InvalidChainInfoJSON(err);\n }\n}\n\nexport async function getContractTokenInfoFromSymbol(\n symbol: string,\n contractTokens: ContractTokensConstant\n): Promise<{ tokenInfo: TokenInfo; contract: string } | null> {\n const contracts = Object.keys(contractTokens);\n const tokenProms = contracts.map((contract) => contractTokens[contract]());\n const tokenInfos = await Promise.all(tokenProms);\n const ind = tokenInfos.map((tokenInfo) => tokenInfo.symbol).indexOf(symbol);\n if (ind === -1) return null;\n return { tokenInfo: tokenInfos[ind], contract: contracts[ind] };\n}\n","/**\n * singletons provides methods to initialize and get the wrapped chain interfaces\n */\nimport { Chain, Env } from '@baf-wallet/interfaces';\nimport { BafError } from '@baf-wallet/errors';\nimport {\n NearChainInterface,\n NearInitParams,\n getNearChainInterface,\n} from '@baf-wallet/near';\n\nlet nearChain: NearChainInterface;\nlet init = false;\n\nexport async function initNearChain(params: NearInitParams, env: Env) {\n nearChain = await getNearChainInterface(params);\n init = true;\n}\n\nexport function getNearChain(): NearChainInterface {\n if (!init) throw BafError.UninitChain(Chain.NEAR);\n return nearChain;\n}\n","import { Encoding, PublicKey, secp256k1 } from '@baf-wallet/interfaces';\nimport Torus from '@toruslabs/torus.js';\nimport NodeDetailsManager from '@toruslabs/fetch-node-details';\nimport * as fetch from 'node-fetch';\nimport { torusConstants, TORUS_LOGIN_TYPE } from './constants';\nimport { pkSecpFromXY } from '@baf-wallet/crypto';\n\nconst torus = new Torus({\n metadataHost: 'https://metadata.tor.us',\n allowHost: 'https://signer.tor.us/api/allow',\n});\nTorus.setAPIKey('torus-default');\n\nexport async function tryGetTorusPublicAddress(\n userId: string,\n loginType: TORUS_LOGIN_TYPE\n): Promise<PublicKey<secp256k1> | null> {\n try {\n return getTorusPublicAddress(userId, loginType);\n } catch (e) {\n return null;\n }\n}\n\nexport async function getTorusPublicAddress(\n userId: string,\n loginType: TORUS_LOGIN_TYPE\n): Promise<PublicKey<secp256k1>> {\n assertLoginTypeRegistered(loginType);\n // Configuration from https://github.com/torusresearch/torus-direct-web-sdk/blob/master/src/login.ts\n const nodeManager = new NodeDetailsManager({\n network: torusConstants.network as any,\n proxyAddress: torusConstants.proxyAddress,\n });\n\n const {\n torusNodeEndpoints,\n torusNodePub,\n torusIndexes,\n } = await nodeManager.getNodeDetails();\n\n (global as any).fetch = fetch;\n const torusPublicKey = await torus.getPublicAddress(\n torusNodeEndpoints,\n torusNodePub,\n {\n verifier: torusConstants.verifierInfo[loginType].verifier,\n verifierId: userId,\n },\n true\n );\n\n return pkSecpFromXY((torusPublicKey as any).X, (torusPublicKey as any).Y);\n}\n\nexport function assertLoginTypeRegistered(\n loginType: TORUS_LOGIN_TYPE\n): boolean {\n if (!torusConstants.verifierInfo[loginType])\n throw `No verifier info exits for login type ${loginType}`;\n return true;\n}\n","module.exports = require(\"express\");","/* tslint:disable */\n/* eslint-disable */\n// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\nimport { Controller, ValidationService, FieldErrors, ValidateError, TsoaRoute, HttpStatusCodeLiteral, TsoaResponse } from '@tsoa/runtime';\n// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\nimport { DiscordController } from './../src/app/controllers/DiscordController';\n// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\nimport { NearController } from './../src/app/controllers/NearController';\nimport * as express from 'express';\n\n// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\nconst models: TsoaRoute.Models = {\n \"RevokeTokenParams\": {\n \"dataType\": \"refObject\",\n \"properties\": {\n \"token\": {\"dataType\":\"string\",\"required\":true},\n },\n \"additionalProperties\": false,\n },\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n \"hexString\": {\n \"dataType\": \"refAlias\",\n \"type\": {\"dataType\":\"string\",\"validators\":{}},\n },\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n \"CreateNearAccountParams\": {\n \"dataType\": \"refObject\",\n \"properties\": {\n \"userID\": {\"dataType\":\"string\",\"required\":true},\n \"nonce\": {\"ref\":\"hexString\",\"required\":true},\n \"secpSigHex\": {\"ref\":\"hexString\",\"required\":true},\n \"secpSig_s\": {\"ref\":\"hexString\",\"required\":true},\n \"edPubkey\": {\"ref\":\"hexString\",\"required\":true},\n \"edSigHex\": {\"ref\":\"hexString\",\"required\":true},\n \"accountID\": {\"dataType\":\"string\",\"required\":true},\n },\n \"additionalProperties\": false,\n },\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n \"NearAccountInfo\": {\n \"dataType\": \"refObject\",\n \"properties\": {\n \"near_id\": {\"dataType\":\"union\",\"subSchemas\":[{\"dataType\":\"string\"},{\"dataType\":\"enum\",\"enums\":[null]}],\"required\":true},\n },\n \"additionalProperties\": false,\n },\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n};\nconst validationService = new ValidationService(models);\n\n// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\nexport function RegisterRoutes(app: express.Router) {\n // ###########################################################################################################\n // NOTE: If you do not see routes for all of your controllers in this file, then you might not have informed tsoa of where to look\n // Please look into the \"controllerPathGlobs\" config option described in the readme: https://github.com/lukeautry/tsoa\n // ###########################################################################################################\n app.post('/discord/revoke-token',\n function DiscordController_revokeToken(request: any, response: any, next: any) {\n const args = {\n accessToken: {\"in\":\"body\",\"name\":\"accessToken\",\"required\":true,\"ref\":\"RevokeTokenParams\"},\n };\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n let validatedArgs: any[] = [];\n try {\n validatedArgs = getValidatedArgs(args, request, response);\n } catch (err) {\n return next(err);\n }\n\n const controller = new DiscordController();\n\n\n const promise = controller.revokeToken.apply(controller, validatedArgs as any);\n promiseHandler(controller, promise, response, undefined, next);\n });\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n app.post('/near/account',\n function NearController_createNearAccount(request: any, response: any, next: any) {\n const args = {\n requestBody: {\"in\":\"body\",\"name\":\"requestBody\",\"required\":true,\"ref\":\"CreateNearAccountParams\"},\n };\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n let validatedArgs: any[] = [];\n try {\n validatedArgs = getValidatedArgs(args, request, response);\n } catch (err) {\n return next(err);\n }\n\n const controller = new NearController();\n\n\n const promise = controller.createNearAccount.apply(controller, validatedArgs as any);\n promiseHandler(controller, promise, response, undefined, next);\n });\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n app.get('/near/account/:secpPubkeyB58/nonce',\n function NearController_getAccountNonce(request: any, response: any, next: any) {\n const args = {\n secpPubkeyB58: {\"in\":\"path\",\"name\":\"secpPubkeyB58\",\"required\":true,\"dataType\":\"string\"},\n };\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n let validatedArgs: any[] = [];\n try {\n validatedArgs = getValidatedArgs(args, request, response);\n } catch (err) {\n return next(err);\n }\n\n const controller = new NearController();\n\n\n const promise = controller.getAccountNonce.apply(controller, validatedArgs as any);\n promiseHandler(controller, promise, response, undefined, next);\n });\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n app.get('/near/account/:secpPubkeyB58/id',\n function NearController_getAccountInfo(request: any, response: any, next: any) {\n const args = {\n secpPubkeyB58: {\"in\":\"path\",\"name\":\"secpPubkeyB58\",\"required\":true,\"dataType\":\"string\"},\n };\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n let validatedArgs: any[] = [];\n try {\n validatedArgs = getValidatedArgs(args, request, response);\n } catch (err) {\n return next(err);\n }\n\n const controller = new NearController();\n\n\n const promise = controller.getAccountInfo.apply(controller, validatedArgs as any);\n promiseHandler(controller, promise, response, undefined, next);\n });\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n function isController(object: any): object is Controller {\n return 'getHeaders' in object && 'getStatus' in object && 'setStatus' in object;\n }\n\n function promiseHandler(controllerObj: any, promise: any, response: any, successStatus: any, next: any) {\n return Promise.resolve(promise)\n .then((data: any) => {\n let statusCode = successStatus;\n let headers;\n if (isController(controllerObj)) {\n headers = controllerObj.getHeaders();\n statusCode = controllerObj.getStatus() || statusCode;\n }\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n returnHandler(response, statusCode, data, headers)\n })\n .catch((error: any) => next(error));\n }\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n function returnHandler(response: any, statusCode?: number, data?: any, headers: any = {}) {\n if (response.headersSent) {\n return;\n }\n Object.keys(headers).forEach((name: string) => {\n response.set(name, headers[name]);\n });\n if (data && typeof data.pipe === 'function' && data.readable && typeof data._read === 'function') {\n data.pipe(response);\n } else if (data !== null && data !== undefined) {\n response.status(statusCode || 200).json(data);\n } else {\n response.status(statusCode || 204).end();\n }\n }\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n function responder(response: any): TsoaResponse<HttpStatusCodeLiteral, unknown> {\n return function(status, data, headers) {\n returnHandler(response, status, data, headers);\n };\n };\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n\n function getValidatedArgs(args: any, request: any, response: any): any[] {\n const fieldErrors: FieldErrors = {};\n const values = Object.keys(args).map((key) => {\n const name = args[key].name;\n switch (args[key].in) {\n case 'request':\n return request;\n case 'query':\n return validationService.ValidateParam(args[key], request.query[name], name, fieldErrors, undefined, {\"noImplicitAdditionalProperties\":\"throw-on-extras\"});\n case 'path':\n return validationService.ValidateParam(args[key], request.params[name], name, fieldErrors, undefined, {\"noImplicitAdditionalProperties\":\"throw-on-extras\"});\n case 'header':\n return validationService.ValidateParam(args[key], request.header(name), name, fieldErrors, undefined, {\"noImplicitAdditionalProperties\":\"throw-on-extras\"});\n case 'body':\n return validationService.ValidateParam(args[key], request.body, name, fieldErrors, undefined, {\"noImplicitAdditionalProperties\":\"throw-on-extras\"});\n case 'body-prop':\n return validationService.ValidateParam(args[key], request.body[name], name, fieldErrors, 'body.', {\"noImplicitAdditionalProperties\":\"throw-on-extras\"});\n case 'formData':\n if (args[key].dataType === 'file') {\n return validationService.ValidateParam(args[key], request.file, name, fieldErrors, undefined, {\"noImplicitAdditionalProperties\":\"throw-on-extras\"});\n } else if (args[key].dataType === 'array' && args[key].array.dataType === 'file') {\n return validationService.ValidateParam(args[key], request.files, name, fieldErrors, undefined, {\"noImplicitAdditionalProperties\":\"throw-on-extras\"});\n } else {\n return validationService.ValidateParam(args[key], request.body[name], name, fieldErrors, undefined, {\"noImplicitAdditionalProperties\":\"throw-on-extras\"});\n }\n case 'res':\n return responder(response);\n }\n });\n\n if (Object.keys(fieldErrors).length > 0) {\n throw new ValidateError(fieldErrors, '');\n }\n return values;\n }\n\n // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n}\n\n// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa\n","import {\n Body,\n Controller,\n Get,\n Path,\n Post,\n Route,\n SuccessResponse,\n} from 'tsoa';\nimport {\n discordRevokeAccessToken,\n DiscordPublicInfo,\n} from '../service/discord';\n\ninterface RevokeTokenParams {\n token: string;\n}\n\n@Route('discord')\nexport class DiscordController extends Controller {\n @SuccessResponse('204')\n @Post('revoke-token')\n public async revokeToken(\n @Body() accessToken: RevokeTokenParams\n ): Promise<void> {\n await discordRevokeAccessToken(accessToken.token);\n }\n}\n","import FormData from 'form-data';\nimport axios from 'axios';\nimport { constants } from '../config/constants';\nimport * as discord from 'discord.js';\n\nexport interface DiscordPublicInfo {\n verifierId: string;\n}\n\nexport async function discordRevokeAccessToken(token: string) {\n const formData = new FormData();\n formData.append('token', token);\n const res = await axios.post(\n 'https://discordapp.com/api/oauth2/token/revoke',\n formData,\n {\n headers: {\n ...formData.getHeaders(),\n Authorization: `Basic ${Buffer.from(\n `${constants.discord.clientId}:${constants.discord.clientSecret}`,\n 'binary'\n ).toString('base64')}`,\n },\n }\n );\n}\n","module.exports = require(\"form-data\");","module.exports = require(\"js-sha3\");","module.exports = require(\"js-sha256\");","import {\n KeyPair,\n TxInterface,\n PublicKey,\n secp256k1,\n ed25519,\n ExplorerLink,\n GenericTxParams,\n GenericTxSupportedActions,\n GenericTxAction,\n GenericTxActionTransfer,\n GenericTxActionTransferContractToken,\n Chain,\n GenericTxActionTransferNFT,\n GenericTxActionContractCall,\n} from '@baf-wallet/interfaces';\nimport { getGlobalContract } from '@baf-wallet/global-contract';\nimport { Pair } from '@baf-wallet/utils';\nimport { sha256 } from '@baf-wallet/crypto';\nimport { Buffer } from 'buffer';\nimport BN from 'bn.js';\nimport { transactions, utils } from 'near-api-js';\n\nimport { NearState } from './near';\nimport { NearSendOpts, NearSendResult } from './rpc';\nimport { NearAccountID } from './accounts';\nimport { nearConverter } from './convert';\nimport {\n Action as NearNativeAction,\n SignedTransaction,\n Transaction,\n} from 'near-api-js/lib/transaction';\nimport { BafError } from '@baf-wallet/errors';\n\nexport type NearTxInterface = TxInterface<\n Transaction,\n NearBuildTxParams,\n SignedTransaction,\n NearSignTxOpts,\n NearSendOpts,\n NearSendResult\n>;\nexport type NearSupportedActionTypes = GenericTxSupportedActions;\nexport type NearTransaction = Transaction;\n\nexport type NearAction = GenericTxAction;\nexport interface NearBuildTxParams {\n actions: NearAction[];\n senderPk: PublicKey<ed25519>;\n senderAccountID: NearAccountID;\n recipientAccountID: NearAccountID;\n}\n\n// eslint-disable-next-line\nexport interface NearSignTxOpts {}\n\nexport function nearTx(innerSdk: NearState): NearTxInterface {\n return {\n build: buildNearTx(innerSdk),\n sign: signNearTx,\n send: sendNearTx(innerSdk),\n buildParamsFromGenericTx: buildParamsFromGenericTx(innerSdk),\n extractGenericActionsFromTx,\n };\n}\n\nfunction buildNativeAction(\n receiverId: string,\n action: NearAction,\n innerSdk: NearState\n): NearNativeAction[] {\n const actionType = action.type;\n switch (actionType) {\n case GenericTxSupportedActions.TRANSFER:\n return [\n transactions.transfer(\n new BN((action as GenericTxActionTransfer).amount, 10)\n ),\n ];\n\n case GenericTxSupportedActions.TRANSFER_CONTRACT_TOKEN: {\n const params = action as GenericTxActionTransferContractToken;\n return [\n transactions.functionCall(\n 'ft_transfer',\n {\n receiver_id: receiverId,\n amount: params.amount,\n memo: params.memo ?? null,\n },\n // TODO: maximum gas fees per chain: see https://github.com/bafnetwork/baf-wallet-v2/issues/68\n new BN(10000000000000), // Maximum gas fee\n new BN(1) // A deposit associated with the ft_transfer action\n ),\n ];\n }\n\n case GenericTxSupportedActions.TRANSFER_NFT: {\n const params = action as GenericTxActionTransferNFT;\n return [\n transactions.functionCall(\n 'nft_transfer',\n {\n receiver_id: receiverId,\n token_id: params.tokenId,\n approval_id: params.approvalId ?? null,\n memo: params.memo ?? null,\n },\n // TODO: maximum gas fees per chain: see https://github.com/bafnetwork/baf-wallet-v2/issues/68\n new BN(10000000000000), // Maximum gas fee\n new BN(1)\n ),\n ];\n }\n\n case GenericTxSupportedActions.CONTRACT_CALL: {\n const params = action as GenericTxActionContractCall;\n return [\n transactions.functionCall(\n params.functionName,\n params.functionArgs,\n new BN(10000000000000), // Maximum gas fee\n new BN(params.deposit || 0)\n ),\n ];\n }\n\n default:\n throw `Action of type ${actionType} is unsupported`;\n }\n}\n\nconst checkAllContractActions = (actions: NearAction[]) => {\n if (!actions.every(isContractCall)) {\n return false;\n }\n if (actions.length === 0) {\n return true;\n }\n\n const contract = (actions[0] as GenericTxActionTransferContractToken)\n .contractAddress;\n\n for (let i = 1; i < actions.length; i++) {\n if (\n (actions[i] as GenericTxActionTransferContractToken).contractAddress !==\n contract\n ) {\n return false;\n }\n }\n return true;\n};\n\nconst isContractCall = (action: NearAction) =>\n action.type === GenericTxSupportedActions.TRANSFER_CONTRACT_TOKEN ||\n action.type === GenericTxSupportedActions.TRANSFER_NFT;\n\nexport const extractGenericActionsFromTx = (\n txParams: NearBuildTxParams\n): GenericTxAction[] => {\n return txParams.actions;\n};\n\nexport const buildParamsFromGenericTx = (innerSdk: NearState) => async (\n txParams: GenericTxParams,\n senderPk: PublicKey<ed25519>,\n recipientPk?: PublicKey<secp256k1>,\n): Promise<NearBuildTxParams> => {\n let recipientAccountID = txParams.recipientAddress\n ? txParams.recipientAddress\n : await getGlobalContract().getAccountId(recipientPk);\n\n if (!recipientAccountID) {\n throw BafError.SecpPKNotAssociatedWithAccount(Chain.NEAR);\n }\n\n const nearTxParams: NearBuildTxParams = {\n actions: txParams.actions,\n senderPk: senderPk,\n senderAccountID: innerSdk.nearMasterAccount.accountId,\n recipientAccountID,\n };\n return nearTxParams;\n};\n\nexport const buildNearTx = (innerSdk: NearState) => async ({\n actions,\n senderPk,\n senderAccountID,\n recipientAccountID,\n}: NearBuildTxParams): Promise<Transaction> => {\n if (actions.some(isContractCall) && !checkAllContractActions(actions)) {\n throw BafError.NonuniformTxActionRecipients(Chain.NEAR);\n }\n\n const nearSenderPk = nearConverter.pkFromUnified(senderPk);\n const accessKey = await innerSdk.rpcProvider.query(\n `access_key/${senderAccountID}/${nearSenderPk.toString()}`,\n ''\n );\n\n const nonce = ++accessKey.nonce;\n const recentBlockHash = utils.serialize.base_decode(accessKey.block_hash);\n const nativeActions = actions.flatMap((action) =>\n buildNativeAction(recipientAccountID, action, innerSdk)\n );\n\n const transactionRecipient =\n actions.some(isContractCall) && actions.length > 0\n ? (actions[0] as GenericTxActionTransferContractToken).contractAddress\n : recipientAccountID;\n\n return transactions.createTransaction(\n senderAccountID,\n nearSenderPk,\n transactionRecipient,\n nonce,\n nativeActions,\n recentBlockHash\n );\n};\n\nexport async function signNearTx<Curve>(\n tx: transactions.Transaction,\n keyPair: KeyPair<Curve>,\n _opts?: NearSignTxOpts\n): Promise<transactions.SignedTransaction> {\n const nearKeyPair = nearConverter.keyPairFromUnified(keyPair);\n const serializedTx = utils.serialize.serialize(transactions.SCHEMA, tx);\n const serializedTxHash = new Uint8Array(sha256(Buffer.from(serializedTx)));\n const signature = nearKeyPair.sign(serializedTxHash);\n // const [_, signedTx] = await signTransaction(tx, )\n return new transactions.SignedTransaction({\n transaction: tx,\n signature: new transactions.Signature({\n keyType: tx.publicKey.keyType,\n data: signature.signature,\n }),\n });\n}\n\nexport const sendNearTx = (innerSdk: NearState) => async (\n tx: SignedTransaction\n): Promise<Pair<NearSendResult, ExplorerLink>> => {\n const serialized = tx.encode();\n const result = await innerSdk.rpcProvider.sendJsonRpc('broadcast_tx_commit', [\n Buffer.from(serialized).toString('base64'),\n ]);\n\n const explorerLink = `https://explorer.${innerSdk.networkID}.near.org/transactions/${result.transaction.hash}`;\n return {\n fst: result,\n snd: explorerLink,\n };\n};\n","import {\n AccountsInterface,\n Balance,\n Chain,\n ed25519,\n ed25519Marker,\n Encoding,\n secp256k1,\n} from '@baf-wallet/interfaces';\nimport { Account as NearAccount } from 'near-api-js';\nimport {\n AccountCreator,\n UrlAccountCreator,\n LocalAccountCreator,\n} from 'near-api-js/lib/account_creator';\nimport BN from 'bn.js';\n\nimport { PublicKey } from '@baf-wallet/interfaces';\nimport { NearState } from './near';\nimport { nearConverter } from './convert';\nimport { BafError } from '@baf-wallet/errors';\nimport { pkFromString } from '@baf-wallet/crypto';\n\nexport type NearAccountID = string;\n\nconst NEP141ViewMethods = [\n 'ft_balance_of',\n 'ft_total_supply',\n 'storage_balance_of',\n];\nconst NEP141ChangeMethods = [\n 'ft_transfer',\n 'ft_transfer_call',\n 'storage_deposit',\n];\n\nexport function nearAccounts(\n nearState: NearState\n): AccountsInterface<NearAccount, NearAccountID, NearCreateAccountParams> {\n const { near } = nearState;\n return {\n lookup: async (accountID: NearAccountID): Promise<NearAccount> =>\n await near.account(accountID),\n masterAccount: nearState.nearMasterAccount,\n getGenericMasterAccount: () => {\n return {\n getBalance: async () =>\n (await nearState.nearMasterAccount.getAccountBalance())\n .total as Balance,\n getContractTokenBalance: async (\n contractName: string\n ): Promise<string> => {\n const contract = await nearState.getFungibleTokenContract(\n contractName\n );\n return await (contract as any).ft_balance_of({\n account_id: nearState.nearMasterAccount.accountId,\n });\n },\n };\n },\n\n associatedKeys,\n\n create: async ({\n accountID,\n newAccountPk,\n initialBalance,\n method = 'helper',\n }: NearCreateAccountParams): Promise<NearAccount> => {\n if (method === 'local' && !initialBalance) {\n throw BafError.MissingInitBalance(Chain.NEAR);\n }\n const masterAccount = await near.account(near.config.masterAccount);\n const accountCreator: AccountCreator =\n method === 'helper'\n ? new UrlAccountCreator(near.connection, near.config.helperUrl)\n : new LocalAccountCreator(masterAccount, initialBalance);\n\n await accountCreator.createAccount(\n accountID,\n nearConverter.pkFromUnified(newAccountPk)\n );\n return await near.account(accountID);\n },\n };\n}\n\nexport async function associatedKeys<Curve extends ed25519>(\n account: NearAccount\n) {\n const keys = await account.getAccessKeys();\n const edPkStrs = keys\n .map((key) => key.public_key as string)\n .filter((keyStr) => keyStr.includes('ed25519:'))\n .map((key) => key.split('ed25519:')[1]);\n return edPkStrs.map((str) =>\n pkFromString<ed25519>(str, ed25519Marker, Encoding.BS58)\n );\n}\n\nexport interface NearCreateAccountParams {\n accountID: NearAccountID;\n newAccountPk: PublicKey<ed25519 | secp256k1>;\n initialBalance?: BN;\n method?: 'helper' | 'local';\n}\n","module.exports = require(\"near-api-js/lib/utils\");","export * from './lib/chain-info';\n","module.exports = require(\"thunky/promise\");","module.exports = require(\"dotenv\");","export * from './constants';\nexport * from './torus';\n","module.exports = require(\"@toruslabs/fetch-node-details\");","module.exports = require(\"node-fetch\");","module.exports = require(\"cors\");","import * as bodyParser from 'body-parser';\nimport express from 'express';\nimport { RegisterRoutes } from '../build/routes';\nimport { constants } from './app/config/constants';\nimport * as cors from 'cors';\nimport { setGlobalContract } from '@baf-wallet/global-contract';\nimport { Chain, Env } from '@baf-wallet/interfaces';\nimport { getNearChain, initNearChain } from '@baf-wallet/global-state';\nimport { BafError } from '@baf-wallet/errors';\n\nconst app = express();\n\nasync function initContracts() {\n const masterAccount = await getNearChain().accounts.lookup(\n constants.chainParams[Chain.NEAR].masterAccountID\n );\n await setGlobalContract(masterAccount);\n}\n\nasync function init() {\n await initNearChain(constants.chainParams[Chain.NEAR], constants.env);\n await initContracts();\n app.use(\n bodyParser.urlencoded({\n extended: true,\n })\n );\n app.use(bodyParser.json());\n const whitelist = [\n 'http://localhost:8080',\n 'https://baf-wallet-deploy-frontend.vercel.app',\n ];\n const corsOptions = {\n origin: function (origin, callback) {\n if (whitelist.indexOf(origin) !== -1) {\n callback(null, true);\n } else if (\n // If the env is TEST or DEV, check against the following REGEX string to\n // allow for frontend Vercel branch deploys to be testable\n (constants.env === Env.TEST || constants.env === Env.DEV) &&\n /^https:\\/\\/baf\\-wallet\\-v2\\-git\\-.{1,100}\\-baf\\-wallet\\.vercel\\.app$/.test(\n origin\n )\n ) {\n callback(null, true);\n } else {\n callback(BafError.BlockedByCors());\n }\n },\n };\n app.use(cors(corsOptions));\n\n RegisterRoutes(app);\n\n const port = process.env.PORT || 3333;\n const server = app.listen(port, () => {\n console.log(`Listening at http://localhost:${port}/`);\n });\n server.on('error', console.error);\n}\ninit();\n","module.exports = require(\"reflect-metadata\");"],"sourceRoot":""}