zkcloudworker 0.17.7 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ts/cloud/config.js.map +1 -0
- package/lib/ts/cloud/index.d.ts +4 -0
- package/lib/ts/cloud/index.js +5 -0
- package/lib/ts/cloud/index.js.map +1 -0
- package/lib/ts/cloud/networks.js.map +1 -0
- package/lib/ts/cloud/utils/base64.js.map +1 -0
- package/lib/ts/cloud/utils/graphql.js.map +1 -0
- package/lib/ts/cloud/utils/index.d.ts +3 -0
- package/lib/ts/cloud/utils/index.js +4 -0
- package/lib/ts/cloud/utils/index.js.map +1 -0
- package/lib/ts/cloud/utils/utils.js.map +1 -0
- package/lib/{web/src → ts}/cloud/worker/cloud.d.ts +3 -3
- package/lib/ts/cloud/worker/cloud.js.map +1 -0
- package/lib/ts/cloud/worker/index.d.ts +5 -0
- package/lib/ts/cloud/worker/index.js +6 -0
- package/lib/ts/cloud/worker/index.js.map +1 -0
- package/lib/{web/src → ts}/cloud/worker/job.d.ts +1 -1
- package/lib/{web/src → ts}/cloud/worker/job.js.map +1 -1
- package/lib/{web/src → ts}/cloud/worker/task.d.ts +1 -1
- package/lib/{web/src → ts}/cloud/worker/task.js.map +1 -1
- package/lib/ts/cloud/worker/transaction.js.map +1 -0
- package/lib/{web/src → ts}/cloud/worker/worker.d.ts +1 -1
- package/lib/ts/cloud/worker/worker.js.map +1 -0
- package/lib/ts/index.d.ts +2 -0
- package/lib/ts/index.js +3 -0
- package/lib/ts/index.js.map +1 -0
- package/lib/ts/{src/mina → mina}/api/api.d.ts +2 -2
- package/lib/{web/src → ts}/mina/api/api.js +3 -3
- package/lib/ts/mina/api/api.js.map +1 -0
- package/lib/ts/mina/index.d.ts +7 -0
- package/lib/ts/mina/index.js +9 -0
- package/lib/ts/mina/index.js.map +1 -0
- package/lib/ts/{src/mina → mina}/local/local.d.ts +2 -2
- package/lib/{web/src → ts}/mina/local/local.js +1 -1
- package/lib/ts/mina/local/local.js.map +1 -0
- package/lib/ts/mina/storage/index.d.ts +3 -0
- package/lib/ts/mina/storage/index.js +4 -0
- package/lib/ts/mina/storage/index.js.map +1 -0
- package/lib/ts/mina/storage/ipfs.js.map +1 -0
- package/lib/ts/mina/storage/pinata.js.map +1 -0
- package/lib/{web/src → ts}/mina/storage/storage.d.ts +12 -12
- package/lib/ts/mina/storage/storage.js.map +1 -0
- package/lib/ts/{src/mina → mina}/token/FungibleToken.d.ts +21 -21
- package/lib/ts/mina/token/FungibleToken.js.map +1 -0
- package/lib/ts/{src/mina → mina}/token/FungibleTokenAdmin.d.ts +2 -2
- package/lib/ts/mina/token/FungibleTokenAdmin.js.map +1 -0
- package/lib/{web/src → ts}/mina/token/api.d.ts +3 -3
- package/lib/{web/src → ts}/mina/token/api.js +1 -1
- package/lib/ts/mina/token/api.js.map +1 -0
- package/lib/ts/mina/token/index.d.ts +5 -0
- package/lib/ts/mina/token/index.js +6 -0
- package/lib/ts/mina/token/index.js.map +1 -0
- package/lib/ts/mina/token/vk.js.map +1 -0
- package/lib/{web/src → ts}/mina/token/whitelist.d.ts +28 -28
- package/lib/{web/src → ts}/mina/token/whitelist.js +1 -1
- package/lib/{web/src → ts}/mina/token/whitelist.js.map +1 -1
- package/lib/{web/src → ts}/mina/transactions/account.js +1 -1
- package/lib/ts/mina/transactions/account.js.map +1 -0
- package/lib/{web/src → ts}/mina/transactions/blockberry.d.ts +1 -1
- package/lib/ts/mina/transactions/blockberry.js.map +1 -0
- package/lib/ts/mina/transactions/chain.js.map +1 -0
- package/lib/ts/mina/transactions/index.d.ts +8 -0
- package/lib/ts/mina/transactions/index.js +9 -0
- package/lib/ts/mina/transactions/index.js.map +1 -0
- package/lib/ts/{src/mina → mina}/transactions/nonce.d.ts +2 -2
- package/lib/{web/src → ts}/mina/transactions/nonce.js +2 -2
- package/lib/ts/mina/transactions/nonce.js.map +1 -0
- package/lib/{web/src → ts}/mina/transactions/send.d.ts +1 -1
- package/lib/{web/src → ts}/mina/transactions/send.js +2 -2
- package/lib/ts/mina/transactions/send.js.map +1 -0
- package/lib/ts/{src/mina → mina}/transactions/tiny-contract.d.ts +1 -1
- package/lib/ts/mina/transactions/tiny-contract.js.map +1 -0
- package/lib/{web/src → ts}/mina/transactions/transaction.js +1 -1
- package/lib/ts/mina/transactions/transaction.js.map +1 -0
- package/lib/ts/{src/mina → mina}/transactions/txstatus.d.ts +1 -1
- package/lib/{web/src → ts}/mina/transactions/txstatus.js +1 -1
- package/lib/ts/mina/transactions/txstatus.js.map +1 -0
- package/lib/{web/src → ts}/mina/utils/base64.js +1 -1
- package/lib/ts/mina/utils/base64.js.map +1 -0
- package/lib/{web/src → ts}/mina/utils/fee.js +1 -1
- package/lib/ts/mina/utils/fee.js.map +1 -0
- package/lib/{web/src → ts}/mina/utils/fetch.d.ts +1 -1
- package/lib/{web/src → ts}/mina/utils/fetch.js +1 -1
- package/lib/ts/mina/utils/fetch.js.map +1 -0
- package/lib/{web/src → ts}/mina/utils/fields.js +1 -1
- package/lib/ts/mina/utils/fields.js.map +1 -0
- package/lib/ts/mina/utils/index.d.ts +6 -0
- package/lib/ts/mina/utils/index.js +7 -0
- package/lib/ts/mina/utils/index.js.map +1 -0
- package/lib/ts/{src/mina → mina}/utils/indexed-map.d.ts +2 -2
- package/lib/{web/src → ts}/mina/utils/indexed-map.js +2 -2
- package/lib/ts/mina/utils/indexed-map.js.map +1 -0
- package/lib/ts/{src/mina → mina}/utils/mina.d.ts +1 -1
- package/lib/{web/src → ts}/mina/utils/mina.js +1 -1
- package/lib/ts/mina/utils/mina.js.map +1 -0
- package/lib/ts/mina/verification/index.d.ts +1 -0
- package/lib/ts/mina/verification/index.js +2 -0
- package/lib/ts/mina/verification/index.js.map +1 -0
- package/lib/{web/src → ts}/mina/verification/verification.d.ts +1 -1
- package/lib/ts/mina/verification/verification.js.map +1 -0
- package/lib/tsconfig.web.tsbuildinfo +1 -0
- package/lib/{ts/src → web}/cloud/config.js +2 -3
- package/lib/web/cloud/config.js.map +1 -0
- package/lib/web/cloud/index.d.ts +4 -0
- package/lib/web/cloud/index.js +5 -0
- package/lib/web/cloud/index.js.map +1 -0
- package/lib/{ts/src → web}/cloud/networks.js +2 -9
- package/lib/web/cloud/networks.js.map +1 -0
- package/lib/{ts/src → web}/cloud/utils/base64.js +7 -14
- package/lib/web/cloud/utils/base64.js.map +1 -0
- package/lib/{ts/src → web}/cloud/utils/graphql.js +6 -10
- package/lib/web/cloud/utils/graphql.js.map +1 -0
- package/lib/web/cloud/utils/index.d.ts +3 -0
- package/lib/web/cloud/utils/index.js +4 -0
- package/lib/web/cloud/utils/index.js.map +1 -0
- package/lib/{ts/src → web}/cloud/utils/utils.js +5 -11
- package/lib/web/cloud/utils/utils.js.map +1 -0
- package/lib/{ts/src → web}/cloud/worker/cloud.d.ts +3 -3
- package/lib/{ts/src → web}/cloud/worker/cloud.js +2 -5
- package/lib/web/cloud/worker/cloud.js.map +1 -0
- package/lib/web/cloud/worker/index.d.ts +5 -0
- package/lib/web/cloud/worker/index.js +6 -0
- package/lib/web/cloud/worker/index.js.map +1 -0
- package/lib/{ts/src → web}/cloud/worker/job.d.ts +1 -1
- package/lib/web/cloud/worker/job.js +2 -0
- package/lib/web/cloud/worker/job.js.map +1 -0
- package/lib/{ts/src → web}/cloud/worker/task.d.ts +1 -1
- package/lib/web/cloud/worker/task.js +2 -0
- package/lib/web/cloud/worker/task.js.map +1 -0
- package/lib/{ts/src → web}/cloud/worker/transaction.js +2 -2
- package/lib/web/cloud/worker/transaction.js.map +1 -0
- package/lib/{ts/src → web}/cloud/worker/worker.d.ts +1 -1
- package/lib/{ts/src → web}/cloud/worker/worker.js +2 -5
- package/lib/web/cloud/worker/worker.js.map +1 -0
- package/lib/web/index.d.ts +2 -0
- package/lib/web/index.js +3 -0
- package/lib/web/index.js.map +1 -0
- package/lib/web/{src/mina → mina}/api/api.d.ts +2 -2
- package/lib/{ts/src → web}/mina/api/api.js +17 -23
- package/lib/web/mina/api/api.js.map +1 -0
- package/lib/web/mina/index.d.ts +7 -0
- package/lib/web/mina/index.js +9 -0
- package/lib/web/mina/index.js.map +1 -0
- package/lib/web/{src/mina → mina}/local/local.d.ts +2 -2
- package/lib/{ts/src → web}/mina/local/local.js +5 -9
- package/lib/web/mina/local/local.js.map +1 -0
- package/lib/web/mina/storage/index.d.ts +3 -0
- package/lib/web/mina/storage/index.js +4 -0
- package/lib/web/mina/storage/index.js.map +1 -0
- package/lib/{ts/src → web}/mina/storage/ipfs.js +2 -4
- package/lib/web/mina/storage/ipfs.js.map +1 -0
- package/lib/{ts/src → web}/mina/storage/pinata.js +2 -4
- package/lib/web/mina/storage/pinata.js.map +1 -0
- package/lib/{ts/src → web}/mina/storage/storage.d.ts +12 -12
- package/lib/{ts/src → web}/mina/storage/storage.js +6 -9
- package/lib/web/mina/storage/storage.js.map +1 -0
- package/lib/web/{src/mina → mina}/token/FungibleToken.d.ts +21 -21
- package/lib/{ts/src → web}/mina/token/FungibleToken.js +87 -103
- package/lib/web/mina/token/FungibleToken.js.map +1 -0
- package/lib/web/{src/mina → mina}/token/FungibleTokenAdmin.d.ts +2 -2
- package/lib/{ts/src → web}/mina/token/FungibleTokenAdmin.js +24 -35
- package/lib/web/mina/token/FungibleTokenAdmin.js.map +1 -0
- package/lib/{ts/src → web}/mina/token/api.d.ts +3 -3
- package/lib/{ts/src → web}/mina/token/api.js +4 -7
- package/lib/web/mina/token/api.js.map +1 -0
- package/lib/web/mina/token/index.d.ts +5 -0
- package/lib/web/mina/token/index.js +6 -0
- package/lib/web/mina/token/index.js.map +1 -0
- package/lib/{ts/src → web}/mina/token/vk.js +2 -4
- package/lib/web/mina/token/vk.js.map +1 -0
- package/lib/{ts/src → web}/mina/token/whitelist.d.ts +28 -28
- package/lib/{ts/src → web}/mina/token/whitelist.js +34 -41
- package/lib/web/mina/token/whitelist.js.map +1 -0
- package/lib/web/mina/transactions/account.js +44 -0
- package/lib/web/mina/transactions/account.js.map +1 -0
- package/lib/{ts/src → web}/mina/transactions/blockberry.d.ts +1 -1
- package/lib/{ts/src → web}/mina/transactions/blockberry.js +5 -10
- package/lib/web/mina/transactions/blockberry.js.map +1 -0
- package/lib/web/mina/transactions/chain.js +2 -0
- package/lib/web/mina/transactions/chain.js.map +1 -0
- package/lib/web/mina/transactions/index.d.ts +8 -0
- package/lib/web/mina/transactions/index.js +9 -0
- package/lib/web/mina/transactions/index.js.map +1 -0
- package/lib/web/{src/mina → mina}/transactions/nonce.d.ts +2 -2
- package/lib/{ts/src → web}/mina/transactions/nonce.js +15 -18
- package/lib/web/mina/transactions/nonce.js.map +1 -0
- package/lib/{ts/src → web}/mina/transactions/send.d.ts +1 -1
- package/lib/{ts/src → web}/mina/transactions/send.js +12 -15
- package/lib/web/mina/transactions/send.js.map +1 -0
- package/lib/web/{src/mina → mina}/transactions/tiny-contract.d.ts +1 -1
- package/lib/web/mina/transactions/tiny-contract.js +22 -0
- package/lib/web/mina/transactions/tiny-contract.js.map +1 -0
- package/lib/{ts/src → web}/mina/transactions/transaction.js +18 -22
- package/lib/web/mina/transactions/transaction.js.map +1 -0
- package/lib/web/{src/mina → mina}/transactions/txstatus.d.ts +1 -1
- package/lib/{ts/src → web}/mina/transactions/txstatus.js +4 -6
- package/lib/web/mina/transactions/txstatus.js.map +1 -0
- package/lib/web/mina/utils/base64.js +29 -0
- package/lib/web/mina/utils/base64.js.map +1 -0
- package/lib/web/mina/utils/fee.js +11 -0
- package/lib/web/mina/utils/fee.js.map +1 -0
- package/lib/{ts/src → web}/mina/utils/fetch.d.ts +1 -1
- package/lib/{ts/src → web}/mina/utils/fetch.js +11 -15
- package/lib/web/mina/utils/fetch.js.map +1 -0
- package/lib/{ts/src → web}/mina/utils/fields.js +11 -14
- package/lib/web/mina/utils/fields.js.map +1 -0
- package/lib/web/mina/utils/index.d.ts +6 -0
- package/lib/web/mina/utils/index.js +7 -0
- package/lib/web/mina/utils/index.js.map +1 -0
- package/lib/web/{src/mina → mina}/utils/indexed-map.d.ts +2 -2
- package/lib/{ts/src → web}/mina/utils/indexed-map.js +24 -30
- package/lib/web/mina/utils/indexed-map.js.map +1 -0
- package/lib/web/{src/mina → mina}/utils/mina.d.ts +1 -1
- package/lib/{ts/src → web}/mina/utils/mina.js +21 -29
- package/lib/web/mina/utils/mina.js.map +1 -0
- package/lib/web/mina/verification/index.d.ts +1 -0
- package/lib/web/mina/verification/index.js +2 -0
- package/lib/web/mina/verification/index.js.map +1 -0
- package/lib/{ts/src → web}/mina/verification/verification.d.ts +1 -1
- package/lib/web/mina/verification/verification.js +2 -0
- package/lib/web/mina/verification/verification.js.map +1 -0
- package/package.json +6 -2
- package/lib/ts/src/cloud/index.d.ts +0 -4
- package/lib/ts/src/cloud/index.js +0 -20
- package/lib/ts/src/cloud/utils/index.d.ts +0 -3
- package/lib/ts/src/cloud/utils/index.js +0 -19
- package/lib/ts/src/cloud/worker/index.d.ts +0 -5
- package/lib/ts/src/cloud/worker/index.js +0 -21
- package/lib/ts/src/cloud/worker/job.js +0 -2
- package/lib/ts/src/cloud/worker/task.js +0 -2
- package/lib/ts/src/index.d.ts +0 -2
- package/lib/ts/src/index.js +0 -18
- package/lib/ts/src/mina/index.d.ts +0 -7
- package/lib/ts/src/mina/index.js +0 -24
- package/lib/ts/src/mina/storage/index.d.ts +0 -3
- package/lib/ts/src/mina/storage/index.js +0 -19
- package/lib/ts/src/mina/token/index.d.ts +0 -5
- package/lib/ts/src/mina/token/index.js +0 -21
- package/lib/ts/src/mina/transactions/account.js +0 -48
- package/lib/ts/src/mina/transactions/chain.js +0 -2
- package/lib/ts/src/mina/transactions/index.d.ts +0 -8
- package/lib/ts/src/mina/transactions/index.js +0 -24
- package/lib/ts/src/mina/transactions/tiny-contract.js +0 -33
- package/lib/ts/src/mina/utils/base64.js +0 -34
- package/lib/ts/src/mina/utils/fee.js +0 -16
- package/lib/ts/src/mina/utils/index.d.ts +0 -6
- package/lib/ts/src/mina/utils/index.js +0 -22
- package/lib/ts/src/mina/verification/index.d.ts +0 -1
- package/lib/ts/src/mina/verification/index.js +0 -17
- package/lib/ts/src/mina/verification/verification.js +0 -2
- package/lib/ts/tsconfig.tsbuildinfo +0 -1
- package/lib/web/src/cloud/config.js.map +0 -1
- package/lib/web/src/cloud/index.d.ts +0 -4
- package/lib/web/src/cloud/index.js +0 -5
- package/lib/web/src/cloud/index.js.map +0 -1
- package/lib/web/src/cloud/networks.js.map +0 -1
- package/lib/web/src/cloud/utils/base64.js.map +0 -1
- package/lib/web/src/cloud/utils/graphql.js.map +0 -1
- package/lib/web/src/cloud/utils/index.d.ts +0 -3
- package/lib/web/src/cloud/utils/index.js +0 -4
- package/lib/web/src/cloud/utils/index.js.map +0 -1
- package/lib/web/src/cloud/utils/utils.js.map +0 -1
- package/lib/web/src/cloud/worker/cloud.js.map +0 -1
- package/lib/web/src/cloud/worker/index.d.ts +0 -5
- package/lib/web/src/cloud/worker/index.js +0 -6
- package/lib/web/src/cloud/worker/index.js.map +0 -1
- package/lib/web/src/cloud/worker/transaction.js.map +0 -1
- package/lib/web/src/cloud/worker/worker.js.map +0 -1
- package/lib/web/src/index.d.ts +0 -2
- package/lib/web/src/index.js +0 -3
- package/lib/web/src/index.js.map +0 -1
- package/lib/web/src/mina/api/api.js.map +0 -1
- package/lib/web/src/mina/index.d.ts +0 -7
- package/lib/web/src/mina/index.js +0 -9
- package/lib/web/src/mina/index.js.map +0 -1
- package/lib/web/src/mina/local/local.js.map +0 -1
- package/lib/web/src/mina/storage/index.d.ts +0 -3
- package/lib/web/src/mina/storage/index.js +0 -4
- package/lib/web/src/mina/storage/index.js.map +0 -1
- package/lib/web/src/mina/storage/ipfs.js.map +0 -1
- package/lib/web/src/mina/storage/pinata.js.map +0 -1
- package/lib/web/src/mina/storage/storage.js.map +0 -1
- package/lib/web/src/mina/token/FungibleToken.js.map +0 -1
- package/lib/web/src/mina/token/FungibleTokenAdmin.js.map +0 -1
- package/lib/web/src/mina/token/api.js.map +0 -1
- package/lib/web/src/mina/token/index.d.ts +0 -5
- package/lib/web/src/mina/token/index.js +0 -6
- package/lib/web/src/mina/token/index.js.map +0 -1
- package/lib/web/src/mina/token/vk.js.map +0 -1
- package/lib/web/src/mina/transactions/account.js.map +0 -1
- package/lib/web/src/mina/transactions/blockberry.js.map +0 -1
- package/lib/web/src/mina/transactions/chain.js.map +0 -1
- package/lib/web/src/mina/transactions/index.d.ts +0 -8
- package/lib/web/src/mina/transactions/index.js +0 -9
- package/lib/web/src/mina/transactions/index.js.map +0 -1
- package/lib/web/src/mina/transactions/nonce.js.map +0 -1
- package/lib/web/src/mina/transactions/send.js.map +0 -1
- package/lib/web/src/mina/transactions/tiny-contract.js.map +0 -1
- package/lib/web/src/mina/transactions/transaction.js.map +0 -1
- package/lib/web/src/mina/transactions/txstatus.js.map +0 -1
- package/lib/web/src/mina/utils/base64.js.map +0 -1
- package/lib/web/src/mina/utils/fee.js.map +0 -1
- package/lib/web/src/mina/utils/fetch.js.map +0 -1
- package/lib/web/src/mina/utils/fields.js.map +0 -1
- package/lib/web/src/mina/utils/index.d.ts +0 -6
- package/lib/web/src/mina/utils/index.js +0 -7
- package/lib/web/src/mina/utils/index.js.map +0 -1
- package/lib/web/src/mina/utils/indexed-map.js.map +0 -1
- package/lib/web/src/mina/utils/mina.js.map +0 -1
- package/lib/web/src/mina/verification/index.d.ts +0 -1
- package/lib/web/src/mina/verification/index.js +0 -2
- package/lib/web/src/mina/verification/index.js.map +0 -1
- package/lib/web/src/mina/verification/verification.js.map +0 -1
- package/lib/web/tsconfig.web.tsbuildinfo +0 -1
- /package/lib/ts/{src/cloud → cloud}/config.d.ts +0 -0
- /package/lib/{web/src → ts}/cloud/config.js +0 -0
- /package/lib/ts/{src/cloud → cloud}/networks.d.ts +0 -0
- /package/lib/{web/src → ts}/cloud/networks.js +0 -0
- /package/lib/ts/{src/cloud → cloud}/utils/base64.d.ts +0 -0
- /package/lib/{web/src → ts}/cloud/utils/base64.js +0 -0
- /package/lib/ts/{src/cloud → cloud}/utils/graphql.d.ts +0 -0
- /package/lib/{web/src → ts}/cloud/utils/graphql.js +0 -0
- /package/lib/ts/{src/cloud → cloud}/utils/utils.d.ts +0 -0
- /package/lib/{web/src → ts}/cloud/utils/utils.js +0 -0
- /package/lib/{web/src → ts}/cloud/worker/cloud.js +0 -0
- /package/lib/{web/src → ts}/cloud/worker/job.js +0 -0
- /package/lib/{web/src → ts}/cloud/worker/task.js +0 -0
- /package/lib/ts/{src/cloud → cloud}/worker/transaction.d.ts +0 -0
- /package/lib/{web/src → ts}/cloud/worker/transaction.js +0 -0
- /package/lib/{web/src → ts}/cloud/worker/worker.js +0 -0
- /package/lib/ts/{src/mina → mina}/storage/ipfs.d.ts +0 -0
- /package/lib/{web/src → ts}/mina/storage/ipfs.js +0 -0
- /package/lib/ts/{src/mina → mina}/storage/pinata.d.ts +0 -0
- /package/lib/{web/src → ts}/mina/storage/pinata.js +0 -0
- /package/lib/{web/src → ts}/mina/storage/storage.js +0 -0
- /package/lib/{web/src → ts}/mina/token/FungibleToken.js +0 -0
- /package/lib/{web/src → ts}/mina/token/FungibleTokenAdmin.js +0 -0
- /package/lib/ts/{src/mina → mina}/token/vk.d.ts +0 -0
- /package/lib/{web/src → ts}/mina/token/vk.js +0 -0
- /package/lib/ts/{src/mina → mina}/transactions/account.d.ts +0 -0
- /package/lib/{web/src → ts}/mina/transactions/blockberry.js +0 -0
- /package/lib/ts/{src/mina → mina}/transactions/chain.d.ts +0 -0
- /package/lib/{web/src → ts}/mina/transactions/chain.js +0 -0
- /package/lib/{web/src → ts}/mina/transactions/tiny-contract.js +0 -0
- /package/lib/ts/{src/mina → mina}/transactions/transaction.d.ts +0 -0
- /package/lib/ts/{src/mina → mina}/utils/base64.d.ts +0 -0
- /package/lib/ts/{src/mina → mina}/utils/fee.d.ts +0 -0
- /package/lib/ts/{src/mina → mina}/utils/fields.d.ts +0 -0
- /package/lib/{web/src → ts}/mina/verification/verification.js +0 -0
- /package/lib/web/{src/cloud → cloud}/config.d.ts +0 -0
- /package/lib/web/{src/cloud → cloud}/networks.d.ts +0 -0
- /package/lib/web/{src/cloud → cloud}/utils/base64.d.ts +0 -0
- /package/lib/web/{src/cloud → cloud}/utils/graphql.d.ts +0 -0
- /package/lib/web/{src/cloud → cloud}/utils/utils.d.ts +0 -0
- /package/lib/web/{src/cloud → cloud}/worker/transaction.d.ts +0 -0
- /package/lib/web/{src/mina → mina}/storage/ipfs.d.ts +0 -0
- /package/lib/web/{src/mina → mina}/storage/pinata.d.ts +0 -0
- /package/lib/web/{src/mina → mina}/token/vk.d.ts +0 -0
- /package/lib/web/{src/mina → mina}/transactions/account.d.ts +0 -0
- /package/lib/web/{src/mina → mina}/transactions/chain.d.ts +0 -0
- /package/lib/web/{src/mina → mina}/transactions/transaction.d.ts +0 -0
- /package/lib/web/{src/mina → mina}/utils/base64.d.ts +0 -0
- /package/lib/web/{src/mina → mina}/utils/fee.d.ts +0 -0
- /package/lib/web/{src/mina → mina}/utils/fields.d.ts +0 -0
@@ -1,10 +1,10 @@
|
|
1
1
|
import { Field, Option, PublicKey, UInt64, Bool } from "o1js";
|
2
|
-
import { Storage } from "
|
3
|
-
declare const WhitelistMap_base: typeof import("o1js/dist/node/lib/provable/merkle-tree-indexed").IndexedMerkleMapBase;
|
2
|
+
import { Storage } from "../../index.js";
|
3
|
+
declare const WhitelistMap_base: typeof import("node_modules/o1js/dist/node/lib/provable/merkle-tree-indexed.js").IndexedMerkleMapBase;
|
4
4
|
/** Represents the whitelist using an Indexed Merkle Map. */
|
5
5
|
export declare class WhitelistMap extends WhitelistMap_base {
|
6
6
|
}
|
7
|
-
declare const WhitelistMapOption_base: import("o1js/dist/node/lib/provable/types/provable-intf").Provable<Option<import("o1js/dist/node/lib/provable/merkle-tree-indexed").IndexedMerkleMapBase, {
|
7
|
+
declare const WhitelistMapOption_base: import("node_modules/o1js/dist/node/lib/provable/types/provable-intf.js").Provable<Option<import("node_modules/o1js/dist/node/lib/provable/merkle-tree-indexed.js").IndexedMerkleMapBase, {
|
8
8
|
root: bigint;
|
9
9
|
length: bigint;
|
10
10
|
data: {
|
@@ -30,8 +30,8 @@ declare const WhitelistMapOption_base: import("o1js/dist/node/lib/provable/types
|
|
30
30
|
};
|
31
31
|
} | undefined> & (new (option: {
|
32
32
|
isSome: Bool;
|
33
|
-
value: import("o1js/dist/node/lib/provable/merkle-tree-indexed").IndexedMerkleMapBase;
|
34
|
-
}) => Option<import("o1js/dist/node/lib/provable/merkle-tree-indexed").IndexedMerkleMapBase, {
|
33
|
+
value: import("node_modules/o1js/dist/node/lib/provable/merkle-tree-indexed.js").IndexedMerkleMapBase;
|
34
|
+
}) => Option<import("node_modules/o1js/dist/node/lib/provable/merkle-tree-indexed.js").IndexedMerkleMapBase, {
|
35
35
|
root: bigint;
|
36
36
|
length: bigint;
|
37
37
|
data: {
|
@@ -44,7 +44,7 @@ declare const WhitelistMapOption_base: import("o1js/dist/node/lib/provable/types
|
|
44
44
|
}[];
|
45
45
|
};
|
46
46
|
}>) & {
|
47
|
-
fromValue(value: import("o1js/dist/node/lib/provable/merkle-tree-indexed").IndexedMerkleMapBase | {
|
47
|
+
fromValue(value: import("node_modules/o1js/dist/node/lib/provable/merkle-tree-indexed.js").IndexedMerkleMapBase | {
|
48
48
|
root: bigint;
|
49
49
|
length: bigint;
|
50
50
|
data: {
|
@@ -58,7 +58,7 @@ declare const WhitelistMapOption_base: import("o1js/dist/node/lib/provable/types
|
|
58
58
|
};
|
59
59
|
} | {
|
60
60
|
isSome: boolean | Bool;
|
61
|
-
value: import("o1js/dist/node/lib/provable/merkle-tree-indexed").IndexedMerkleMapBase | {
|
61
|
+
value: import("node_modules/o1js/dist/node/lib/provable/merkle-tree-indexed.js").IndexedMerkleMapBase | {
|
62
62
|
root: bigint;
|
63
63
|
length: bigint;
|
64
64
|
data: {
|
@@ -71,7 +71,7 @@ declare const WhitelistMapOption_base: import("o1js/dist/node/lib/provable/types
|
|
71
71
|
}[];
|
72
72
|
};
|
73
73
|
};
|
74
|
-
} | undefined): Option<import("o1js/dist/node/lib/provable/merkle-tree-indexed").IndexedMerkleMapBase, {
|
74
|
+
} | undefined): Option<import("node_modules/o1js/dist/node/lib/provable/merkle-tree-indexed.js").IndexedMerkleMapBase, {
|
75
75
|
root: bigint;
|
76
76
|
length: bigint;
|
77
77
|
data: {
|
@@ -84,7 +84,7 @@ declare const WhitelistMapOption_base: import("o1js/dist/node/lib/provable/types
|
|
84
84
|
}[];
|
85
85
|
};
|
86
86
|
}>;
|
87
|
-
from(value?: import("o1js/dist/node/lib/provable/merkle-tree-indexed").IndexedMerkleMapBase | {
|
87
|
+
from(value?: import("node_modules/o1js/dist/node/lib/provable/merkle-tree-indexed.js").IndexedMerkleMapBase | {
|
88
88
|
root: bigint;
|
89
89
|
length: bigint;
|
90
90
|
data: {
|
@@ -96,7 +96,7 @@ declare const WhitelistMapOption_base: import("o1js/dist/node/lib/provable/types
|
|
96
96
|
readonly index: number;
|
97
97
|
}[];
|
98
98
|
};
|
99
|
-
} | undefined): Option<import("o1js/dist/node/lib/provable/merkle-tree-indexed").IndexedMerkleMapBase, {
|
99
|
+
} | undefined): Option<import("node_modules/o1js/dist/node/lib/provable/merkle-tree-indexed.js").IndexedMerkleMapBase, {
|
100
100
|
root: bigint;
|
101
101
|
length: bigint;
|
102
102
|
data: {
|
@@ -109,7 +109,7 @@ declare const WhitelistMapOption_base: import("o1js/dist/node/lib/provable/types
|
|
109
109
|
}[];
|
110
110
|
};
|
111
111
|
}>;
|
112
|
-
none(): Option<import("o1js/dist/node/lib/provable/merkle-tree-indexed").IndexedMerkleMapBase, {
|
112
|
+
none(): Option<import("node_modules/o1js/dist/node/lib/provable/merkle-tree-indexed.js").IndexedMerkleMapBase, {
|
113
113
|
root: bigint;
|
114
114
|
length: bigint;
|
115
115
|
data: {
|
@@ -125,8 +125,8 @@ declare const WhitelistMapOption_base: import("o1js/dist/node/lib/provable/types
|
|
125
125
|
};
|
126
126
|
export declare class WhitelistMapOption extends WhitelistMapOption_base {
|
127
127
|
}
|
128
|
-
declare const UInt64Option_base: Omit<import("o1js/dist/node/lib/provable/types/provable-intf").Provable<Option<UInt64, bigint>, bigint | undefined>, "fromFields"> & {
|
129
|
-
fromFields: (fields: import("o1js/dist/node/lib/provable/field").Field[]) => Option<UInt64, bigint>;
|
128
|
+
declare const UInt64Option_base: Omit<import("node_modules/o1js/dist/node/lib/provable/types/provable-intf.js").Provable<Option<UInt64, bigint>, bigint | undefined>, "fromFields"> & {
|
129
|
+
fromFields: (fields: import("node_modules/o1js/dist/node/lib/provable/field.js").Field[]) => Option<UInt64, bigint>;
|
130
130
|
} & (new (option: {
|
131
131
|
isSome: Bool;
|
132
132
|
value: UInt64;
|
@@ -148,7 +148,7 @@ declare const WhitelistedAddress_base: (new (value: {
|
|
148
148
|
amount: UInt64;
|
149
149
|
}) & {
|
150
150
|
_isStruct: true;
|
151
|
-
} & Omit<import("o1js/dist/node/lib/provable/types/provable-intf").Provable<{
|
151
|
+
} & Omit<import("node_modules/o1js/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
152
152
|
address: PublicKey;
|
153
153
|
amount: UInt64;
|
154
154
|
}, {
|
@@ -158,7 +158,7 @@ declare const WhitelistedAddress_base: (new (value: {
|
|
158
158
|
};
|
159
159
|
amount: bigint;
|
160
160
|
}>, "fromFields"> & {
|
161
|
-
fromFields: (fields: import("o1js/dist/node/lib/provable/field").Field[]) => {
|
161
|
+
fromFields: (fields: import("node_modules/o1js/dist/node/lib/provable/field.js").Field[]) => {
|
162
162
|
address: PublicKey;
|
163
163
|
amount: UInt64;
|
164
164
|
};
|
@@ -202,15 +202,15 @@ declare const WhitelistedAddress_base: (new (value: {
|
|
202
202
|
export declare class WhitelistedAddress extends WhitelistedAddress_base {
|
203
203
|
}
|
204
204
|
declare const Whitelist_base: (new (value: {
|
205
|
-
root: import("o1js/dist/node/lib/provable/field").Field;
|
205
|
+
root: import("node_modules/o1js/dist/node/lib/provable/field.js").Field;
|
206
206
|
storage: Storage;
|
207
207
|
}) => {
|
208
|
-
root: import("o1js/dist/node/lib/provable/field").Field;
|
208
|
+
root: import("node_modules/o1js/dist/node/lib/provable/field.js").Field;
|
209
209
|
storage: Storage;
|
210
210
|
}) & {
|
211
211
|
_isStruct: true;
|
212
|
-
} & Omit<import("o1js/dist/node/lib/provable/types/provable-intf").Provable<{
|
213
|
-
root: import("o1js/dist/node/lib/provable/field").Field;
|
212
|
+
} & Omit<import("node_modules/o1js/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
213
|
+
root: import("node_modules/o1js/dist/node/lib/provable/field.js").Field;
|
214
214
|
storage: Storage;
|
215
215
|
}, {
|
216
216
|
root: bigint;
|
@@ -218,29 +218,29 @@ declare const Whitelist_base: (new (value: {
|
|
218
218
|
url: bigint[];
|
219
219
|
};
|
220
220
|
}>, "fromFields"> & {
|
221
|
-
fromFields: (fields: import("o1js/dist/node/lib/provable/field").Field[]) => {
|
222
|
-
root: import("o1js/dist/node/lib/provable/field").Field;
|
221
|
+
fromFields: (fields: import("node_modules/o1js/dist/node/lib/provable/field.js").Field[]) => {
|
222
|
+
root: import("node_modules/o1js/dist/node/lib/provable/field.js").Field;
|
223
223
|
storage: Storage;
|
224
224
|
};
|
225
225
|
} & {
|
226
226
|
fromValue: (value: {
|
227
|
-
root: string | number | bigint | import("o1js/dist/node/lib/provable/field").Field;
|
227
|
+
root: string | number | bigint | import("node_modules/o1js/dist/node/lib/provable/field.js").Field;
|
228
228
|
storage: Storage | {
|
229
|
-
url: import("o1js/dist/node/lib/provable/field").Field[] | bigint[];
|
229
|
+
url: import("node_modules/o1js/dist/node/lib/provable/field.js").Field[] | bigint[];
|
230
230
|
};
|
231
231
|
}) => {
|
232
|
-
root: import("o1js/dist/node/lib/provable/field").Field;
|
232
|
+
root: import("node_modules/o1js/dist/node/lib/provable/field.js").Field;
|
233
233
|
storage: Storage;
|
234
234
|
};
|
235
235
|
toInput: (x: {
|
236
|
-
root: import("o1js/dist/node/lib/provable/field").Field;
|
236
|
+
root: import("node_modules/o1js/dist/node/lib/provable/field.js").Field;
|
237
237
|
storage: Storage;
|
238
238
|
}) => {
|
239
239
|
fields?: Field[] | undefined;
|
240
240
|
packed?: [Field, number][] | undefined;
|
241
241
|
};
|
242
242
|
toJSON: (x: {
|
243
|
-
root: import("o1js/dist/node/lib/provable/field").Field;
|
243
|
+
root: import("node_modules/o1js/dist/node/lib/provable/field.js").Field;
|
244
244
|
storage: Storage;
|
245
245
|
}) => {
|
246
246
|
root: string;
|
@@ -254,11 +254,11 @@ declare const Whitelist_base: (new (value: {
|
|
254
254
|
url: string[];
|
255
255
|
};
|
256
256
|
}) => {
|
257
|
-
root: import("o1js/dist/node/lib/provable/field").Field;
|
257
|
+
root: import("node_modules/o1js/dist/node/lib/provable/field.js").Field;
|
258
258
|
storage: Storage;
|
259
259
|
};
|
260
260
|
empty: () => {
|
261
|
-
root: import("o1js/dist/node/lib/provable/field").Field;
|
261
|
+
root: import("node_modules/o1js/dist/node/lib/provable/field.js").Field;
|
262
262
|
storage: Storage;
|
263
263
|
};
|
264
264
|
};
|
@@ -1,53 +1,46 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const o1js_1 = require("o1js");
|
5
|
-
const __1 = require("../..");
|
6
|
-
const { IndexedMerkleMap } = o1js_1.Experimental;
|
1
|
+
import { Experimental, Struct, Field, Option, Provable, PublicKey, UInt64, Poseidon, } from "o1js";
|
2
|
+
import { serializeIndexedMap, createIpfsURL, pinJSON, Storage, sleep, loadIndexedMerkleMap, } from "../../index.js";
|
3
|
+
const { IndexedMerkleMap } = Experimental;
|
7
4
|
const WHITELIST_HEIGHT = 20;
|
8
5
|
/** Represents the whitelist using an Indexed Merkle Map. */
|
9
|
-
class WhitelistMap extends IndexedMerkleMap(WHITELIST_HEIGHT) {
|
6
|
+
export class WhitelistMap extends IndexedMerkleMap(WHITELIST_HEIGHT) {
|
10
7
|
}
|
11
|
-
|
12
|
-
class WhitelistMapOption extends (0, o1js_1.Option)(WhitelistMap) {
|
8
|
+
export class WhitelistMapOption extends Option(WhitelistMap) {
|
13
9
|
}
|
14
|
-
|
15
|
-
class UInt64Option extends (0, o1js_1.Option)(o1js_1.UInt64) {
|
10
|
+
export class UInt64Option extends Option(UInt64) {
|
16
11
|
}
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
amount: o1js_1.UInt64, // Maximum permitted amount of the transaction
|
12
|
+
export class WhitelistedAddress extends Struct({
|
13
|
+
address: PublicKey,
|
14
|
+
amount: UInt64, // Maximum permitted amount of the transaction
|
21
15
|
}) {
|
22
16
|
}
|
23
|
-
|
24
|
-
class Whitelist extends (0, o1js_1.Struct)({
|
17
|
+
export class Whitelist extends Struct({
|
25
18
|
/** The root hash of the Merkle tree representing the whitelist. */
|
26
|
-
root:
|
19
|
+
root: Field,
|
27
20
|
/** Off-chain storage information, typically an IPFS hash pointing to the whitelist data. */
|
28
|
-
storage:
|
21
|
+
storage: Storage,
|
29
22
|
}) {
|
30
23
|
isNone() {
|
31
24
|
return this.root
|
32
|
-
.equals(
|
33
|
-
.or(
|
25
|
+
.equals(Field(0))
|
26
|
+
.or(Storage.equals(this.storage, Storage.empty()));
|
34
27
|
}
|
35
28
|
isSome() {
|
36
29
|
return this.isNone().not();
|
37
30
|
}
|
38
31
|
async load() {
|
39
32
|
const isNone = this.isNone();
|
40
|
-
const map = await
|
33
|
+
const map = await Provable.witnessAsync(WhitelistMapOption, async () => {
|
41
34
|
if (isNone.toBoolean())
|
42
35
|
return WhitelistMapOption.none();
|
43
36
|
else
|
44
|
-
return WhitelistMapOption.fromValue(await
|
45
|
-
url:
|
37
|
+
return WhitelistMapOption.fromValue(await loadIndexedMerkleMap({
|
38
|
+
url: createIpfsURL({ hash: this.storage.toString() }),
|
46
39
|
type: WhitelistMap,
|
47
40
|
}));
|
48
41
|
});
|
49
42
|
isNone.assertEquals(map.isSome.not());
|
50
|
-
const root =
|
43
|
+
const root = Provable.if(map.isSome, map.orElse(new WhitelistMap()).root, Field(0));
|
51
44
|
root.equals(this.root);
|
52
45
|
return map;
|
53
46
|
}
|
@@ -67,11 +60,11 @@ class Whitelist extends (0, o1js_1.Struct)({
|
|
67
60
|
*/
|
68
61
|
async getWhitelistedAmount(address) {
|
69
62
|
const map = await this.load();
|
70
|
-
const key =
|
63
|
+
const key = Poseidon.hashPacked(PublicKey, address);
|
71
64
|
const value = map.orElse(new WhitelistMap()).getOption(key);
|
72
|
-
const valueField = value.orElse(
|
73
|
-
valueField.assertLessThanOrEqual(
|
74
|
-
const amount =
|
65
|
+
const valueField = value.orElse(UInt64.MAXINT().value);
|
66
|
+
valueField.assertLessThanOrEqual(UInt64.MAXINT().value);
|
67
|
+
const amount = UInt64.Unsafe.fromField(valueField);
|
75
68
|
return new UInt64Option({
|
76
69
|
value: amount,
|
77
70
|
isSome: value.isSome.or(this.isNone()),
|
@@ -79,8 +72,8 @@ class Whitelist extends (0, o1js_1.Struct)({
|
|
79
72
|
}
|
80
73
|
static empty() {
|
81
74
|
return new Whitelist({
|
82
|
-
root:
|
83
|
-
storage:
|
75
|
+
root: Field(0),
|
76
|
+
storage: Storage.empty(),
|
84
77
|
});
|
85
78
|
}
|
86
79
|
/**
|
@@ -92,17 +85,17 @@ class Whitelist extends (0, o1js_1.Struct)({
|
|
92
85
|
const { name = "whitelist.json", keyvalues = [{ key: "library", value: "zkcloudworker" }], timeout = 60 * 1000, attempts = 5, auth, } = params;
|
93
86
|
const list = typeof params.list[0].address === "string"
|
94
87
|
? params.list.map((item) => new WhitelistedAddress({
|
95
|
-
address:
|
88
|
+
address: PublicKey.fromBase58(item.address),
|
96
89
|
amount: item.amount
|
97
|
-
?
|
98
|
-
:
|
90
|
+
? UInt64.from(item.amount)
|
91
|
+
: UInt64.MAXINT(),
|
99
92
|
}))
|
100
93
|
: params.list;
|
101
94
|
const map = new WhitelistMap();
|
102
95
|
for (const item of list) {
|
103
|
-
map.insert(
|
96
|
+
map.insert(Poseidon.hashPacked(PublicKey, item.address), item.amount.toBigInt());
|
104
97
|
}
|
105
|
-
const serializedMap =
|
98
|
+
const serializedMap = serializeIndexedMap(map);
|
106
99
|
const json = {
|
107
100
|
map: serializedMap,
|
108
101
|
whitelist: list.map((item) => ({
|
@@ -112,7 +105,7 @@ class Whitelist extends (0, o1js_1.Struct)({
|
|
112
105
|
};
|
113
106
|
let attempt = 0;
|
114
107
|
const start = Date.now();
|
115
|
-
let hash = await
|
108
|
+
let hash = await pinJSON({
|
116
109
|
data: json,
|
117
110
|
name,
|
118
111
|
keyvalues,
|
@@ -120,8 +113,8 @@ class Whitelist extends (0, o1js_1.Struct)({
|
|
120
113
|
});
|
121
114
|
while (!hash && attempt < attempts && Date.now() - start < timeout) {
|
122
115
|
attempt++;
|
123
|
-
await
|
124
|
-
hash = await
|
116
|
+
await sleep(5000 * attempt); // handle rate-limits
|
117
|
+
hash = await pinJSON({
|
125
118
|
data: json,
|
126
119
|
name,
|
127
120
|
keyvalues,
|
@@ -132,8 +125,8 @@ class Whitelist extends (0, o1js_1.Struct)({
|
|
132
125
|
throw new Error("Failed to pin whitelist");
|
133
126
|
return new Whitelist({
|
134
127
|
root: map.root,
|
135
|
-
storage:
|
128
|
+
storage: Storage.fromString(hash),
|
136
129
|
});
|
137
130
|
}
|
138
131
|
}
|
139
|
-
|
132
|
+
//# sourceMappingURL=whitelist.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"whitelist.js","sourceRoot":"","sources":["../../../../../src/mina/token/whitelist.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,MAAM,EACN,QAAQ,GAET,MAAM,MAAM,CAAC;AACd,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,OAAO,EACP,OAAO,EACP,KAAK,EACL,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAExB,MAAM,EAAE,gBAAgB,EAAE,GAAG,YAAY,CAAC;AAE1C,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,4DAA4D;AAC5D,MAAM,OAAO,YAAa,SAAQ,g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M,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;aACvC,CAAC,CAAC;SACJ,CAAC;QACF,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,IAAI,IAAI,GAAG,MAAM,OAAO,CAAC;YACvB,IAAI,EAAE,IAAI;YACV,IAAI;YACJ,SAAS;YACT,IAAI;SACL,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,IAAI,OAAO,GAAG,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,OAAO,EAAE,CAAC;YACnE,OAAO,EAAE,CAAC;YACV,MAAM,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,qBAAqB;YAClD,IAAI,GAAG,MAAM,OAAO,CAAC;gBACnB,IAAI,EAAE,IAAI;gBACV,IAAI;gBACJ,SAAS;gBACT,IAAI;aACL,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAEtD,OAAO,IAAI,SAAS,CAAC;YACnB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;SAClC,CAAC,CAAC;IACL,CAAC;CACF"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { fetchMinaAccount } from "../index.js";
|
2
|
+
import { Mina, PublicKey } from "o1js";
|
3
|
+
export async function accountExists(address, tokenId) {
|
4
|
+
try {
|
5
|
+
const publicKey = typeof address === "string" ? PublicKey.fromBase58(address) : address;
|
6
|
+
await fetchMinaAccount({ publicKey, tokenId, force: false });
|
7
|
+
return Mina.hasAccount(publicKey, tokenId);
|
8
|
+
}
|
9
|
+
catch (error) {
|
10
|
+
return false;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
export async function tokenBalance(address, tokenId) {
|
14
|
+
try {
|
15
|
+
const publicKey = typeof address === "string" ? PublicKey.fromBase58(address) : address;
|
16
|
+
await fetchMinaAccount({ publicKey, tokenId, force: false });
|
17
|
+
return Mina.hasAccount(publicKey, tokenId)
|
18
|
+
? Number(Mina.getAccount(publicKey, tokenId).balance.toBigInt())
|
19
|
+
: undefined;
|
20
|
+
}
|
21
|
+
catch (error) {
|
22
|
+
console.error("Cannot fetch account balance", error);
|
23
|
+
return undefined;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
export async function checkAddress(address) {
|
27
|
+
if (!address || typeof address !== "string") {
|
28
|
+
console.error("checkAddress params are invalid:", address);
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
try {
|
32
|
+
const publicKey = PublicKey.fromBase58(address);
|
33
|
+
if (address !== publicKey.toBase58()) {
|
34
|
+
console.log("checkAddress: address is not valid", address, publicKey.toBase58());
|
35
|
+
return false;
|
36
|
+
}
|
37
|
+
return true;
|
38
|
+
}
|
39
|
+
catch (error) {
|
40
|
+
console.error("checkAddress catch", { address, error });
|
41
|
+
return false;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
//# sourceMappingURL=account.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../../src/mina/transactions/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAS,MAAM,MAAM,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAA2B,EAC3B,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,SAAS,GACb,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACxE,MAAM,gBAAgB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QA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,CAAC,QAAQ,EAAE,CACrB,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QACxD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
@@ -1,10 +1,4 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getZkAppTxsFromBlockBerry = getZkAppTxsFromBlockBerry;
|
4
|
-
exports.getPaymentTxsFromBlockBerry = getPaymentTxsFromBlockBerry;
|
5
|
-
exports.getZkAppTxFromBlockBerry = getZkAppTxFromBlockBerry;
|
6
|
-
exports.getZkAppFromBlockBerry = getZkAppFromBlockBerry;
|
7
|
-
async function getZkAppTxsFromBlockBerry(params) {
|
1
|
+
export async function getZkAppTxsFromBlockBerry(params) {
|
8
2
|
const { account, chain, blockBerryApiKey } = params;
|
9
3
|
const options = {
|
10
4
|
method: "GET",
|
@@ -28,7 +22,7 @@ async function getZkAppTxsFromBlockBerry(params) {
|
|
28
22
|
return undefined;
|
29
23
|
}
|
30
24
|
}
|
31
|
-
async function getPaymentTxsFromBlockBerry(params) {
|
25
|
+
export async function getPaymentTxsFromBlockBerry(params) {
|
32
26
|
const { account, chain, blockBerryApiKey } = params;
|
33
27
|
const options = {
|
34
28
|
method: "GET",
|
@@ -54,7 +48,7 @@ async function getPaymentTxsFromBlockBerry(params) {
|
|
54
48
|
return undefined;
|
55
49
|
}
|
56
50
|
}
|
57
|
-
async function getZkAppTxFromBlockBerry(params) {
|
51
|
+
export async function getZkAppTxFromBlockBerry(params) {
|
58
52
|
const { hash, chain, blockBerryApiKey } = params;
|
59
53
|
const options = {
|
60
54
|
method: "GET",
|
@@ -79,7 +73,7 @@ async function getZkAppTxFromBlockBerry(params) {
|
|
79
73
|
return undefined;
|
80
74
|
}
|
81
75
|
}
|
82
|
-
async function getZkAppFromBlockBerry(params) {
|
76
|
+
export async function getZkAppFromBlockBerry(params) {
|
83
77
|
const { account, chain, blockBerryApiKey } = params;
|
84
78
|
const options = {
|
85
79
|
method: "GET",
|
@@ -109,3 +103,4 @@ async function getZkAppFromBlockBerry(params) {
|
|
109
103
|
return undefined;
|
110
104
|
}
|
111
105
|
}
|
106
|
+
//# sourceMappingURL=blockberry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"blockberry.js","sourceRoot":"","sources":["../../../../../src/mina/transactions/blockberry.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,MAI/C;IACC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;IACpD,MAAM,OAAO,GAAG;QACd,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,WAAW,EAAE,gBAAgB;SAC9B;KACF,CAAC;IACF,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,mCAAmC,KAAK,uBAAuB,OAAO,sCAAsC,EAC5G,OAAO,CACR,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,OAAO,CAAC,KAAK,CACX,qCAAqC,EACrC,OAAO,EACP,KAAK,EACL,QAAQ,CAAC,UAAU,CACpB,CAAC;YACF,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACrC,kCAAkC;QAClC,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CACX,6CAA6C,EAC7C,OAAO,EACP,KAAK,EACL,GAAG,CACJ,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM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AAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CACX,4DAA4D,EAC5D,OAAO,EACP,KAAK,EACL,GAAG,CACJ,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../../../src/mina/transactions/chain.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export * from "./nonce.js";
|
2
|
+
export * from "./transaction.js";
|
3
|
+
export * from "./txstatus.js";
|
4
|
+
export * from "./chain.js";
|
5
|
+
export * from "./blockberry.js";
|
6
|
+
export * from "./tiny-contract.js";
|
7
|
+
export * from "./send.js";
|
8
|
+
export * from "./account.js";
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/mina/transactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { BlockBerryChain } from "./chain";
|
2
|
-
import { blockchain } from "../../cloud";
|
1
|
+
import { BlockBerryChain } from "./chain.js";
|
2
|
+
import { blockchain } from "../../cloud/networks.js";
|
3
3
|
export declare function getNonce(params: {
|
4
4
|
account: string;
|
5
5
|
chain: BlockBerryChain;
|
@@ -1,11 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const blockberry_1 = require("./blockberry");
|
6
|
-
const __1 = require("..");
|
7
|
-
const o1js_1 = require("o1js");
|
8
|
-
async function getNonce(params) {
|
1
|
+
import { getZkAppTxsFromBlockBerry, getPaymentTxsFromBlockBerry, } from "./blockberry.js";
|
2
|
+
import { fetchMinaAccount, getCurrentNetwork } from "../index.js";
|
3
|
+
import { Mina, PublicKey } from "o1js";
|
4
|
+
export async function getNonce(params) {
|
9
5
|
const { account, chain, blockBerryApiKey } = params;
|
10
6
|
try {
|
11
7
|
if (account === undefined || account === null || account === "") {
|
@@ -24,12 +20,12 @@ async function getNonce(params) {
|
|
24
20
|
message: "blockBerryApiKey is required",
|
25
21
|
};
|
26
22
|
}
|
27
|
-
const zkAppTxsPromise =
|
23
|
+
const zkAppTxsPromise = getZkAppTxsFromBlockBerry({
|
28
24
|
account,
|
29
25
|
chain,
|
30
26
|
blockBerryApiKey,
|
31
27
|
});
|
32
|
-
const paymentTxs =
|
28
|
+
const paymentTxs = getPaymentTxsFromBlockBerry({
|
33
29
|
account,
|
34
30
|
chain,
|
35
31
|
blockBerryApiKey,
|
@@ -61,14 +57,14 @@ async function getNonce(params) {
|
|
61
57
|
};
|
62
58
|
}
|
63
59
|
}
|
64
|
-
async function getAccountNonce(params) {
|
65
|
-
const { account, chain =
|
60
|
+
export async function getAccountNonce(params) {
|
61
|
+
const { account, chain = getCurrentNetwork().network.chainId, blockBerryApiKey, verbose = true, } = params;
|
66
62
|
const canUseBlockBerry = blockBerryApiKey !== undefined &&
|
67
63
|
(chain === "devnet" || chain === "mainnet");
|
68
64
|
if (chain === "zeko") {
|
69
|
-
const publicKey =
|
70
|
-
await
|
71
|
-
const nonce = Number(
|
65
|
+
const publicKey = PublicKey.fromBase58(account);
|
66
|
+
await fetchMinaAccount({ publicKey });
|
67
|
+
const nonce = Number(Mina.getAccount(publicKey).nonce.toBigint());
|
72
68
|
return nonce;
|
73
69
|
}
|
74
70
|
else {
|
@@ -79,9 +75,9 @@ async function getAccountNonce(params) {
|
|
79
75
|
chain,
|
80
76
|
})
|
81
77
|
: undefined;
|
82
|
-
const publicKey =
|
83
|
-
await
|
84
|
-
const senderNonce = Number(
|
78
|
+
const publicKey = PublicKey.fromBase58(account);
|
79
|
+
await fetchMinaAccount({ publicKey });
|
80
|
+
const senderNonce = Number(Mina.getAccount(publicKey).nonce.toBigint());
|
85
81
|
const blockberryNonce = blockberryNoncePromise
|
86
82
|
? (await blockberryNoncePromise).nonce ?? -1
|
87
83
|
: -1;
|
@@ -91,3 +87,4 @@ async function getAccountNonce(params) {
|
|
91
87
|
return nonce;
|
92
88
|
}
|
93
89
|
}
|
90
|
+
//# sourceMappingURL=nonce.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nonce.js","sourceRoot":"","sources":["../../../../../src/mina/transactions/nonce.ts"],"names":[],"mappings":"AACA,OAAO,EACL,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAGvC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,MAI9B;IAKC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;IACpD,IAAI,CAAC;QACH,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;YAChE,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,CAAC,CAAC;gBACT,OAAO,EAAE,qBAAqB;aAC/B,CAAC;QACJ,CAAC;QAED,IACE,gBAAgB,KAAK,SAAS;YAC9B,gBAAgB,KAAK,IAAI;YACzB,gBAAgB,KAAK,EAAE,EACvB,CAAC;YACD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,CAAC,CAAC;gBACT,OAAO,EAAE,8BAA8B;aACxC,CAAC;QACJ,CAAC;QACD,MAAM,eAAe,GAAG,yBAAyB,CAAC;YAChD,OAAO;YACP,KAAK;YACL,gBAAgB;SACjB,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