zkcloudworker 0.18.2 → 0.18.5
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +201 -0
- package/README.md +2 -4
- package/dist/ts/cloud/config.js.map +1 -0
- package/dist/ts/cloud/index.js.map +1 -0
- package/dist/ts/cloud/networks.js.map +1 -0
- package/dist/ts/cloud/utils/base64.js.map +1 -0
- package/dist/ts/cloud/utils/graphql.js.map +1 -0
- package/dist/ts/cloud/utils/index.js.map +1 -0
- package/dist/ts/cloud/utils/utils.js.map +1 -0
- package/dist/ts/cloud/worker/cloud.js.map +1 -0
- package/dist/ts/cloud/worker/index.js.map +1 -0
- package/{lib → dist}/ts/cloud/worker/job.js.map +1 -1
- package/{lib → dist}/ts/cloud/worker/task.js.map +1 -1
- package/dist/ts/cloud/worker/transaction.js.map +1 -0
- package/dist/ts/cloud/worker/worker.js.map +1 -0
- package/dist/ts/index.js.map +1 -0
- package/dist/ts/mina/api/api.js.map +1 -0
- package/dist/ts/mina/index.js.map +1 -0
- package/dist/ts/mina/local/local.js.map +1 -0
- package/dist/ts/mina/storage/index.js.map +1 -0
- package/dist/ts/mina/storage/ipfs.js.map +1 -0
- package/dist/ts/mina/storage/pinata.js.map +1 -0
- package/dist/ts/mina/storage/storage.js.map +1 -0
- package/dist/ts/mina/token/FungibleToken.js.map +1 -0
- package/dist/ts/mina/token/FungibleTokenAdmin.js.map +1 -0
- package/dist/ts/mina/token/api.js.map +1 -0
- package/dist/ts/mina/token/index.js.map +1 -0
- package/dist/ts/mina/token/vk.js.map +1 -0
- package/{lib → dist}/ts/mina/token/whitelist.d.ts +1 -1
- package/{lib/web → dist/ts}/mina/token/whitelist.js +5 -1
- package/dist/ts/mina/token/whitelist.js.map +1 -0
- package/dist/ts/mina/transactions/account.js.map +1 -0
- package/dist/ts/mina/transactions/blockberry.js.map +1 -0
- package/dist/ts/mina/transactions/chain.js.map +1 -0
- package/dist/ts/mina/transactions/index.js.map +1 -0
- package/dist/ts/mina/transactions/nonce.js.map +1 -0
- package/dist/ts/mina/transactions/send.js.map +1 -0
- package/dist/ts/mina/transactions/tiny-contract.js.map +1 -0
- package/dist/ts/mina/transactions/transaction.js.map +1 -0
- package/dist/ts/mina/transactions/txstatus.js.map +1 -0
- package/dist/ts/mina/utils/base64.js.map +1 -0
- package/dist/ts/mina/utils/fee.js.map +1 -0
- package/dist/ts/mina/utils/fetch.js.map +1 -0
- package/dist/ts/mina/utils/fields.js.map +1 -0
- package/dist/ts/mina/utils/index.js.map +1 -0
- package/dist/ts/mina/utils/indexed-map.js.map +1 -0
- package/dist/ts/mina/utils/mina.js.map +1 -0
- package/dist/ts/mina/verification/index.js.map +1 -0
- package/dist/ts/mina/verification/verification.js.map +1 -0
- package/dist/tsconfig.web.tsbuildinfo +1 -0
- package/dist/web/cloud/config.js.map +1 -0
- package/dist/web/cloud/index.js.map +1 -0
- package/dist/web/cloud/networks.js.map +1 -0
- package/dist/web/cloud/utils/base64.js.map +1 -0
- package/dist/web/cloud/utils/graphql.js.map +1 -0
- package/dist/web/cloud/utils/index.js.map +1 -0
- package/dist/web/cloud/utils/utils.js.map +1 -0
- package/dist/web/cloud/worker/cloud.js.map +1 -0
- package/dist/web/cloud/worker/index.js.map +1 -0
- package/{lib → dist}/web/cloud/worker/job.js.map +1 -1
- package/{lib → dist}/web/cloud/worker/task.js.map +1 -1
- package/dist/web/cloud/worker/transaction.js.map +1 -0
- package/dist/web/cloud/worker/worker.js.map +1 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/mina/api/api.js.map +1 -0
- package/dist/web/mina/index.js.map +1 -0
- package/dist/web/mina/local/local.js.map +1 -0
- package/dist/web/mina/storage/index.js.map +1 -0
- package/dist/web/mina/storage/ipfs.js.map +1 -0
- package/dist/web/mina/storage/pinata.js.map +1 -0
- package/dist/web/mina/storage/storage.js.map +1 -0
- package/dist/web/mina/token/FungibleToken.js.map +1 -0
- package/dist/web/mina/token/FungibleTokenAdmin.js.map +1 -0
- package/dist/web/mina/token/api.js.map +1 -0
- package/dist/web/mina/token/index.js.map +1 -0
- package/dist/web/mina/token/vk.js.map +1 -0
- package/{lib → dist}/web/mina/token/whitelist.d.ts +1 -1
- package/{lib/ts → dist/web}/mina/token/whitelist.js +5 -1
- package/dist/web/mina/token/whitelist.js.map +1 -0
- package/dist/web/mina/transactions/account.js.map +1 -0
- package/dist/web/mina/transactions/blockberry.js.map +1 -0
- package/dist/web/mina/transactions/chain.js.map +1 -0
- package/dist/web/mina/transactions/index.js.map +1 -0
- package/dist/web/mina/transactions/nonce.js.map +1 -0
- package/dist/web/mina/transactions/send.js.map +1 -0
- package/dist/web/mina/transactions/tiny-contract.js.map +1 -0
- package/dist/web/mina/transactions/transaction.js.map +1 -0
- package/dist/web/mina/transactions/txstatus.js.map +1 -0
- package/dist/web/mina/utils/base64.js.map +1 -0
- package/dist/web/mina/utils/fee.js.map +1 -0
- package/dist/web/mina/utils/fetch.js.map +1 -0
- package/dist/web/mina/utils/fields.js.map +1 -0
- package/dist/web/mina/utils/index.js.map +1 -0
- package/dist/web/mina/utils/indexed-map.js.map +1 -0
- package/dist/web/mina/utils/mina.js.map +1 -0
- package/dist/web/mina/verification/index.js.map +1 -0
- package/dist/web/mina/verification/verification.js.map +1 -0
- package/package.json +32 -20
- package/src/cloud/config.ts +10 -0
- package/src/cloud/index.ts +4 -0
- package/src/cloud/networks.ts +130 -0
- package/src/cloud/utils/base64.ts +87 -0
- package/src/cloud/utils/graphql.ts +252 -0
- package/src/cloud/utils/index.ts +3 -0
- package/src/cloud/utils/utils.ts +79 -0
- package/src/cloud/worker/cloud.ts +326 -0
- package/src/cloud/worker/index.ts +5 -0
- package/src/cloud/worker/job.ts +123 -0
- package/src/cloud/worker/task.ts +45 -0
- package/src/cloud/worker/transaction.ts +12 -0
- package/src/cloud/worker/worker.ts +62 -0
- package/src/index.ts +2 -0
- package/src/mina/api/api.ts +597 -0
- package/src/mina/index.ts +8 -0
- package/src/mina/local/local.ts +651 -0
- package/src/mina/storage/index.ts +3 -0
- package/src/mina/storage/ipfs.ts +20 -0
- package/src/mina/storage/pinata.ts +52 -0
- package/src/mina/storage/storage.ts +55 -0
- package/src/mina/token/FungibleToken.ts +316 -0
- package/src/mina/token/FungibleTokenAdmin.ts +95 -0
- package/src/mina/token/api.ts +182 -0
- package/src/mina/token/index.ts +5 -0
- package/src/mina/token/vk.ts +42 -0
- package/src/mina/token/whitelist.ts +178 -0
- package/src/mina/transactions/account.ts +57 -0
- package/src/mina/transactions/blockberry.ts +166 -0
- package/src/mina/transactions/chain.ts +1 -0
- package/src/mina/transactions/index.ts +8 -0
- package/src/mina/transactions/nonce.ts +120 -0
- package/src/mina/transactions/send.ts +186 -0
- package/src/mina/transactions/tiny-contract.ts +9 -0
- package/src/mina/transactions/transaction.ts +255 -0
- package/src/mina/transactions/txstatus.ts +26 -0
- package/src/mina/utils/base64.ts +34 -0
- package/src/mina/utils/fee.ts +11 -0
- package/src/mina/utils/fetch.ts +126 -0
- package/src/mina/utils/fields.ts +39 -0
- package/src/mina/utils/index.ts +6 -0
- package/src/mina/utils/indexed-map.ts +169 -0
- package/src/mina/utils/mina.ts +175 -0
- package/src/mina/verification/index.ts +1 -0
- package/src/mina/verification/verification.ts +23 -0
- package/lib/ts/cloud/config.js.map +0 -1
- package/lib/ts/cloud/index.js.map +0 -1
- package/lib/ts/cloud/networks.js.map +0 -1
- package/lib/ts/cloud/utils/base64.js.map +0 -1
- package/lib/ts/cloud/utils/graphql.js.map +0 -1
- package/lib/ts/cloud/utils/index.js.map +0 -1
- package/lib/ts/cloud/utils/utils.js.map +0 -1
- package/lib/ts/cloud/worker/cloud.js.map +0 -1
- package/lib/ts/cloud/worker/index.js.map +0 -1
- package/lib/ts/cloud/worker/transaction.js.map +0 -1
- package/lib/ts/cloud/worker/worker.js.map +0 -1
- package/lib/ts/index.js.map +0 -1
- package/lib/ts/mina/api/api.js.map +0 -1
- package/lib/ts/mina/index.js.map +0 -1
- package/lib/ts/mina/local/local.js.map +0 -1
- package/lib/ts/mina/storage/index.js.map +0 -1
- package/lib/ts/mina/storage/ipfs.js.map +0 -1
- package/lib/ts/mina/storage/pinata.js.map +0 -1
- package/lib/ts/mina/storage/storage.js.map +0 -1
- package/lib/ts/mina/token/FungibleToken.js.map +0 -1
- package/lib/ts/mina/token/FungibleTokenAdmin.js.map +0 -1
- package/lib/ts/mina/token/api.js.map +0 -1
- package/lib/ts/mina/token/index.js.map +0 -1
- package/lib/ts/mina/token/vk.js.map +0 -1
- package/lib/ts/mina/token/whitelist.js.map +0 -1
- package/lib/ts/mina/transactions/account.js.map +0 -1
- package/lib/ts/mina/transactions/blockberry.js.map +0 -1
- package/lib/ts/mina/transactions/chain.js.map +0 -1
- package/lib/ts/mina/transactions/index.js.map +0 -1
- package/lib/ts/mina/transactions/nonce.js.map +0 -1
- package/lib/ts/mina/transactions/send.js.map +0 -1
- package/lib/ts/mina/transactions/tiny-contract.js.map +0 -1
- package/lib/ts/mina/transactions/transaction.js.map +0 -1
- package/lib/ts/mina/transactions/txstatus.js.map +0 -1
- package/lib/ts/mina/utils/base64.js.map +0 -1
- package/lib/ts/mina/utils/fee.js.map +0 -1
- package/lib/ts/mina/utils/fetch.js.map +0 -1
- package/lib/ts/mina/utils/fields.js.map +0 -1
- package/lib/ts/mina/utils/index.js.map +0 -1
- package/lib/ts/mina/utils/indexed-map.js.map +0 -1
- package/lib/ts/mina/utils/mina.js.map +0 -1
- package/lib/ts/mina/verification/index.js.map +0 -1
- package/lib/ts/mina/verification/verification.js.map +0 -1
- package/lib/tsconfig.web.tsbuildinfo +0 -1
- package/lib/web/cloud/config.js.map +0 -1
- package/lib/web/cloud/index.js.map +0 -1
- package/lib/web/cloud/networks.js.map +0 -1
- package/lib/web/cloud/utils/base64.js.map +0 -1
- package/lib/web/cloud/utils/graphql.js.map +0 -1
- package/lib/web/cloud/utils/index.js.map +0 -1
- package/lib/web/cloud/utils/utils.js.map +0 -1
- package/lib/web/cloud/worker/cloud.js.map +0 -1
- package/lib/web/cloud/worker/index.js.map +0 -1
- package/lib/web/cloud/worker/transaction.js.map +0 -1
- package/lib/web/cloud/worker/worker.js.map +0 -1
- package/lib/web/index.js.map +0 -1
- package/lib/web/mina/api/api.js.map +0 -1
- package/lib/web/mina/index.js.map +0 -1
- package/lib/web/mina/local/local.js.map +0 -1
- package/lib/web/mina/storage/index.js.map +0 -1
- package/lib/web/mina/storage/ipfs.js.map +0 -1
- package/lib/web/mina/storage/pinata.js.map +0 -1
- package/lib/web/mina/storage/storage.js.map +0 -1
- package/lib/web/mina/token/FungibleToken.js.map +0 -1
- package/lib/web/mina/token/FungibleTokenAdmin.js.map +0 -1
- package/lib/web/mina/token/api.js.map +0 -1
- package/lib/web/mina/token/index.js.map +0 -1
- package/lib/web/mina/token/vk.js.map +0 -1
- package/lib/web/mina/token/whitelist.js.map +0 -1
- package/lib/web/mina/transactions/account.js.map +0 -1
- package/lib/web/mina/transactions/blockberry.js.map +0 -1
- package/lib/web/mina/transactions/chain.js.map +0 -1
- package/lib/web/mina/transactions/index.js.map +0 -1
- package/lib/web/mina/transactions/nonce.js.map +0 -1
- package/lib/web/mina/transactions/send.js.map +0 -1
- package/lib/web/mina/transactions/tiny-contract.js.map +0 -1
- package/lib/web/mina/transactions/transaction.js.map +0 -1
- package/lib/web/mina/transactions/txstatus.js.map +0 -1
- package/lib/web/mina/utils/base64.js.map +0 -1
- package/lib/web/mina/utils/fee.js.map +0 -1
- package/lib/web/mina/utils/fetch.js.map +0 -1
- package/lib/web/mina/utils/fields.js.map +0 -1
- package/lib/web/mina/utils/index.js.map +0 -1
- package/lib/web/mina/utils/indexed-map.js.map +0 -1
- package/lib/web/mina/utils/mina.js.map +0 -1
- package/lib/web/mina/verification/index.js.map +0 -1
- package/lib/web/mina/verification/verification.js.map +0 -1
- /package/{lib → dist}/ts/cloud/config.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/config.js +0 -0
- /package/{lib → dist}/ts/cloud/index.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/index.js +0 -0
- /package/{lib → dist}/ts/cloud/networks.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/networks.js +0 -0
- /package/{lib → dist}/ts/cloud/utils/base64.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/utils/base64.js +0 -0
- /package/{lib → dist}/ts/cloud/utils/graphql.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/utils/graphql.js +0 -0
- /package/{lib → dist}/ts/cloud/utils/index.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/utils/index.js +0 -0
- /package/{lib → dist}/ts/cloud/utils/utils.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/utils/utils.js +0 -0
- /package/{lib → dist}/ts/cloud/worker/cloud.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/worker/cloud.js +0 -0
- /package/{lib → dist}/ts/cloud/worker/index.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/worker/index.js +0 -0
- /package/{lib → dist}/ts/cloud/worker/job.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/worker/job.js +0 -0
- /package/{lib → dist}/ts/cloud/worker/task.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/worker/task.js +0 -0
- /package/{lib → dist}/ts/cloud/worker/transaction.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/worker/transaction.js +0 -0
- /package/{lib → dist}/ts/cloud/worker/worker.d.ts +0 -0
- /package/{lib → dist}/ts/cloud/worker/worker.js +0 -0
- /package/{lib → dist}/ts/index.d.ts +0 -0
- /package/{lib → dist}/ts/index.js +0 -0
- /package/{lib → dist}/ts/mina/api/api.d.ts +0 -0
- /package/{lib → dist}/ts/mina/api/api.js +0 -0
- /package/{lib → dist}/ts/mina/index.d.ts +0 -0
- /package/{lib → dist}/ts/mina/index.js +0 -0
- /package/{lib → dist}/ts/mina/local/local.d.ts +0 -0
- /package/{lib → dist}/ts/mina/local/local.js +0 -0
- /package/{lib → dist}/ts/mina/storage/index.d.ts +0 -0
- /package/{lib → dist}/ts/mina/storage/index.js +0 -0
- /package/{lib → dist}/ts/mina/storage/ipfs.d.ts +0 -0
- /package/{lib → dist}/ts/mina/storage/ipfs.js +0 -0
- /package/{lib → dist}/ts/mina/storage/pinata.d.ts +0 -0
- /package/{lib → dist}/ts/mina/storage/pinata.js +0 -0
- /package/{lib → dist}/ts/mina/storage/storage.d.ts +0 -0
- /package/{lib → dist}/ts/mina/storage/storage.js +0 -0
- /package/{lib → dist}/ts/mina/token/FungibleToken.d.ts +0 -0
- /package/{lib → dist}/ts/mina/token/FungibleToken.js +0 -0
- /package/{lib → dist}/ts/mina/token/FungibleTokenAdmin.d.ts +0 -0
- /package/{lib → dist}/ts/mina/token/FungibleTokenAdmin.js +0 -0
- /package/{lib → dist}/ts/mina/token/api.d.ts +0 -0
- /package/{lib → dist}/ts/mina/token/api.js +0 -0
- /package/{lib → dist}/ts/mina/token/index.d.ts +0 -0
- /package/{lib → dist}/ts/mina/token/index.js +0 -0
- /package/{lib → dist}/ts/mina/token/vk.d.ts +0 -0
- /package/{lib → dist}/ts/mina/token/vk.js +0 -0
- /package/{lib → dist}/ts/mina/transactions/account.d.ts +0 -0
- /package/{lib → dist}/ts/mina/transactions/account.js +0 -0
- /package/{lib → dist}/ts/mina/transactions/blockberry.d.ts +0 -0
- /package/{lib → dist}/ts/mina/transactions/blockberry.js +0 -0
- /package/{lib → dist}/ts/mina/transactions/chain.d.ts +0 -0
- /package/{lib → dist}/ts/mina/transactions/chain.js +0 -0
- /package/{lib → dist}/ts/mina/transactions/index.d.ts +0 -0
- /package/{lib → dist}/ts/mina/transactions/index.js +0 -0
- /package/{lib → dist}/ts/mina/transactions/nonce.d.ts +0 -0
- /package/{lib → dist}/ts/mina/transactions/nonce.js +0 -0
- /package/{lib → dist}/ts/mina/transactions/send.d.ts +0 -0
- /package/{lib → dist}/ts/mina/transactions/send.js +0 -0
- /package/{lib → dist}/ts/mina/transactions/tiny-contract.d.ts +0 -0
- /package/{lib → dist}/ts/mina/transactions/tiny-contract.js +0 -0
- /package/{lib → dist}/ts/mina/transactions/transaction.d.ts +0 -0
- /package/{lib → dist}/ts/mina/transactions/transaction.js +0 -0
- /package/{lib → dist}/ts/mina/transactions/txstatus.d.ts +0 -0
- /package/{lib → dist}/ts/mina/transactions/txstatus.js +0 -0
- /package/{lib → dist}/ts/mina/utils/base64.d.ts +0 -0
- /package/{lib → dist}/ts/mina/utils/base64.js +0 -0
- /package/{lib → dist}/ts/mina/utils/fee.d.ts +0 -0
- /package/{lib → dist}/ts/mina/utils/fee.js +0 -0
- /package/{lib → dist}/ts/mina/utils/fetch.d.ts +0 -0
- /package/{lib → dist}/ts/mina/utils/fetch.js +0 -0
- /package/{lib → dist}/ts/mina/utils/fields.d.ts +0 -0
- /package/{lib → dist}/ts/mina/utils/fields.js +0 -0
- /package/{lib → dist}/ts/mina/utils/index.d.ts +0 -0
- /package/{lib → dist}/ts/mina/utils/index.js +0 -0
- /package/{lib → dist}/ts/mina/utils/indexed-map.d.ts +0 -0
- /package/{lib → dist}/ts/mina/utils/indexed-map.js +0 -0
- /package/{lib → dist}/ts/mina/utils/mina.d.ts +0 -0
- /package/{lib → dist}/ts/mina/utils/mina.js +0 -0
- /package/{lib → dist}/ts/mina/verification/index.d.ts +0 -0
- /package/{lib → dist}/ts/mina/verification/index.js +0 -0
- /package/{lib → dist}/ts/mina/verification/verification.d.ts +0 -0
- /package/{lib → dist}/ts/mina/verification/verification.js +0 -0
- /package/{lib → dist}/web/cloud/config.d.ts +0 -0
- /package/{lib → dist}/web/cloud/config.js +0 -0
- /package/{lib → dist}/web/cloud/index.d.ts +0 -0
- /package/{lib → dist}/web/cloud/index.js +0 -0
- /package/{lib → dist}/web/cloud/networks.d.ts +0 -0
- /package/{lib → dist}/web/cloud/networks.js +0 -0
- /package/{lib → dist}/web/cloud/utils/base64.d.ts +0 -0
- /package/{lib → dist}/web/cloud/utils/base64.js +0 -0
- /package/{lib → dist}/web/cloud/utils/graphql.d.ts +0 -0
- /package/{lib → dist}/web/cloud/utils/graphql.js +0 -0
- /package/{lib → dist}/web/cloud/utils/index.d.ts +0 -0
- /package/{lib → dist}/web/cloud/utils/index.js +0 -0
- /package/{lib → dist}/web/cloud/utils/utils.d.ts +0 -0
- /package/{lib → dist}/web/cloud/utils/utils.js +0 -0
- /package/{lib → dist}/web/cloud/worker/cloud.d.ts +0 -0
- /package/{lib → dist}/web/cloud/worker/cloud.js +0 -0
- /package/{lib → dist}/web/cloud/worker/index.d.ts +0 -0
- /package/{lib → dist}/web/cloud/worker/index.js +0 -0
- /package/{lib → dist}/web/cloud/worker/job.d.ts +0 -0
- /package/{lib → dist}/web/cloud/worker/job.js +0 -0
- /package/{lib → dist}/web/cloud/worker/task.d.ts +0 -0
- /package/{lib → dist}/web/cloud/worker/task.js +0 -0
- /package/{lib → dist}/web/cloud/worker/transaction.d.ts +0 -0
- /package/{lib → dist}/web/cloud/worker/transaction.js +0 -0
- /package/{lib → dist}/web/cloud/worker/worker.d.ts +0 -0
- /package/{lib → dist}/web/cloud/worker/worker.js +0 -0
- /package/{lib → dist}/web/index.d.ts +0 -0
- /package/{lib → dist}/web/index.js +0 -0
- /package/{lib → dist}/web/mina/api/api.d.ts +0 -0
- /package/{lib → dist}/web/mina/api/api.js +0 -0
- /package/{lib → dist}/web/mina/index.d.ts +0 -0
- /package/{lib → dist}/web/mina/index.js +0 -0
- /package/{lib → dist}/web/mina/local/local.d.ts +0 -0
- /package/{lib → dist}/web/mina/local/local.js +0 -0
- /package/{lib → dist}/web/mina/storage/index.d.ts +0 -0
- /package/{lib → dist}/web/mina/storage/index.js +0 -0
- /package/{lib → dist}/web/mina/storage/ipfs.d.ts +0 -0
- /package/{lib → dist}/web/mina/storage/ipfs.js +0 -0
- /package/{lib → dist}/web/mina/storage/pinata.d.ts +0 -0
- /package/{lib → dist}/web/mina/storage/pinata.js +0 -0
- /package/{lib → dist}/web/mina/storage/storage.d.ts +0 -0
- /package/{lib → dist}/web/mina/storage/storage.js +0 -0
- /package/{lib → dist}/web/mina/token/FungibleToken.d.ts +0 -0
- /package/{lib → dist}/web/mina/token/FungibleToken.js +0 -0
- /package/{lib → dist}/web/mina/token/FungibleTokenAdmin.d.ts +0 -0
- /package/{lib → dist}/web/mina/token/FungibleTokenAdmin.js +0 -0
- /package/{lib → dist}/web/mina/token/api.d.ts +0 -0
- /package/{lib → dist}/web/mina/token/api.js +0 -0
- /package/{lib → dist}/web/mina/token/index.d.ts +0 -0
- /package/{lib → dist}/web/mina/token/index.js +0 -0
- /package/{lib → dist}/web/mina/token/vk.d.ts +0 -0
- /package/{lib → dist}/web/mina/token/vk.js +0 -0
- /package/{lib → dist}/web/mina/transactions/account.d.ts +0 -0
- /package/{lib → dist}/web/mina/transactions/account.js +0 -0
- /package/{lib → dist}/web/mina/transactions/blockberry.d.ts +0 -0
- /package/{lib → dist}/web/mina/transactions/blockberry.js +0 -0
- /package/{lib → dist}/web/mina/transactions/chain.d.ts +0 -0
- /package/{lib → dist}/web/mina/transactions/chain.js +0 -0
- /package/{lib → dist}/web/mina/transactions/index.d.ts +0 -0
- /package/{lib → dist}/web/mina/transactions/index.js +0 -0
- /package/{lib → dist}/web/mina/transactions/nonce.d.ts +0 -0
- /package/{lib → dist}/web/mina/transactions/nonce.js +0 -0
- /package/{lib → dist}/web/mina/transactions/send.d.ts +0 -0
- /package/{lib → dist}/web/mina/transactions/send.js +0 -0
- /package/{lib → dist}/web/mina/transactions/tiny-contract.d.ts +0 -0
- /package/{lib → dist}/web/mina/transactions/tiny-contract.js +0 -0
- /package/{lib → dist}/web/mina/transactions/transaction.d.ts +0 -0
- /package/{lib → dist}/web/mina/transactions/transaction.js +0 -0
- /package/{lib → dist}/web/mina/transactions/txstatus.d.ts +0 -0
- /package/{lib → dist}/web/mina/transactions/txstatus.js +0 -0
- /package/{lib → dist}/web/mina/utils/base64.d.ts +0 -0
- /package/{lib → dist}/web/mina/utils/base64.js +0 -0
- /package/{lib → dist}/web/mina/utils/fee.d.ts +0 -0
- /package/{lib → dist}/web/mina/utils/fee.js +0 -0
- /package/{lib → dist}/web/mina/utils/fetch.d.ts +0 -0
- /package/{lib → dist}/web/mina/utils/fetch.js +0 -0
- /package/{lib → dist}/web/mina/utils/fields.d.ts +0 -0
- /package/{lib → dist}/web/mina/utils/fields.js +0 -0
- /package/{lib → dist}/web/mina/utils/index.d.ts +0 -0
- /package/{lib → dist}/web/mina/utils/index.js +0 -0
- /package/{lib → dist}/web/mina/utils/indexed-map.d.ts +0 -0
- /package/{lib → dist}/web/mina/utils/indexed-map.js +0 -0
- /package/{lib → dist}/web/mina/utils/mina.d.ts +0 -0
- /package/{lib → dist}/web/mina/utils/mina.js +0 -0
- /package/{lib → dist}/web/mina/verification/index.d.ts +0 -0
- /package/{lib → dist}/web/mina/verification/index.js +0 -0
- /package/{lib → dist}/web/mina/verification/verification.d.ts +0 -0
- /package/{lib → dist}/web/mina/verification/verification.js +0 -0
@@ -0,0 +1,130 @@
|
|
1
|
+
export {
|
2
|
+
blockchain,
|
3
|
+
MinaNetwork,
|
4
|
+
networks,
|
5
|
+
Mainnet,
|
6
|
+
Devnet,
|
7
|
+
Zeko,
|
8
|
+
Lightnet,
|
9
|
+
Local,
|
10
|
+
};
|
11
|
+
|
12
|
+
/**
|
13
|
+
* blockchain is the type for the chain ID.
|
14
|
+
*/
|
15
|
+
type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko";
|
16
|
+
|
17
|
+
/**
|
18
|
+
* MinaNetwork is the data structure for a Mina network, keeping track of the Mina and archive endpoints, chain ID, name, account manager, explorer account URL, explorer transaction URL, and faucet.
|
19
|
+
*/
|
20
|
+
interface MinaNetwork {
|
21
|
+
/** The Mina endpoints */
|
22
|
+
mina: string[];
|
23
|
+
|
24
|
+
/** The archive endpoints */
|
25
|
+
archive: string[];
|
26
|
+
|
27
|
+
/** The chain ID */
|
28
|
+
chainId: blockchain;
|
29
|
+
|
30
|
+
/** The name of the network (optional) */
|
31
|
+
name?: string;
|
32
|
+
|
33
|
+
/** The account manager for Lightnet (optional) */
|
34
|
+
accountManager?: string;
|
35
|
+
|
36
|
+
/** The explorer account URL (optional) */
|
37
|
+
explorerAccountUrl?: string;
|
38
|
+
|
39
|
+
/** The explorer transaction URL (optional) */
|
40
|
+
explorerTransactionUrl?: string;
|
41
|
+
|
42
|
+
/** The faucet URL (optional) */
|
43
|
+
faucet?: string;
|
44
|
+
}
|
45
|
+
|
46
|
+
const Mainnet: MinaNetwork = {
|
47
|
+
mina: [
|
48
|
+
//"https://proxy.devnet.minaexplorer.com/graphql",
|
49
|
+
"https://api.minascan.io/node/mainnet/v1/graphql",
|
50
|
+
],
|
51
|
+
archive: [
|
52
|
+
"https://api.minascan.io/archive/mainnet/v1/graphql",
|
53
|
+
//"https://archive.devnet.minaexplorer.com",
|
54
|
+
],
|
55
|
+
explorerAccountUrl: "https://minascan.io/mainnet/account/",
|
56
|
+
explorerTransactionUrl: "https://minascan.io/mainnet/tx/",
|
57
|
+
chainId: "mainnet",
|
58
|
+
name: "Mainnet",
|
59
|
+
};
|
60
|
+
|
61
|
+
const Local: MinaNetwork = {
|
62
|
+
mina: [],
|
63
|
+
archive: [],
|
64
|
+
chainId: "local",
|
65
|
+
};
|
66
|
+
|
67
|
+
const Devnet: MinaNetwork = {
|
68
|
+
mina: [
|
69
|
+
"https://api.minascan.io/node/devnet/v1/graphql",
|
70
|
+
//"https://proxy.devnet.minaexplorer.com/graphql",
|
71
|
+
],
|
72
|
+
archive: [
|
73
|
+
"https://api.minascan.io/archive/devnet/v1/graphql",
|
74
|
+
//"https://archive.devnet.minaexplorer.com",
|
75
|
+
],
|
76
|
+
explorerAccountUrl: "https://minascan.io/devnet/account/",
|
77
|
+
explorerTransactionUrl: "https://minascan.io/devnet/tx/",
|
78
|
+
chainId: "devnet",
|
79
|
+
name: "Devnet",
|
80
|
+
faucet: "https://faucet.minaprotocol.com",
|
81
|
+
};
|
82
|
+
|
83
|
+
const Zeko: MinaNetwork = {
|
84
|
+
mina: ["https://devnet.zeko.io/graphql"],
|
85
|
+
archive: ["https://devnet.zeko.io/graphql"],
|
86
|
+
explorerAccountUrl: "https://zekoscan.io/devnet/account/",
|
87
|
+
explorerTransactionUrl: "https://zekoscan.io/devnet/tx/",
|
88
|
+
chainId: "zeko",
|
89
|
+
name: "Zeko",
|
90
|
+
faucet: "https://zeko.io/faucet",
|
91
|
+
};
|
92
|
+
|
93
|
+
const Lightnet: MinaNetwork = {
|
94
|
+
mina: ["http://localhost:8080/graphql"],
|
95
|
+
archive: ["http://localhost:8282"],
|
96
|
+
accountManager: "http://localhost:8181",
|
97
|
+
chainId: "lightnet",
|
98
|
+
name: "Lightnet",
|
99
|
+
};
|
100
|
+
|
101
|
+
const networks: MinaNetwork[] = [Mainnet, Local, Devnet, Zeko, Lightnet];
|
102
|
+
|
103
|
+
/*
|
104
|
+
// not supported by o1js v1
|
105
|
+
|
106
|
+
const Berkeley: MinaNetwork = {
|
107
|
+
mina: [
|
108
|
+
"https://api.minascan.io/node/berkeley/v1/graphql",
|
109
|
+
"https://proxy.berkeley.minaexplorer.com/graphql",
|
110
|
+
],
|
111
|
+
archive: [
|
112
|
+
"https://api.minascan.io/archive/berkeley/v1/graphql",
|
113
|
+
"https://archive.berkeley.minaexplorer.com",
|
114
|
+
],
|
115
|
+
explorerAccountUrl: "https://minascan.io/berkeley/account/",
|
116
|
+
explorerTransactionUrl: "https://minascan.io/berkeley/tx/",
|
117
|
+
chainId: "berkeley",
|
118
|
+
name: "Berkeley",
|
119
|
+
};
|
120
|
+
|
121
|
+
const TestWorld2: MinaNetwork = {
|
122
|
+
mina: ["https://api.minascan.io/node/testworld/v1/graphql"],
|
123
|
+
archive: ["https://archive.testworld.minaexplorer.com"],
|
124
|
+
explorerAccountUrl: "https://minascan.io/testworld/account/",
|
125
|
+
explorerTransactionUrl: "https://minascan.io/testworld/tx/",
|
126
|
+
chainId: "testworld2",
|
127
|
+
name: "TestWorld2",
|
128
|
+
};
|
129
|
+
|
130
|
+
*/
|
@@ -0,0 +1,87 @@
|
|
1
|
+
// URL friendly base64 encoding
|
2
|
+
const TABLE =
|
3
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
4
|
+
|
5
|
+
export function bigintToBase56(value: bigint): string {
|
6
|
+
const digits = toBase(value, 56n);
|
7
|
+
//console.log("digits:", digits);
|
8
|
+
const str = digits.map((x) => TABLE[Number(x)]).join("");
|
9
|
+
//console.log("str:", str);
|
10
|
+
return str;
|
11
|
+
}
|
12
|
+
|
13
|
+
export function bigintFromBase56(str: string): bigint {
|
14
|
+
const base56Digits = str.split("").map((x) => BigInt(TABLE.indexOf(x)));
|
15
|
+
const x = fromBase(base56Digits, 56n);
|
16
|
+
return x;
|
17
|
+
}
|
18
|
+
|
19
|
+
export function bigintToBase64(value: bigint): string {
|
20
|
+
const digits = toBase(value, 64n);
|
21
|
+
//console.log("digits:", digits);
|
22
|
+
const str = digits.map((x) => TABLE[Number(x)]).join("");
|
23
|
+
//console.log("str:", str);
|
24
|
+
return str;
|
25
|
+
}
|
26
|
+
|
27
|
+
export function bigintFromBase64(str: string): bigint {
|
28
|
+
const base64Digits = str.split("").map((x) => BigInt(TABLE.indexOf(x)));
|
29
|
+
const x = fromBase(base64Digits, 64n);
|
30
|
+
return x;
|
31
|
+
}
|
32
|
+
|
33
|
+
export function fromBase(digits: bigint[], base: bigint) {
|
34
|
+
if (base <= 0n) throw Error("fromBase: base must be positive");
|
35
|
+
// compute powers base, base^2, base^4, ..., base^(2^k)
|
36
|
+
// with largest k s.t. n = 2^k < digits.length
|
37
|
+
let basePowers = [];
|
38
|
+
for (let power = base, n = 1; n < digits.length; power **= 2n, n *= 2) {
|
39
|
+
basePowers.push(power);
|
40
|
+
}
|
41
|
+
let k = basePowers.length;
|
42
|
+
// pad digits array with zeros s.t. digits.length === 2^k
|
43
|
+
digits = digits.concat(Array(2 ** k - digits.length).fill(0n));
|
44
|
+
// accumulate [x0, x1, x2, x3, ...] -> [x0 + base*x1, x2 + base*x3, ...] -> [x0 + base*x1 + base^2*(x2 + base*x3), ...] -> ...
|
45
|
+
// until we end up with a single element
|
46
|
+
for (let i = 0; i < k; i++) {
|
47
|
+
let newDigits = Array(digits.length >> 1);
|
48
|
+
let basePower = basePowers[i];
|
49
|
+
for (let j = 0; j < newDigits.length; j++) {
|
50
|
+
newDigits[j] = digits[2 * j] + basePower * digits[2 * j + 1];
|
51
|
+
}
|
52
|
+
digits = newDigits;
|
53
|
+
}
|
54
|
+
console.assert(digits.length === 1);
|
55
|
+
let [digit] = digits;
|
56
|
+
return digit;
|
57
|
+
}
|
58
|
+
|
59
|
+
export function toBase(x: bigint, base: bigint) {
|
60
|
+
if (base <= 0n) throw Error("toBase: base must be positive");
|
61
|
+
// compute powers base, base^2, base^4, ..., base^(2^k)
|
62
|
+
// with largest k s.t. base^(2^k) < x
|
63
|
+
let basePowers = [];
|
64
|
+
for (let power = base; power <= x; power **= 2n) {
|
65
|
+
basePowers.push(power);
|
66
|
+
}
|
67
|
+
let digits = [x]; // single digit w.r.t base^(2^(k+1))
|
68
|
+
// successively split digits w.r.t. base^(2^j) into digits w.r.t. base^(2^(j-1))
|
69
|
+
// until we arrive at digits w.r.t. base
|
70
|
+
let k = basePowers.length;
|
71
|
+
for (let i = 0; i < k; i++) {
|
72
|
+
let newDigits = Array(2 * digits.length);
|
73
|
+
let basePower = basePowers[k - 1 - i];
|
74
|
+
for (let j = 0; j < digits.length; j++) {
|
75
|
+
let x = digits[j];
|
76
|
+
let high = x / basePower;
|
77
|
+
newDigits[2 * j + 1] = high;
|
78
|
+
newDigits[2 * j] = x - high * basePower;
|
79
|
+
}
|
80
|
+
digits = newDigits;
|
81
|
+
}
|
82
|
+
// pop "leading" zero digits
|
83
|
+
while (digits[digits.length - 1] === 0n) {
|
84
|
+
digits.pop();
|
85
|
+
}
|
86
|
+
return digits;
|
87
|
+
}
|
@@ -0,0 +1,252 @@
|
|
1
|
+
type QueryType = "balance" | "account";
|
2
|
+
|
3
|
+
export const defaultToken =
|
4
|
+
"wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf";
|
5
|
+
|
6
|
+
export async function getBalanceFromGraphQL(params: {
|
7
|
+
publicKey: string;
|
8
|
+
tokenId?: string;
|
9
|
+
mina: string[];
|
10
|
+
}): Promise<bigint> {
|
11
|
+
const { publicKey, mina } = params;
|
12
|
+
const tokenId = params.tokenId ?? defaultToken;
|
13
|
+
if (mina.length === 0) throw new Error("no mina endpoints provided");
|
14
|
+
const account = await fetchAccountInternal({
|
15
|
+
publicKey,
|
16
|
+
tokenId,
|
17
|
+
mina,
|
18
|
+
queryType: "balance",
|
19
|
+
});
|
20
|
+
//console.log("getBalanceFromGraphQL account:", account);
|
21
|
+
const balance = (account as any)?.account?.balance?.total;
|
22
|
+
return balance ? BigInt(balance) : 0n;
|
23
|
+
}
|
24
|
+
|
25
|
+
export async function getAccountFromGraphQL(params: {
|
26
|
+
publicKey: string;
|
27
|
+
tokenId?: string;
|
28
|
+
mina: string[];
|
29
|
+
}) {
|
30
|
+
const { publicKey, mina } = params;
|
31
|
+
const tokenId = params.tokenId ?? defaultToken;
|
32
|
+
if (mina.length === 0) throw new Error("no mina endpoints provided");
|
33
|
+
const account = await fetchAccountInternal({
|
34
|
+
publicKey,
|
35
|
+
tokenId,
|
36
|
+
mina,
|
37
|
+
queryType: "account",
|
38
|
+
});
|
39
|
+
return (account as any)?.account;
|
40
|
+
}
|
41
|
+
|
42
|
+
async function fetchAccountInternal(params: {
|
43
|
+
publicKey: string;
|
44
|
+
tokenId: string;
|
45
|
+
mina: string[];
|
46
|
+
timeout?: number;
|
47
|
+
queryType: QueryType;
|
48
|
+
}) {
|
49
|
+
const { publicKey, tokenId, mina, timeout, queryType } = params;
|
50
|
+
const query =
|
51
|
+
queryType === "balance"
|
52
|
+
? balanceQuery(publicKey, tokenId)
|
53
|
+
: accountQuery(publicKey, tokenId);
|
54
|
+
let [response, error] = await makeGraphqlRequest({
|
55
|
+
query,
|
56
|
+
mina,
|
57
|
+
timeout,
|
58
|
+
});
|
59
|
+
if (error !== undefined) return { account: undefined, error };
|
60
|
+
const account = (response as any)?.data?.account;
|
61
|
+
if (!account) {
|
62
|
+
return {
|
63
|
+
account: undefined,
|
64
|
+
error: {
|
65
|
+
statusCode: 404,
|
66
|
+
statusText: `fetchAccount: Account with public key ${publicKey} does not exist.`,
|
67
|
+
},
|
68
|
+
};
|
69
|
+
}
|
70
|
+
return {
|
71
|
+
account,
|
72
|
+
error: undefined,
|
73
|
+
};
|
74
|
+
}
|
75
|
+
|
76
|
+
async function makeGraphqlRequest(params: {
|
77
|
+
query: string;
|
78
|
+
mina: string[];
|
79
|
+
timeout?: number;
|
80
|
+
}) {
|
81
|
+
const defaultTimeout = 5 * 60 * 1000; // 5 minutes
|
82
|
+
const timeout = params.timeout ?? defaultTimeout;
|
83
|
+
const { query, mina } = params;
|
84
|
+
const graphqlEndpoint = mina[0];
|
85
|
+
const fallbackEndpoints: string[] = mina.slice(1);
|
86
|
+
if (graphqlEndpoint === "none")
|
87
|
+
throw Error(
|
88
|
+
"Should have made a graphql request, but don't know to which endpoint."
|
89
|
+
);
|
90
|
+
let timeouts: NodeJS.Timeout[] = [];
|
91
|
+
const clearTimeouts = () => {
|
92
|
+
timeouts.forEach((t) => clearTimeout(t));
|
93
|
+
timeouts = [];
|
94
|
+
};
|
95
|
+
|
96
|
+
const makeRequest = async (url: string) => {
|
97
|
+
const controller = new AbortController();
|
98
|
+
const timer = setTimeout(() => controller.abort(), timeout);
|
99
|
+
timeouts.push(timer);
|
100
|
+
let body = JSON.stringify({
|
101
|
+
operationName: null,
|
102
|
+
query,
|
103
|
+
variables: {},
|
104
|
+
});
|
105
|
+
try {
|
106
|
+
let response = await fetch(url, {
|
107
|
+
method: "POST",
|
108
|
+
headers: { "Content-Type": "application/json" },
|
109
|
+
body,
|
110
|
+
signal: controller.signal,
|
111
|
+
});
|
112
|
+
return checkResponseStatus(response);
|
113
|
+
} finally {
|
114
|
+
clearTimeouts();
|
115
|
+
}
|
116
|
+
};
|
117
|
+
// try to fetch from endpoints in pairs
|
118
|
+
let timeoutErrors: { url1: string; url2: string; error: any }[] = [];
|
119
|
+
let urls = [graphqlEndpoint, ...fallbackEndpoints];
|
120
|
+
for (let i = 0; i < urls.length; i += 2) {
|
121
|
+
let url1 = urls[i];
|
122
|
+
let url2 = urls[i + 1];
|
123
|
+
if (url2 === undefined) {
|
124
|
+
try {
|
125
|
+
return await makeRequest(url1);
|
126
|
+
} catch (error) {
|
127
|
+
return [undefined, inferError(error)] as [undefined, object];
|
128
|
+
}
|
129
|
+
}
|
130
|
+
try {
|
131
|
+
return await Promise.race([makeRequest(url1), makeRequest(url2)]);
|
132
|
+
} catch (unknownError) {
|
133
|
+
let error = inferError(unknownError);
|
134
|
+
if (error.statusCode === 408) {
|
135
|
+
// If the request timed out, try the next 2 endpoints
|
136
|
+
timeoutErrors.push({ url1, url2, error });
|
137
|
+
} else {
|
138
|
+
// If the request failed for some other reason (e.g. o1js error), return the error
|
139
|
+
return [undefined, error];
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
const statusText = timeoutErrors
|
144
|
+
.map(
|
145
|
+
({ url1, url2, error }) =>
|
146
|
+
`Request to ${url1} and ${url2} timed out. Error: ${error}`
|
147
|
+
)
|
148
|
+
.join("\n");
|
149
|
+
return [undefined, { statusCode: 408, statusText }];
|
150
|
+
}
|
151
|
+
|
152
|
+
function inferError(error: unknown) {
|
153
|
+
let errorMessage = JSON.stringify(error);
|
154
|
+
if (error instanceof AbortSignal) {
|
155
|
+
return { statusCode: 408, statusText: `Request Timeout: ${errorMessage}` };
|
156
|
+
} else {
|
157
|
+
return {
|
158
|
+
statusCode: 500,
|
159
|
+
statusText: `Unknown Error: ${errorMessage}`,
|
160
|
+
};
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
async function checkResponseStatus(
|
165
|
+
response: Response
|
166
|
+
): Promise<[object, undefined] | [undefined, object]> {
|
167
|
+
if (response.ok) {
|
168
|
+
const jsonResponse = (await response.json()) as any;
|
169
|
+
if (jsonResponse.errors && jsonResponse.errors.length > 0) {
|
170
|
+
return [
|
171
|
+
undefined,
|
172
|
+
{
|
173
|
+
statusCode: response.status,
|
174
|
+
statusText: jsonResponse.errors
|
175
|
+
.map((error: any) => error.message)
|
176
|
+
.join("\n"),
|
177
|
+
},
|
178
|
+
];
|
179
|
+
} else if (jsonResponse.data === undefined) {
|
180
|
+
return [
|
181
|
+
undefined,
|
182
|
+
{
|
183
|
+
statusCode: response.status,
|
184
|
+
statusText: `GraphQL response data is undefined`,
|
185
|
+
},
|
186
|
+
];
|
187
|
+
}
|
188
|
+
return [jsonResponse, undefined];
|
189
|
+
} else {
|
190
|
+
return [
|
191
|
+
undefined,
|
192
|
+
{
|
193
|
+
statusCode: response.status,
|
194
|
+
statusText: response.statusText,
|
195
|
+
},
|
196
|
+
];
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
const balanceQuery = (publicKey: string, tokenId: string) => `{
|
201
|
+
account(publicKey: "${publicKey}", token: "${tokenId}") {
|
202
|
+
balance { total }
|
203
|
+
}
|
204
|
+
}
|
205
|
+
`;
|
206
|
+
|
207
|
+
const accountQuery = (publicKey: string, tokenId: string) => `{
|
208
|
+
account(publicKey: "${publicKey}", token: "${tokenId}") {
|
209
|
+
publicKey
|
210
|
+
token
|
211
|
+
nonce
|
212
|
+
balance { total }
|
213
|
+
tokenSymbol
|
214
|
+
receiptChainHash
|
215
|
+
timing {
|
216
|
+
initialMinimumBalance
|
217
|
+
cliffTime
|
218
|
+
cliffAmount
|
219
|
+
vestingPeriod
|
220
|
+
vestingIncrement
|
221
|
+
}
|
222
|
+
permissions {
|
223
|
+
editState
|
224
|
+
access
|
225
|
+
send
|
226
|
+
receive
|
227
|
+
setDelegate
|
228
|
+
setPermissions
|
229
|
+
setVerificationKey {
|
230
|
+
auth
|
231
|
+
txnVersion
|
232
|
+
}
|
233
|
+
setZkappUri
|
234
|
+
editActionState
|
235
|
+
setTokenSymbol
|
236
|
+
incrementNonce
|
237
|
+
setVotingFor
|
238
|
+
setTiming
|
239
|
+
}
|
240
|
+
delegateAccount { publicKey }
|
241
|
+
votingFor
|
242
|
+
zkappState
|
243
|
+
verificationKey {
|
244
|
+
verificationKey
|
245
|
+
hash
|
246
|
+
}
|
247
|
+
actionState
|
248
|
+
provedState
|
249
|
+
zkappUri
|
250
|
+
}
|
251
|
+
}
|
252
|
+
`;
|
@@ -0,0 +1,79 @@
|
|
1
|
+
export function sleep(ms: number) {
|
2
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
3
|
+
}
|
4
|
+
|
5
|
+
export function makeString(length: number): string {
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
7
|
+
let outString: string = ``;
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
9
|
+
const inOptions: string = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`;
|
10
|
+
|
11
|
+
for (let i = 0; i < length; i++) {
|
12
|
+
outString += inOptions.charAt(Math.floor(Math.random() * inOptions.length));
|
13
|
+
}
|
14
|
+
|
15
|
+
return outString;
|
16
|
+
}
|
17
|
+
|
18
|
+
export function formatTime(ms: number): string {
|
19
|
+
if (ms === undefined) return "";
|
20
|
+
if (ms < 1000) return ms.toString() + " ms";
|
21
|
+
if (ms < 60 * 1000)
|
22
|
+
return parseInt((ms / 1000).toString()).toString() + " sec";
|
23
|
+
if (ms < 60 * 60 * 1000) {
|
24
|
+
const minutes = parseInt((ms / 1000 / 60).toString());
|
25
|
+
const seconds = parseInt(((ms - minutes * 60 * 1000) / 1000).toString());
|
26
|
+
return minutes.toString() + " min " + seconds.toString() + " sec";
|
27
|
+
} else {
|
28
|
+
const hours = parseInt((ms / 1000 / 60 / 60).toString());
|
29
|
+
const minutes = parseInt(
|
30
|
+
((ms - hours * 60 * 60 * 1000) / 1000 / 60).toString()
|
31
|
+
);
|
32
|
+
return hours.toString() + " h " + minutes.toString() + " min";
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
export class Memory {
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
38
|
+
static rss: number = 0;
|
39
|
+
constructor() {
|
40
|
+
Memory.rss = 0;
|
41
|
+
}
|
42
|
+
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
44
|
+
public static info(description: string = ``, fullInfo: boolean = false) {
|
45
|
+
const memoryData = process.memoryUsage();
|
46
|
+
const formatMemoryUsage = (data: number) =>
|
47
|
+
`${Math.round(data / 1024 / 1024)} MB`;
|
48
|
+
const oldRSS = Memory.rss;
|
49
|
+
Memory.rss = Math.round(memoryData.rss / 1024 / 1024);
|
50
|
+
|
51
|
+
const memoryUsage = fullInfo
|
52
|
+
? {
|
53
|
+
step: `${description}:`,
|
54
|
+
rssDelta: `${(oldRSS === 0
|
55
|
+
? 0
|
56
|
+
: Memory.rss - oldRSS
|
57
|
+
).toString()} MB -> Resident Set Size memory change`,
|
58
|
+
rss: `${formatMemoryUsage(
|
59
|
+
memoryData.rss
|
60
|
+
)} -> Resident Set Size - total memory allocated`,
|
61
|
+
heapTotal: `${formatMemoryUsage(
|
62
|
+
memoryData.heapTotal
|
63
|
+
)} -> total size of the allocated heap`,
|
64
|
+
heapUsed: `${formatMemoryUsage(
|
65
|
+
memoryData.heapUsed
|
66
|
+
)} -> actual memory used during the execution`,
|
67
|
+
external: `${formatMemoryUsage(
|
68
|
+
memoryData.external
|
69
|
+
)} -> V8 external memory`,
|
70
|
+
}
|
71
|
+
: `RSS memory ${description}: ${formatMemoryUsage(memoryData.rss)}${
|
72
|
+
oldRSS === 0
|
73
|
+
? ``
|
74
|
+
: `, changed by ` + (Memory.rss - oldRSS).toString() + ` MB`
|
75
|
+
}`;
|
76
|
+
|
77
|
+
console.log(memoryUsage);
|
78
|
+
}
|
79
|
+
}
|