@mocanetwork/privado-js-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -0
- package/dist/browser/esm/index.js +14901 -0
- package/dist/browser/esm/index.js.map +1 -0
- package/dist/browser/umd/index.global.js +678 -0
- package/dist/browser/umd/index.global.js.map +1 -0
- package/dist/node/cjs/index.cjs +15418 -0
- package/dist/node/cjs/index.cjs.map +1 -0
- package/dist/node/esm/index.js +14901 -0
- package/dist/node/esm/index.js.map +1 -0
- package/dist/types/blockchain/index.d.ts +2 -0
- package/dist/types/blockchain/index.d.ts.map +1 -0
- package/dist/types/blockchain/transaction-service.d.ts +81 -0
- package/dist/types/blockchain/transaction-service.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-mtp-v2-on-chain.d.ts +70 -0
- package/dist/types/circuits/atomic-query-mtp-v2-on-chain.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-mtp-v2.d.ts +63 -0
- package/dist/types/circuits/atomic-query-mtp-v2.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-sig-v2-on-chain.d.ts +137 -0
- package/dist/types/circuits/atomic-query-sig-v2-on-chain.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-sig-v2.d.ts +64 -0
- package/dist/types/circuits/atomic-query-sig-v2.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-v3-on-chain.d.ts +141 -0
- package/dist/types/circuits/atomic-query-v3-on-chain.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-v3.d.ts +121 -0
- package/dist/types/circuits/atomic-query-v3.d.ts.map +1 -0
- package/dist/types/circuits/auth-v2.d.ts +46 -0
- package/dist/types/circuits/auth-v2.d.ts.map +1 -0
- package/dist/types/circuits/common.d.ts +153 -0
- package/dist/types/circuits/common.d.ts.map +1 -0
- package/dist/types/circuits/comparer.d.ts +122 -0
- package/dist/types/circuits/comparer.d.ts.map +1 -0
- package/dist/types/circuits/index.d.ts +13 -0
- package/dist/types/circuits/index.d.ts.map +1 -0
- package/dist/types/circuits/linked-multi-query.d.ts +38 -0
- package/dist/types/circuits/linked-multi-query.d.ts.map +1 -0
- package/dist/types/circuits/models.d.ts +189 -0
- package/dist/types/circuits/models.d.ts.map +1 -0
- package/dist/types/circuits/state-transition.d.ts +49 -0
- package/dist/types/circuits/state-transition.d.ts.map +1 -0
- package/dist/types/credentials/credential-wallet.d.ts +200 -0
- package/dist/types/credentials/credential-wallet.d.ts.map +1 -0
- package/dist/types/credentials/index.d.ts +12 -0
- package/dist/types/credentials/index.d.ts.map +1 -0
- package/dist/types/credentials/models.d.ts +84 -0
- package/dist/types/credentials/models.d.ts.map +1 -0
- package/dist/types/credentials/rhs.d.ts +38 -0
- package/dist/types/credentials/rhs.d.ts.map +1 -0
- package/dist/types/credentials/status/agent-revocation.d.ts +20 -0
- package/dist/types/credentials/status/agent-revocation.d.ts.map +1 -0
- package/dist/types/credentials/status/credential-status-publisher.d.ts +73 -0
- package/dist/types/credentials/status/credential-status-publisher.d.ts.map +1 -0
- package/dist/types/credentials/status/did-resolver-revocation.d.ts +8 -0
- package/dist/types/credentials/status/did-resolver-revocation.d.ts.map +1 -0
- package/dist/types/credentials/status/on-chain-revocation.d.ts +58 -0
- package/dist/types/credentials/status/on-chain-revocation.d.ts.map +1 -0
- package/dist/types/credentials/status/resolver.d.ts +69 -0
- package/dist/types/credentials/status/resolver.d.ts.map +1 -0
- package/dist/types/credentials/status/reverse-sparse-merkle-tree.d.ts +126 -0
- package/dist/types/credentials/status/reverse-sparse-merkle-tree.d.ts.map +1 -0
- package/dist/types/credentials/status/sparse-merkle-tree.d.ts +38 -0
- package/dist/types/credentials/status/sparse-merkle-tree.d.ts.map +1 -0
- package/dist/types/credentials/utils.d.ts +15 -0
- package/dist/types/credentials/utils.d.ts.map +1 -0
- package/dist/types/iden3comm/constants.d.ts +61 -0
- package/dist/types/iden3comm/constants.d.ts.map +1 -0
- package/dist/types/iden3comm/errors.d.ts +10 -0
- package/dist/types/iden3comm/errors.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/auth.d.ts +157 -0
- package/dist/types/iden3comm/handlers/auth.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/common.d.ts +72 -0
- package/dist/types/iden3comm/handlers/common.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/contract-request.d.ts +96 -0
- package/dist/types/iden3comm/handlers/contract-request.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/credential-proposal.d.ts +120 -0
- package/dist/types/iden3comm/handlers/credential-proposal.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/discovery-protocol.d.ts +101 -0
- package/dist/types/iden3comm/handlers/discovery-protocol.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/fetch.d.ts +130 -0
- package/dist/types/iden3comm/handlers/fetch.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/index.d.ts +12 -0
- package/dist/types/iden3comm/handlers/index.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/message-handler.d.ts +93 -0
- package/dist/types/iden3comm/handlers/message-handler.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/payment.d.ts +167 -0
- package/dist/types/iden3comm/handlers/payment.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/problem-report.d.ts +18 -0
- package/dist/types/iden3comm/handlers/problem-report.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/refresh.d.ts +57 -0
- package/dist/types/iden3comm/handlers/refresh.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/revocation-status.d.ts +76 -0
- package/dist/types/iden3comm/handlers/revocation-status.d.ts.map +1 -0
- package/dist/types/iden3comm/index.d.ts +9 -0
- package/dist/types/iden3comm/index.d.ts.map +1 -0
- package/dist/types/iden3comm/packageManager.d.ts +47 -0
- package/dist/types/iden3comm/packageManager.d.ts.map +1 -0
- package/dist/types/iden3comm/packers/index.d.ts +4 -0
- package/dist/types/iden3comm/packers/index.d.ts.map +1 -0
- package/dist/types/iden3comm/packers/jws.d.ts +56 -0
- package/dist/types/iden3comm/packers/jws.d.ts.map +1 -0
- package/dist/types/iden3comm/packers/plain.d.ts +47 -0
- package/dist/types/iden3comm/packers/plain.d.ts.map +1 -0
- package/dist/types/iden3comm/packers/zkp.d.ts +98 -0
- package/dist/types/iden3comm/packers/zkp.d.ts.map +1 -0
- package/dist/types/iden3comm/types/index.d.ts +17 -0
- package/dist/types/iden3comm/types/index.d.ts.map +1 -0
- package/dist/types/iden3comm/types/models.d.ts +7 -0
- package/dist/types/iden3comm/types/models.d.ts.map +1 -0
- package/dist/types/iden3comm/types/packageManager.d.ts +100 -0
- package/dist/types/iden3comm/types/packageManager.d.ts.map +1 -0
- package/dist/types/iden3comm/types/packer.d.ts +158 -0
- package/dist/types/iden3comm/types/packer.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/accept-profile.d.ts +8 -0
- package/dist/types/iden3comm/types/protocol/accept-profile.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/attachment.d.ts +11 -0
- package/dist/types/iden3comm/types/protocol/attachment.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/auth.d.ts +90 -0
- package/dist/types/iden3comm/types/protocol/auth.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/common.d.ts +11 -0
- package/dist/types/iden3comm/types/protocol/common.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/contract-request.d.ts +62 -0
- package/dist/types/iden3comm/types/protocol/contract-request.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/credentials.d.ts +82 -0
- package/dist/types/iden3comm/types/protocol/credentials.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/discovery-protocol.d.ts +42 -0
- package/dist/types/iden3comm/types/protocol/discovery-protocol.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/messages.d.ts +12 -0
- package/dist/types/iden3comm/types/protocol/messages.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/payment.d.ts +178 -0
- package/dist/types/iden3comm/types/protocol/payment.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/problem-report.d.ts +17 -0
- package/dist/types/iden3comm/types/protocol/problem-report.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/proof.d.ts +22 -0
- package/dist/types/iden3comm/types/protocol/proof.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/proposal-request.d.ts +33 -0
- package/dist/types/iden3comm/types/protocol/proposal-request.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/revocation.d.ts +20 -0
- package/dist/types/iden3comm/types/protocol/revocation.d.ts.map +1 -0
- package/dist/types/iden3comm/utils/accept-profile.d.ts +4 -0
- package/dist/types/iden3comm/utils/accept-profile.d.ts.map +1 -0
- package/dist/types/iden3comm/utils/did.d.ts +8 -0
- package/dist/types/iden3comm/utils/did.d.ts.map +1 -0
- package/dist/types/iden3comm/utils/envelope.d.ts +32 -0
- package/dist/types/iden3comm/utils/envelope.d.ts.map +1 -0
- package/dist/types/iden3comm/utils/index.d.ts +5 -0
- package/dist/types/iden3comm/utils/index.d.ts.map +1 -0
- package/dist/types/iden3comm/utils/message.d.ts +20 -0
- package/dist/types/iden3comm/utils/message.d.ts.map +1 -0
- package/dist/types/identity/common.d.ts +27 -0
- package/dist/types/identity/common.d.ts.map +1 -0
- package/dist/types/identity/identity-wallet.d.ts +472 -0
- package/dist/types/identity/identity-wallet.d.ts.map +1 -0
- package/dist/types/identity/index.d.ts +3 -0
- package/dist/types/identity/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/kms/index.d.ts +5 -0
- package/dist/types/kms/index.d.ts.map +1 -0
- package/dist/types/kms/key-providers/bjj-provider.d.ts +54 -0
- package/dist/types/kms/key-providers/bjj-provider.d.ts.map +1 -0
- package/dist/types/kms/key-providers/ed25519-provider.d.ts +61 -0
- package/dist/types/kms/key-providers/ed25519-provider.d.ts.map +1 -0
- package/dist/types/kms/key-providers/index.d.ts +4 -0
- package/dist/types/kms/key-providers/index.d.ts.map +1 -0
- package/dist/types/kms/key-providers/secp256k1-provider.d.ts +62 -0
- package/dist/types/kms/key-providers/secp256k1-provider.d.ts.map +1 -0
- package/dist/types/kms/kms.d.ts +120 -0
- package/dist/types/kms/kms.d.ts.map +1 -0
- package/dist/types/kms/provider-helpers.d.ts +10 -0
- package/dist/types/kms/provider-helpers.d.ts.map +1 -0
- package/dist/types/kms/store/abstract-key-store.d.ts +41 -0
- package/dist/types/kms/store/abstract-key-store.d.ts.map +1 -0
- package/dist/types/kms/store/index.d.ts +6 -0
- package/dist/types/kms/store/index.d.ts.map +1 -0
- package/dist/types/kms/store/indexed-db-key-store.d.ts +44 -0
- package/dist/types/kms/store/indexed-db-key-store.d.ts.map +1 -0
- package/dist/types/kms/store/local-storage-key-store.d.ts +42 -0
- package/dist/types/kms/store/local-storage-key-store.d.ts.map +1 -0
- package/dist/types/kms/store/memory-key-store.d.ts +24 -0
- package/dist/types/kms/store/memory-key-store.d.ts.map +1 -0
- package/dist/types/kms/store/types.d.ts +21 -0
- package/dist/types/kms/store/types.d.ts.map +1 -0
- package/dist/types/proof/common.d.ts +49 -0
- package/dist/types/proof/common.d.ts.map +1 -0
- package/dist/types/proof/index.d.ts +5 -0
- package/dist/types/proof/index.d.ts.map +1 -0
- package/dist/types/proof/proof-service.d.ts +169 -0
- package/dist/types/proof/proof-service.d.ts.map +1 -0
- package/dist/types/proof/provers/index.d.ts +4 -0
- package/dist/types/proof/provers/index.d.ts.map +1 -0
- package/dist/types/proof/provers/inputs-generator.d.ts +57 -0
- package/dist/types/proof/provers/inputs-generator.d.ts.map +1 -0
- package/dist/types/proof/provers/prover.d.ts +56 -0
- package/dist/types/proof/provers/prover.d.ts.map +1 -0
- package/dist/types/proof/provers/witness_calculator.d.ts +17 -0
- package/dist/types/proof/provers/witness_calculator.d.ts.map +1 -0
- package/dist/types/proof/verifiers/index.d.ts +4 -0
- package/dist/types/proof/verifiers/index.d.ts.map +1 -0
- package/dist/types/proof/verifiers/pub-signals-verifier.d.ts +60 -0
- package/dist/types/proof/verifiers/pub-signals-verifier.d.ts.map +1 -0
- package/dist/types/proof/verifiers/query-hash.d.ts +4 -0
- package/dist/types/proof/verifiers/query-hash.d.ts.map +1 -0
- package/dist/types/proof/verifiers/query.d.ts +43 -0
- package/dist/types/proof/verifiers/query.d.ts.map +1 -0
- package/dist/types/schema-processor/index.d.ts +4 -0
- package/dist/types/schema-processor/index.d.ts.map +1 -0
- package/dist/types/schema-processor/json/index.d.ts +3 -0
- package/dist/types/schema-processor/json/index.d.ts.map +1 -0
- package/dist/types/schema-processor/json/parser.d.ts +141 -0
- package/dist/types/schema-processor/json/parser.d.ts.map +1 -0
- package/dist/types/schema-processor/json/validator.d.ts +26 -0
- package/dist/types/schema-processor/json/validator.d.ts.map +1 -0
- package/dist/types/schema-processor/jsonld/cache.d.ts +3 -0
- package/dist/types/schema-processor/jsonld/cache.d.ts.map +1 -0
- package/dist/types/schema-processor/jsonld/index.d.ts +3 -0
- package/dist/types/schema-processor/jsonld/index.d.ts.map +1 -0
- package/dist/types/schema-processor/jsonld/parser.d.ts +30 -0
- package/dist/types/schema-processor/jsonld/parser.d.ts.map +1 -0
- package/dist/types/schema-processor/utils.d.ts +54 -0
- package/dist/types/schema-processor/utils.d.ts.map +1 -0
- package/dist/types/storage/blockchain/common.d.ts +8 -0
- package/dist/types/storage/blockchain/common.d.ts.map +1 -0
- package/dist/types/storage/blockchain/did-resolver-readonly-storage.d.ts +17 -0
- package/dist/types/storage/blockchain/did-resolver-readonly-storage.d.ts.map +1 -0
- package/dist/types/storage/blockchain/erc20-helper.d.ts +20 -0
- package/dist/types/storage/blockchain/erc20-helper.d.ts.map +1 -0
- package/dist/types/storage/blockchain/errors.d.ts +4 -0
- package/dist/types/storage/blockchain/errors.d.ts.map +1 -0
- package/dist/types/storage/blockchain/index.d.ts +8 -0
- package/dist/types/storage/blockchain/index.d.ts.map +1 -0
- package/dist/types/storage/blockchain/onchain-issuer-adapter/non-merklized/version/v0.0.1/onchain-non-merklized-issuer-adapter.d.ts +67 -0
- package/dist/types/storage/blockchain/onchain-issuer-adapter/non-merklized/version/v0.0.1/onchain-non-merklized-issuer-adapter.d.ts.map +1 -0
- package/dist/types/storage/blockchain/onchain-issuer.d.ts +41 -0
- package/dist/types/storage/blockchain/onchain-issuer.d.ts.map +1 -0
- package/dist/types/storage/blockchain/onchain-revocation.d.ts +41 -0
- package/dist/types/storage/blockchain/onchain-revocation.d.ts.map +1 -0
- package/dist/types/storage/blockchain/onchain-zkp-verifier.d.ts +116 -0
- package/dist/types/storage/blockchain/onchain-zkp-verifier.d.ts.map +1 -0
- package/dist/types/storage/blockchain/state.d.ts +127 -0
- package/dist/types/storage/blockchain/state.d.ts.map +1 -0
- package/dist/types/storage/entities/circuitData.d.ts +8 -0
- package/dist/types/storage/entities/circuitData.d.ts.map +1 -0
- package/dist/types/storage/entities/identity.d.ts +17 -0
- package/dist/types/storage/entities/identity.d.ts.map +1 -0
- package/dist/types/storage/entities/index.d.ts +5 -0
- package/dist/types/storage/entities/index.d.ts.map +1 -0
- package/dist/types/storage/entities/mt.d.ts +22 -0
- package/dist/types/storage/entities/mt.d.ts.map +1 -0
- package/dist/types/storage/entities/state.d.ts +92 -0
- package/dist/types/storage/entities/state.d.ts.map +1 -0
- package/dist/types/storage/errors.d.ts +9 -0
- package/dist/types/storage/errors.d.ts.map +1 -0
- package/dist/types/storage/filters/index.d.ts +2 -0
- package/dist/types/storage/filters/index.d.ts.map +1 -0
- package/dist/types/storage/filters/jsonQuery.d.ts +83 -0
- package/dist/types/storage/filters/jsonQuery.d.ts.map +1 -0
- package/dist/types/storage/fs/circuits-storage.d.ts +64 -0
- package/dist/types/storage/fs/circuits-storage.d.ts.map +1 -0
- package/dist/types/storage/fs/index.d.ts +2 -0
- package/dist/types/storage/fs/index.d.ts.map +1 -0
- package/dist/types/storage/index.d.ts +10 -0
- package/dist/types/storage/index.d.ts.map +1 -0
- package/dist/types/storage/indexed-db/data-source.d.ts +44 -0
- package/dist/types/storage/indexed-db/data-source.d.ts.map +1 -0
- package/dist/types/storage/indexed-db/index.d.ts +3 -0
- package/dist/types/storage/indexed-db/index.d.ts.map +1 -0
- package/dist/types/storage/indexed-db/merkletree.d.ts +43 -0
- package/dist/types/storage/indexed-db/merkletree.d.ts.map +1 -0
- package/dist/types/storage/interfaces/circuits.d.ts +26 -0
- package/dist/types/storage/interfaces/circuits.d.ts.map +1 -0
- package/dist/types/storage/interfaces/credentials.d.ts +53 -0
- package/dist/types/storage/interfaces/credentials.d.ts.map +1 -0
- package/dist/types/storage/interfaces/data-source.d.ts +39 -0
- package/dist/types/storage/interfaces/data-source.d.ts.map +1 -0
- package/dist/types/storage/interfaces/data-storage.d.ts +17 -0
- package/dist/types/storage/interfaces/data-storage.d.ts.map +1 -0
- package/dist/types/storage/interfaces/identity.d.ts +70 -0
- package/dist/types/storage/interfaces/identity.d.ts.map +1 -0
- package/dist/types/storage/interfaces/index.d.ts +11 -0
- package/dist/types/storage/interfaces/index.d.ts.map +1 -0
- package/dist/types/storage/interfaces/merkletree.d.ts +44 -0
- package/dist/types/storage/interfaces/merkletree.d.ts.map +1 -0
- package/dist/types/storage/interfaces/onchain-issuer.d.ts +13 -0
- package/dist/types/storage/interfaces/onchain-issuer.d.ts.map +1 -0
- package/dist/types/storage/interfaces/onchain-revocation.d.ts +19 -0
- package/dist/types/storage/interfaces/onchain-revocation.d.ts.map +1 -0
- package/dist/types/storage/interfaces/onchain-zkp-verifier.d.ts +63 -0
- package/dist/types/storage/interfaces/onchain-zkp-verifier.d.ts.map +1 -0
- package/dist/types/storage/interfaces/state.d.ts +74 -0
- package/dist/types/storage/interfaces/state.d.ts.map +1 -0
- package/dist/types/storage/local-storage/data-source.d.ts +41 -0
- package/dist/types/storage/local-storage/data-source.d.ts.map +1 -0
- package/dist/types/storage/local-storage/index.d.ts +3 -0
- package/dist/types/storage/local-storage/index.d.ts.map +1 -0
- package/dist/types/storage/local-storage/merkletree.d.ts +41 -0
- package/dist/types/storage/local-storage/merkletree.d.ts.map +1 -0
- package/dist/types/storage/memory/cache-lru.d.ts +11 -0
- package/dist/types/storage/memory/cache-lru.d.ts.map +1 -0
- package/dist/types/storage/memory/data-source.d.ts +20 -0
- package/dist/types/storage/memory/data-source.d.ts.map +1 -0
- package/dist/types/storage/memory/index.d.ts +4 -0
- package/dist/types/storage/memory/index.d.ts.map +1 -0
- package/dist/types/storage/memory/merkletree.d.ts +48 -0
- package/dist/types/storage/memory/merkletree.d.ts.map +1 -0
- package/dist/types/storage/shared/circuit-storage.d.ts +39 -0
- package/dist/types/storage/shared/circuit-storage.d.ts.map +1 -0
- package/dist/types/storage/shared/credential-storage.d.ts +39 -0
- package/dist/types/storage/shared/credential-storage.d.ts.map +1 -0
- package/dist/types/storage/shared/identity-storage.d.ts +45 -0
- package/dist/types/storage/shared/identity-storage.d.ts.map +1 -0
- package/dist/types/storage/shared/index.d.ts +4 -0
- package/dist/types/storage/shared/index.d.ts.map +1 -0
- package/dist/types/storage/utils.d.ts +4 -0
- package/dist/types/storage/utils.d.ts.map +1 -0
- package/dist/types/utils/compare-func.d.ts +2 -0
- package/dist/types/utils/compare-func.d.ts.map +1 -0
- package/dist/types/utils/did-helper.d.ts +38 -0
- package/dist/types/utils/did-helper.d.ts.map +1 -0
- package/dist/types/utils/encoding.d.ts +25 -0
- package/dist/types/utils/encoding.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +8 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/message-bus.d.ts +63 -0
- package/dist/types/utils/message-bus.d.ts.map +1 -0
- package/dist/types/utils/object.d.ts +10 -0
- package/dist/types/utils/object.d.ts.map +1 -0
- package/dist/types/utils/payments/evm.d.ts +19 -0
- package/dist/types/utils/payments/evm.d.ts.map +1 -0
- package/dist/types/utils/payments/solana.d.ts +88 -0
- package/dist/types/utils/payments/solana.d.ts.map +1 -0
- package/dist/types/verifiable/constants.d.ts +188 -0
- package/dist/types/verifiable/constants.d.ts.map +1 -0
- package/dist/types/verifiable/core-utils.d.ts +87 -0
- package/dist/types/verifiable/core-utils.d.ts.map +1 -0
- package/dist/types/verifiable/credential.d.ts +150 -0
- package/dist/types/verifiable/credential.d.ts.map +1 -0
- package/dist/types/verifiable/index.d.ts +7 -0
- package/dist/types/verifiable/index.d.ts.map +1 -0
- package/dist/types/verifiable/presentation.d.ts +11 -0
- package/dist/types/verifiable/presentation.d.ts.map +1 -0
- package/dist/types/verifiable/proof.d.ts +211 -0
- package/dist/types/verifiable/proof.d.ts.map +1 -0
- package/dist/types/verifiable/schema.d.ts +3 -0
- package/dist/types/verifiable/schema.d.ts.map +1 -0
- package/package.json +104 -0
- package/src/blockchain/index.ts +1 -0
- package/src/blockchain/transaction-service.ts +121 -0
- package/src/circuits/atomic-query-mtp-v2-on-chain.ts +338 -0
- package/src/circuits/atomic-query-mtp-v2.ts +283 -0
- package/src/circuits/atomic-query-sig-v2-on-chain.ts +411 -0
- package/src/circuits/atomic-query-sig-v2.ts +340 -0
- package/src/circuits/atomic-query-v3-on-chain.ts +531 -0
- package/src/circuits/atomic-query-v3.ts +461 -0
- package/src/circuits/auth-v2.ts +159 -0
- package/src/circuits/common.ts +261 -0
- package/src/circuits/comparer.ts +227 -0
- package/src/circuits/index.ts +12 -0
- package/src/circuits/linked-multi-query.ts +180 -0
- package/src/circuits/models.ts +263 -0
- package/src/circuits/state-transition.ts +139 -0
- package/src/credentials/credential-wallet.ts +353 -0
- package/src/credentials/index.ts +11 -0
- package/src/credentials/models.ts +93 -0
- package/src/credentials/rhs.ts +176 -0
- package/src/credentials/status/agent-revocation.ts +69 -0
- package/src/credentials/status/credential-status-publisher.ts +143 -0
- package/src/credentials/status/did-resolver-revocation.ts +24 -0
- package/src/credentials/status/on-chain-revocation.ts +174 -0
- package/src/credentials/status/resolver.ts +81 -0
- package/src/credentials/status/reverse-sparse-merkle-tree.ts +366 -0
- package/src/credentials/status/sparse-merkle-tree.ts +50 -0
- package/src/credentials/utils.ts +36 -0
- package/src/iden3comm/constants.ts +119 -0
- package/src/iden3comm/errors.ts +14 -0
- package/src/iden3comm/handlers/auth.ts +520 -0
- package/src/iden3comm/handlers/common.ts +324 -0
- package/src/iden3comm/handlers/contract-request.ts +367 -0
- package/src/iden3comm/handlers/credential-proposal.ts +371 -0
- package/src/iden3comm/handlers/discovery-protocol.ts +277 -0
- package/src/iden3comm/handlers/fetch.ts +450 -0
- package/src/iden3comm/handlers/index.ts +11 -0
- package/src/iden3comm/handlers/message-handler.ts +165 -0
- package/src/iden3comm/handlers/payment.ts +698 -0
- package/src/iden3comm/handlers/problem-report.ts +41 -0
- package/src/iden3comm/handlers/refresh.ts +138 -0
- package/src/iden3comm/handlers/revocation-status.ts +228 -0
- package/src/iden3comm/index.ts +9 -0
- package/src/iden3comm/packageManager.ts +143 -0
- package/src/iden3comm/packers/index.ts +3 -0
- package/src/iden3comm/packers/jws.ts +225 -0
- package/src/iden3comm/packers/plain.ts +86 -0
- package/src/iden3comm/packers/zkp.ts +243 -0
- package/src/iden3comm/types/index.ts +17 -0
- package/src/iden3comm/types/models.ts +7 -0
- package/src/iden3comm/types/packageManager.ts +112 -0
- package/src/iden3comm/types/packer.ts +190 -0
- package/src/iden3comm/types/protocol/accept-profile.ts +14 -0
- package/src/iden3comm/types/protocol/attachment.ts +12 -0
- package/src/iden3comm/types/protocol/auth.ts +104 -0
- package/src/iden3comm/types/protocol/common.ts +10 -0
- package/src/iden3comm/types/protocol/contract-request.ts +76 -0
- package/src/iden3comm/types/protocol/credentials.ts +96 -0
- package/src/iden3comm/types/protocol/discovery-protocol.ts +49 -0
- package/src/iden3comm/types/protocol/messages.ts +13 -0
- package/src/iden3comm/types/protocol/payment.ts +231 -0
- package/src/iden3comm/types/protocol/problem-report.ts +18 -0
- package/src/iden3comm/types/protocol/proof.ts +25 -0
- package/src/iden3comm/types/protocol/proposal-request.ts +38 -0
- package/src/iden3comm/types/protocol/revocation.ts +23 -0
- package/src/iden3comm/utils/accept-profile.ts +121 -0
- package/src/iden3comm/utils/did.ts +71 -0
- package/src/iden3comm/utils/envelope.ts +101 -0
- package/src/iden3comm/utils/index.ts +4 -0
- package/src/iden3comm/utils/message.ts +41 -0
- package/src/identity/common.ts +69 -0
- package/src/identity/identity-wallet.ts +1592 -0
- package/src/identity/index.ts +2 -0
- package/src/index.ts +16 -0
- package/src/kms/index.ts +4 -0
- package/src/kms/key-providers/bjj-provider.ts +118 -0
- package/src/kms/key-providers/ed25519-provider.ts +105 -0
- package/src/kms/key-providers/index.ts +3 -0
- package/src/kms/key-providers/secp256k1-provider.ts +125 -0
- package/src/kms/kms.ts +173 -0
- package/src/kms/provider-helpers.ts +13 -0
- package/src/kms/store/abstract-key-store.ts +34 -0
- package/src/kms/store/index.ts +5 -0
- package/src/kms/store/indexed-db-key-store.ts +60 -0
- package/src/kms/store/local-storage-key-store.ts +69 -0
- package/src/kms/store/memory-key-store.ts +29 -0
- package/src/kms/store/types.ts +21 -0
- package/src/proof/common.ts +273 -0
- package/src/proof/index.ts +4 -0
- package/src/proof/proof-service.ts +623 -0
- package/src/proof/provers/index.ts +3 -0
- package/src/proof/provers/inputs-generator.ts +627 -0
- package/src/proof/provers/prover.ts +104 -0
- package/src/proof/provers/witness_calculator.ts +315 -0
- package/src/proof/verifiers/index.ts +3 -0
- package/src/proof/verifiers/pub-signals-verifier.ts +730 -0
- package/src/proof/verifiers/query-hash.ts +57 -0
- package/src/proof/verifiers/query.ts +340 -0
- package/src/schema-processor/index.ts +3 -0
- package/src/schema-processor/json/index.ts +2 -0
- package/src/schema-processor/json/parser.ts +256 -0
- package/src/schema-processor/json/validator.ts +67 -0
- package/src/schema-processor/jsonld/cache.ts +49 -0
- package/src/schema-processor/jsonld/index.ts +2 -0
- package/src/schema-processor/jsonld/parser.ts +93 -0
- package/src/schema-processor/utils.ts +84 -0
- package/src/storage/blockchain/abi/CredentialStatusResolver.json +1 -0
- package/src/storage/blockchain/abi/ERC20.json +1 -0
- package/src/storage/blockchain/abi/ERC20Permit.json +1 -0
- package/src/storage/blockchain/abi/IdentityBase.json +1 -0
- package/src/storage/blockchain/abi/State.json +1 -0
- package/src/storage/blockchain/abi/ZkpVerifier.json +789 -0
- package/src/storage/blockchain/common.ts +20 -0
- package/src/storage/blockchain/did-resolver-readonly-storage.ts +90 -0
- package/src/storage/blockchain/erc20-helper.ts +66 -0
- package/src/storage/blockchain/errors.ts +46 -0
- package/src/storage/blockchain/index.ts +7 -0
- package/src/storage/blockchain/onchain-issuer-adapter/non-merklized/version/v0.0.1/onchain-non-merklized-issuer-adapter.ts +327 -0
- package/src/storage/blockchain/onchain-issuer.ts +104 -0
- package/src/storage/blockchain/onchain-revocation.ts +143 -0
- package/src/storage/blockchain/onchain-zkp-verifier.ts +704 -0
- package/src/storage/blockchain/state.ts +471 -0
- package/src/storage/entities/circuitData.ts +7 -0
- package/src/storage/entities/identity.ts +18 -0
- package/src/storage/entities/index.ts +4 -0
- package/src/storage/entities/mt.ts +25 -0
- package/src/storage/entities/state.ts +97 -0
- package/src/storage/errors.ts +8 -0
- package/src/storage/filters/index.ts +1 -0
- package/src/storage/filters/jsonQuery.ts +368 -0
- package/src/storage/fs/circuits-storage.ts +149 -0
- package/src/storage/fs/index.ts +1 -0
- package/src/storage/index.ts +9 -0
- package/src/storage/indexed-db/data-source.ts +58 -0
- package/src/storage/indexed-db/index.ts +2 -0
- package/src/storage/indexed-db/merkletree.ts +140 -0
- package/src/storage/interfaces/circuits.ts +27 -0
- package/src/storage/interfaces/credentials.ts +53 -0
- package/src/storage/interfaces/data-source.ts +41 -0
- package/src/storage/interfaces/data-storage.ts +17 -0
- package/src/storage/interfaces/identity.ts +73 -0
- package/src/storage/interfaces/index.ts +10 -0
- package/src/storage/interfaces/merkletree.ts +52 -0
- package/src/storage/interfaces/onchain-issuer.ts +13 -0
- package/src/storage/interfaces/onchain-revocation.ts +22 -0
- package/src/storage/interfaces/onchain-zkp-verifier.ts +94 -0
- package/src/storage/interfaces/state.ts +81 -0
- package/src/storage/local-storage/data-source.ts +87 -0
- package/src/storage/local-storage/index.ts +2 -0
- package/src/storage/local-storage/merkletree.ts +137 -0
- package/src/storage/memory/cache-lru.ts +30 -0
- package/src/storage/memory/data-source.ts +45 -0
- package/src/storage/memory/index.ts +3 -0
- package/src/storage/memory/merkletree.ts +116 -0
- package/src/storage/shared/circuit-storage.ts +49 -0
- package/src/storage/shared/credential-storage.ts +70 -0
- package/src/storage/shared/identity-storage.ts +82 -0
- package/src/storage/shared/index.ts +3 -0
- package/src/storage/utils.ts +19 -0
- package/src/utils/compare-func.ts +5 -0
- package/src/utils/did-helper.ts +157 -0
- package/src/utils/encoding.ts +47 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/message-bus.ts +88 -0
- package/src/utils/object.ts +52 -0
- package/src/utils/payments/evm.ts +152 -0
- package/src/utils/payments/solana.ts +360 -0
- package/src/verifiable/constants.ts +239 -0
- package/src/verifiable/core-utils.ts +307 -0
- package/src/verifiable/credential.ts +649 -0
- package/src/verifiable/index.ts +6 -0
- package/src/verifiable/presentation.ts +97 -0
- package/src/verifiable/proof.ts +277 -0
- package/src/verifiable/schema.ts +241 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { BJJSignatureProof2021, Iden3SparseMerkleTreeProof, CredentialStatus, RefreshService, DisplayMethod } from './proof';
|
|
2
|
+
import { Claim, DID } from '@mocanetwork/moca-iden3';
|
|
3
|
+
import { Proof } from '@iden3/js-merkletree';
|
|
4
|
+
import { Merklizer, Options } from '@iden3/js-jsonld-merklization';
|
|
5
|
+
import { CredentialRequest, CredentialStatusResolverRegistry } from '../credentials';
|
|
6
|
+
import { ProofType } from './constants';
|
|
7
|
+
import { CoreClaimCreationOptions } from './core-utils';
|
|
8
|
+
import { JsonDocumentObject } from '../iden3comm';
|
|
9
|
+
/**
|
|
10
|
+
* W3C Verifiable credential
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
* @export
|
|
14
|
+
* @class W3CCredential
|
|
15
|
+
*/
|
|
16
|
+
export declare class W3CCredential {
|
|
17
|
+
id: string;
|
|
18
|
+
'@context': string[];
|
|
19
|
+
type: string[];
|
|
20
|
+
expirationDate?: string;
|
|
21
|
+
refreshService?: RefreshService;
|
|
22
|
+
displayMethod?: DisplayMethod;
|
|
23
|
+
issuanceDate?: string;
|
|
24
|
+
credentialSubject: JsonDocumentObject;
|
|
25
|
+
credentialStatus: CredentialStatus;
|
|
26
|
+
issuer: string;
|
|
27
|
+
credentialSchema: CredentialSchema;
|
|
28
|
+
proof?: object | unknown[];
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param issuer - DID of the issuer
|
|
32
|
+
* @param request - Credential request
|
|
33
|
+
* @returns - W3C Credential
|
|
34
|
+
*/
|
|
35
|
+
static fromCredentialRequest(issuer: DID, request: CredentialRequest): W3CCredential;
|
|
36
|
+
/**
|
|
37
|
+
* Builds credential status
|
|
38
|
+
* @param {CredentialRequest} request
|
|
39
|
+
* @returns `CredentialStatus`
|
|
40
|
+
*/
|
|
41
|
+
private static buildCredentialStatus;
|
|
42
|
+
toJSON(): this & {
|
|
43
|
+
proof: any;
|
|
44
|
+
};
|
|
45
|
+
private proofToJSON;
|
|
46
|
+
private static proofFromJSON;
|
|
47
|
+
static fromJSON(obj: any): W3CCredential;
|
|
48
|
+
/**
|
|
49
|
+
* merklization of the verifiable credential
|
|
50
|
+
*
|
|
51
|
+
* @returns `Promise<Merklizer>`
|
|
52
|
+
*/
|
|
53
|
+
merklize(opts?: Options): Promise<Merklizer>;
|
|
54
|
+
/**
|
|
55
|
+
* gets core claim representation from credential proof
|
|
56
|
+
*
|
|
57
|
+
* @param {ProofType} proofType
|
|
58
|
+
* @returns {*} {(Claim | undefined)}
|
|
59
|
+
*/
|
|
60
|
+
getCoreClaimFromProof(proofType: ProofType): Claim | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* gets core claim representation from W3CCredential
|
|
63
|
+
*
|
|
64
|
+
* @param {CoreClaimParsingOptions} [opts] - options to create core claim
|
|
65
|
+
* @returns {*} {(Promise<Claim>)}
|
|
66
|
+
*/
|
|
67
|
+
toCoreClaim(opts?: CoreClaimCreationOptions): Promise<Claim>;
|
|
68
|
+
/**
|
|
69
|
+
* checks BJJSignatureProof2021 in W3C VC
|
|
70
|
+
*
|
|
71
|
+
* @returns BJJSignatureProof2021 | undefined
|
|
72
|
+
*/
|
|
73
|
+
getBJJSignature2021Proof(): BJJSignatureProof2021 | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* checks Iden3SparseMerkleTreeProof in W3C VC
|
|
76
|
+
*
|
|
77
|
+
* @returns {*} {(Iden3SparseMerkleTreeProof | undefined)}
|
|
78
|
+
*/
|
|
79
|
+
getIden3SparseMerkleTreeProof(): Iden3SparseMerkleTreeProof | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Verify credential proof
|
|
82
|
+
*
|
|
83
|
+
* @returns {*} {(boolean)}
|
|
84
|
+
*/
|
|
85
|
+
verifyProof(proofType: ProofType, resolverURL: string, opts?: W3CProofVerificationOptions): Promise<boolean>;
|
|
86
|
+
private verifyCoreClaimMatch;
|
|
87
|
+
private verifyBJJSignatureProof;
|
|
88
|
+
private verifyIden3SparseMerkleTreeProof;
|
|
89
|
+
private getProofByType;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* extracts core claim from Proof and returns Proof Type
|
|
93
|
+
*
|
|
94
|
+
* @param {object} proof - proof of vc
|
|
95
|
+
* @returns {*} {{ claim: Claim; proofType: ProofType }}
|
|
96
|
+
*/
|
|
97
|
+
export declare function extractProof(proof: object): {
|
|
98
|
+
claim: Claim;
|
|
99
|
+
proofType: ProofType;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* validate tree state by recalculating poseidon hash of roots and comparing with state
|
|
103
|
+
*
|
|
104
|
+
* @param {Issuer} treeState - issuer struct
|
|
105
|
+
* @returns {boolean}
|
|
106
|
+
*/
|
|
107
|
+
export declare function validateTreeState(treeState: Issuer): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Credential schema vc
|
|
110
|
+
*
|
|
111
|
+
* @public
|
|
112
|
+
* @interface CredentialSchema
|
|
113
|
+
*/
|
|
114
|
+
export interface CredentialSchema {
|
|
115
|
+
id: string;
|
|
116
|
+
type: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Issuer tree information
|
|
120
|
+
*
|
|
121
|
+
* @public
|
|
122
|
+
* @interface Issuer
|
|
123
|
+
*/
|
|
124
|
+
export interface Issuer {
|
|
125
|
+
state?: string;
|
|
126
|
+
rootOfRoots?: string;
|
|
127
|
+
claimsTreeRoot?: string;
|
|
128
|
+
revocationTreeRoot?: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
*
|
|
132
|
+
* RevocationStatus status of revocation nonce. Info required to check revocation state of claim in circuits
|
|
133
|
+
* @public
|
|
134
|
+
* @interface RevocationStatus
|
|
135
|
+
*/
|
|
136
|
+
export interface RevocationStatus {
|
|
137
|
+
mtp: Proof;
|
|
138
|
+
issuer: Issuer;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
*
|
|
142
|
+
* Proof verification options
|
|
143
|
+
* @public
|
|
144
|
+
* @interface W3CProofVerificationOptions
|
|
145
|
+
*/
|
|
146
|
+
export interface W3CProofVerificationOptions {
|
|
147
|
+
credStatusResolverRegistry?: CredentialStatusResolverRegistry;
|
|
148
|
+
merklizeOptions?: Options;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=credential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential.d.ts","sourceRoot":"","sources":["../../../src/verifiable/credential.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/verifiable/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Options, Path } from '@iden3/js-jsonld-merklization';
|
|
2
|
+
import { W3CCredential } from './credential';
|
|
3
|
+
import { QueryMetadata } from '../proof';
|
|
4
|
+
import { VerifiablePresentation, JsonDocumentObject } from '../iden3comm';
|
|
5
|
+
export declare const stringByPath: (obj: {
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}, path: string) => string;
|
|
8
|
+
export declare const buildFieldPath: (ldSchema: string, contextType: string, field: string, opts?: Options) => Promise<Path>;
|
|
9
|
+
export declare const findValue: (fieldName: string, credential: W3CCredential) => JsonDocumentObject;
|
|
10
|
+
export declare const createVerifiablePresentation: (context: string, tp: string, credential: W3CCredential, queries: QueryMetadata[]) => VerifiablePresentation;
|
|
11
|
+
//# sourceMappingURL=presentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../../src/verifiable/presentation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE1E,eAAO,MAAM,YAAY,GAAI,KAAK;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAAE,MAAM,MAAM,KAAG,MAe5E,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,UAAU,MAAM,EAChB,aAAa,MAAM,EACnB,OAAO,MAAM,EACb,OAAO,OAAO,KACb,OAAO,CAAC,IAAI,CAQd,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,WAAW,MAAM,EAAE,YAAY,aAAa,KAAG,kBAOxE,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACvC,SAAS,MAAM,EACf,IAAI,MAAM,EACV,YAAY,aAAa,EACzB,SAAS,aAAa,EAAE,KACvB,sBA4CF,CAAC"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { Hash, Proof } from '@iden3/js-merkletree';
|
|
2
|
+
import { ProofType, CredentialStatusType, RefreshServiceType, DisplayMethodType } from './constants';
|
|
3
|
+
import { TreeState } from '../circuits';
|
|
4
|
+
import { Signature } from '@iden3/js-crypto';
|
|
5
|
+
import { Claim, DID } from '@mocanetwork/moca-iden3';
|
|
6
|
+
import { JsonDocumentObject, JSONObject } from '../iden3comm';
|
|
7
|
+
/**
|
|
8
|
+
* Represents the published state of the issuer
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @interface State
|
|
12
|
+
*/
|
|
13
|
+
export interface State {
|
|
14
|
+
txId?: string;
|
|
15
|
+
blockTimestamp?: number;
|
|
16
|
+
blockNumber?: number;
|
|
17
|
+
rootOfRoots: Hash;
|
|
18
|
+
claimsTreeRoot: Hash;
|
|
19
|
+
revocationTreeRoot: Hash;
|
|
20
|
+
value: Hash;
|
|
21
|
+
status?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Iden3SparseMerkleProof is a iden3 protocol merkle tree proof
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
* @class Iden3SparseMerkleTreeProof
|
|
28
|
+
*/
|
|
29
|
+
export declare class Iden3SparseMerkleTreeProof {
|
|
30
|
+
type: ProofType;
|
|
31
|
+
issuerData: {
|
|
32
|
+
id: DID;
|
|
33
|
+
state: State;
|
|
34
|
+
};
|
|
35
|
+
mtp: Proof;
|
|
36
|
+
coreClaim: Claim;
|
|
37
|
+
/**
|
|
38
|
+
* Creates an instance of Iden3SparseMerkleTreeProof.
|
|
39
|
+
* @param {object} obj
|
|
40
|
+
*/
|
|
41
|
+
constructor(obj: {
|
|
42
|
+
issuerData: {
|
|
43
|
+
id: DID;
|
|
44
|
+
state: State;
|
|
45
|
+
};
|
|
46
|
+
mtp: Proof;
|
|
47
|
+
coreClaim: Claim;
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* @returns `json object in serialized presentation`
|
|
53
|
+
*/
|
|
54
|
+
toJSON(): {
|
|
55
|
+
issuerData: {
|
|
56
|
+
id: string;
|
|
57
|
+
state: {
|
|
58
|
+
rootOfRoots: string;
|
|
59
|
+
claimsTreeRoot: string;
|
|
60
|
+
revocationTreeRoot: string;
|
|
61
|
+
value: string;
|
|
62
|
+
txId?: string;
|
|
63
|
+
blockTimestamp?: number;
|
|
64
|
+
blockNumber?: number;
|
|
65
|
+
status?: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
type: ProofType;
|
|
69
|
+
coreClaim: string;
|
|
70
|
+
mtp: {
|
|
71
|
+
existence: boolean;
|
|
72
|
+
siblings: string[];
|
|
73
|
+
node_aux: {
|
|
74
|
+
key: string;
|
|
75
|
+
value: string;
|
|
76
|
+
} | undefined;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
static fromJSON(obj: any): Iden3SparseMerkleTreeProof;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* BJJSignatureProof2021 is a signature of core claim by BJJ key
|
|
84
|
+
* @public
|
|
85
|
+
* @class BJJSignatureProof2021
|
|
86
|
+
*/
|
|
87
|
+
export declare class BJJSignatureProof2021 {
|
|
88
|
+
type: ProofType;
|
|
89
|
+
issuerData: {
|
|
90
|
+
id: DID;
|
|
91
|
+
state: State;
|
|
92
|
+
authCoreClaim: Claim;
|
|
93
|
+
mtp: Proof;
|
|
94
|
+
credentialStatus: CredentialStatus;
|
|
95
|
+
};
|
|
96
|
+
signature: Signature;
|
|
97
|
+
coreClaim: Claim;
|
|
98
|
+
constructor(obj: {
|
|
99
|
+
issuerData: {
|
|
100
|
+
id: DID;
|
|
101
|
+
state: State;
|
|
102
|
+
authCoreClaim: Claim;
|
|
103
|
+
mtp: Proof;
|
|
104
|
+
credentialStatus: CredentialStatus;
|
|
105
|
+
};
|
|
106
|
+
coreClaim: Claim;
|
|
107
|
+
signature: Signature;
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* toJSON is a method to serialize BJJSignatureProof2021 to json
|
|
111
|
+
*
|
|
112
|
+
* @returns `json object in serialized presentation`
|
|
113
|
+
*/
|
|
114
|
+
toJSON(): {
|
|
115
|
+
issuerData: {
|
|
116
|
+
id: string;
|
|
117
|
+
state: {
|
|
118
|
+
rootOfRoots: string;
|
|
119
|
+
claimsTreeRoot: string;
|
|
120
|
+
revocationTreeRoot: string;
|
|
121
|
+
value: string;
|
|
122
|
+
txId?: string;
|
|
123
|
+
blockTimestamp?: number;
|
|
124
|
+
blockNumber?: number;
|
|
125
|
+
status?: string;
|
|
126
|
+
};
|
|
127
|
+
mtp: {
|
|
128
|
+
existence: boolean;
|
|
129
|
+
siblings: string[];
|
|
130
|
+
node_aux: {
|
|
131
|
+
key: string;
|
|
132
|
+
value: string;
|
|
133
|
+
} | undefined;
|
|
134
|
+
};
|
|
135
|
+
authCoreClaim: string;
|
|
136
|
+
credentialStatus: CredentialStatus;
|
|
137
|
+
};
|
|
138
|
+
type: ProofType;
|
|
139
|
+
coreClaim: string;
|
|
140
|
+
signature: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* fromJSON is a method to deserialize BJJSignatureProof2021 from json
|
|
144
|
+
* @param obj
|
|
145
|
+
*/
|
|
146
|
+
static fromJSON(obj: any): BJJSignatureProof2021;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Query represents structure for query to atomic circuit
|
|
150
|
+
*
|
|
151
|
+
* @public
|
|
152
|
+
* @interface ProofQuery
|
|
153
|
+
*/
|
|
154
|
+
export interface ProofQuery {
|
|
155
|
+
allowedIssuers?: string[];
|
|
156
|
+
credentialSubject?: JsonDocumentObject;
|
|
157
|
+
schema?: string;
|
|
158
|
+
claimId?: string;
|
|
159
|
+
credentialSubjectId?: string;
|
|
160
|
+
context?: string;
|
|
161
|
+
type?: string;
|
|
162
|
+
skipClaimRevocationCheck?: boolean;
|
|
163
|
+
proofType?: string;
|
|
164
|
+
groupId?: number;
|
|
165
|
+
params?: JSONObject;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Proof with MerkleTree info
|
|
169
|
+
*
|
|
170
|
+
* @public
|
|
171
|
+
* @interface MerkleTreeProofWithTreeState
|
|
172
|
+
*/
|
|
173
|
+
export interface MerkleTreeProofWithTreeState {
|
|
174
|
+
proof: Proof;
|
|
175
|
+
treeState: TreeState;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
*
|
|
179
|
+
* CredentialStatus contains type and revocation Url
|
|
180
|
+
* @public
|
|
181
|
+
* @interface CredentialStatus
|
|
182
|
+
*/
|
|
183
|
+
export interface CredentialStatus {
|
|
184
|
+
id: string;
|
|
185
|
+
type: CredentialStatusType;
|
|
186
|
+
revocationNonce?: number;
|
|
187
|
+
statusIssuer?: {
|
|
188
|
+
id: string;
|
|
189
|
+
type: CredentialStatusType;
|
|
190
|
+
revocationNonce?: number;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* RefreshService contains type and id
|
|
195
|
+
* @public
|
|
196
|
+
* @interface RefreshService
|
|
197
|
+
*/
|
|
198
|
+
export interface RefreshService {
|
|
199
|
+
id: string;
|
|
200
|
+
type: RefreshServiceType | string;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* DisplayMethod contains type and id
|
|
204
|
+
* @public
|
|
205
|
+
* @interface DisplayMethod
|
|
206
|
+
*/
|
|
207
|
+
export interface DisplayMethod {
|
|
208
|
+
id: string;
|
|
209
|
+
type: DisplayMethodType | string;
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=proof.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../../src/verifiable/proof.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** DIDDocumentJSONSchema is a basic schema of did document */
|
|
2
|
+
export declare const DIDDocumentJSONSchema = "{\n \"type\": \"object\",\n \"$defs\": {\n \"serviceEndpoint\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\"\n },\n \"serviceEndpoint\": {\n \"type\": \"string\"\n },\n \"metadata\": {\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"id\",\n \"type\",\n \"serviceEndpoint\"\n ]\n },\n \"jsonWebKey\": {\n \"type\": \"object\",\n \"properties\": {\n \"alg\": {\n \"type\": \"string\"\n },\n \"crv\": {\n \"type\": \"string\"\n },\n \"e\": {\n \"type\": \"string\"\n },\n \"ext\": {\n \"type\": \"boolean\"\n },\n \"key_ops\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"kid\": {\n \"type\": \"string\"\n },\n \"kty\": {\n \"type\": \"string\"\n },\n \"n\": {\n \"type\": \"string\"\n },\n \"use\": {\n \"type\": \"string\"\n },\n \"x\": {\n \"type\": \"string\"\n },\n \"y\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"kty\"\n ],\n \"description\": \"Public parts of JSON web key\"\n },\n \"verificationMethod\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\"\n },\n \"controller\": {\n \"type\": \"string\"\n },\n \"publicKeyBase58\": {\n \"type\": \"string\"\n },\n \"publicKeyBase64\": {\n \"type\": \"string\"\n },\n \"publicKeyJwk\": {\n \"$ref\": \"#/$defs/jsonWebKey\"\n },\n \"publicKeyHex\": {\n \"type\": \"string\"\n },\n \"publicKeyMultibase\": {\n \"type\": \"string\"\n },\n \"blockchainAccountId\": {\n \"type\": \"string\"\n },\n \"ethereumAddress\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"type\",\n \"controller\"\n ]\n }\n },\n \"properties\": {\n \"authentication\": {\n \"type\": \"array\",\n \"items\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"$ref\": \"#/$defs/verificationMethod\"\n }\n ]\n }\n },\n \"assertionMethod\": {\n \"type\": \"array\",\n \"items\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"$ref\": \"#/$defs/verificationMethod\"\n }\n ]\n }\n },\n \"keyAgreement\": {\n \"type\": \"array\",\n \"items\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"$ref\": \"#/$defs/verificationMethod\"\n }\n ]\n }\n },\n \"capabilityInvocation\": {\n \"type\": \"array\",\n \"items\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"$ref\": \"#/$defs/verificationMethod\"\n }\n ]\n }\n },\n \"capabilityDelegation\": {\n \"type\": \"array\",\n \"items\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"$ref\": \"#/$defs/verificationMethod\"\n }\n ]\n }\n },\n \"@context\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"const\": \"https://www.w3.org/ns/did/v1\"\n },\n {\n \"type\": \"string\"\n },\n {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"alsoKnownAs\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"controller\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n ]\n },\n \"verificationMethod\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/verificationMethod\"\n }\n },\n \"service\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/serviceEndpoint\"\n }\n },\n \"publicKey\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/verificationMethod\"\n },\n \"deprecated\": true\n }\n },\n \"required\": [\n \"id\"\n ]\n}";
|
|
3
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/verifiable/schema.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,i7JA+OhC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mocanetwork/privado-js-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SDK to work with Polygon ID",
|
|
5
|
+
"source": "./src/index.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"node": {
|
|
9
|
+
"import": "./dist/node/esm/index.js",
|
|
10
|
+
"require": "./dist/node/cjs/index.cjs"
|
|
11
|
+
},
|
|
12
|
+
"browser": "./dist/browser/esm/index.js",
|
|
13
|
+
"umd": "./dist/browser/umd/index.global.js",
|
|
14
|
+
"types": "./dist/types/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"types": "dist/types/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"src"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build:types": "tsc --declaration --emitDeclarationOnly",
|
|
26
|
+
"build": "npm run clean && tsup && npm run build:types",
|
|
27
|
+
"clean": "rimraf ./dist",
|
|
28
|
+
"test": "vitest run --bail=1",
|
|
29
|
+
"lint": "eslint --fix src tests",
|
|
30
|
+
"lint:check": "eslint src tests",
|
|
31
|
+
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
32
|
+
"format:check": "prettier \"src/**/*.ts\" \"tests/**/*.ts\" --check"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/mocaverse/privado-js-sdk#.git"
|
|
37
|
+
},
|
|
38
|
+
"author": "",
|
|
39
|
+
"license": "MIT or Apache-2.0",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/mocaverse/privado-js-sdk#/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/mocaverse/privado-js-sdk##readme",
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@cspell/eslint-plugin": "^8.19.4",
|
|
46
|
+
"@iden3/eslint-config": "https://github.com/iden3/eslint-config",
|
|
47
|
+
"@solana/spl-token": "^0.4.13",
|
|
48
|
+
"@typechain/ethers-v6": "^0.5.1",
|
|
49
|
+
"@types/jsonld": "^1.5.15",
|
|
50
|
+
"@types/node": "^24.0.4",
|
|
51
|
+
"@types/pubsub-js": "^1.8.6",
|
|
52
|
+
"@types/uuid": "^10.0.0",
|
|
53
|
+
"bs58": "^6.0.0",
|
|
54
|
+
"dotenv": "^17.0.1",
|
|
55
|
+
"nock": "^14.0.5",
|
|
56
|
+
"rimraf": "^6.0.1",
|
|
57
|
+
"ts-node": "^10.9.2",
|
|
58
|
+
"tsup": "^8.5.0",
|
|
59
|
+
"typescript": "^5.8.3",
|
|
60
|
+
"vitest": "^3.2.4"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@iden3/js-crypto": "^1.3.1",
|
|
64
|
+
"@iden3/js-jsonld-merklization": "1.7.1",
|
|
65
|
+
"@iden3/js-jwz": "^1.11.0",
|
|
66
|
+
"@iden3/js-merkletree": "^1.5.0",
|
|
67
|
+
"ffjavascript": "^0.3.1",
|
|
68
|
+
"rfc4648": "^1.5.4",
|
|
69
|
+
"snarkjs": "^0.7.5"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@iden3/onchain-non-merklized-issuer-base-abi": "^0.0.3",
|
|
73
|
+
"@iden3/universal-verifier-v2-abi": "^2.0.2",
|
|
74
|
+
"@mocanetwork/moca-iden3": "^1.0.3",
|
|
75
|
+
"@noble/curves": "^1.9.2",
|
|
76
|
+
"@solana/web3.js": "^1.98.4",
|
|
77
|
+
"ajv": "8.17.1",
|
|
78
|
+
"ajv-formats": "3.0.1",
|
|
79
|
+
"borsh": "^0.7.0",
|
|
80
|
+
"did-jwt": "8.0.4",
|
|
81
|
+
"did-resolver": "4.1.0",
|
|
82
|
+
"ethers": "^6.13.1",
|
|
83
|
+
"idb-keyval": "6.2.2",
|
|
84
|
+
"jsonld": "8.3.3",
|
|
85
|
+
"pubsub-js": "1.9.5",
|
|
86
|
+
"quick-lru": "^7.0.1",
|
|
87
|
+
"uuid": "11.1.0"
|
|
88
|
+
},
|
|
89
|
+
"browserslist": {
|
|
90
|
+
"production": [
|
|
91
|
+
">0.2%",
|
|
92
|
+
"not dead",
|
|
93
|
+
"not op_mini all"
|
|
94
|
+
],
|
|
95
|
+
"development": [
|
|
96
|
+
"last 1 chrome version",
|
|
97
|
+
"last 1 firefox version",
|
|
98
|
+
"last 1 safari version"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"engines": {
|
|
102
|
+
"node": ">=20.11.0"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './transaction-service';
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Block, JsonRpcProvider, Signer, TransactionReceipt, TransactionRequest } from 'ethers';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resend transaction options
|
|
5
|
+
* @type ResendTxnOptions
|
|
6
|
+
*/
|
|
7
|
+
export type ResendTxnOptions = {
|
|
8
|
+
increasedFeesPercentage?: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Interface for TransactionService
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export interface ITransactionService {
|
|
16
|
+
/**
|
|
17
|
+
* Returns transaction receipt and block by transaction hash
|
|
18
|
+
*
|
|
19
|
+
* @param {string} transactionHash - transaction hash.
|
|
20
|
+
* @returns `Promise<{receipt?: TransactionReceipt , block?: Block}>` - returns transaction receipt and block
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
getTransactionReceiptAndBlock(
|
|
24
|
+
transactionHash: string
|
|
25
|
+
): Promise<{ receipt?: TransactionReceipt; block?: Block }>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Send transaction.
|
|
29
|
+
*
|
|
30
|
+
* @param {Signer} signer - transaction signer.
|
|
31
|
+
* @param {TransactionRequest} request - transaction request.
|
|
32
|
+
* @returns `Promise<txnHash: string, txnReceipt: TransactionReceipt` - returns txn hash and txn receipt.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
sendTransactionRequest(
|
|
36
|
+
signer: Signer,
|
|
37
|
+
request: TransactionRequest
|
|
38
|
+
): Promise<{ txnHash: string; txnReceipt: TransactionReceipt }>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Resend transaction with options. Useful when `transaction underpriced` error thrown on transaction.
|
|
42
|
+
*
|
|
43
|
+
* @param {Signer} signer - transaction signer.
|
|
44
|
+
* @param {TransactionRequest} request - transaction request.
|
|
45
|
+
* @param {ResendTxnOptions} opts - resend transaction options.
|
|
46
|
+
* @returns `Promise<{ txnHash: string; txnReceipt: TransactionReceipt }>` -returns txn hash and txn receipt.
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
resendTransaction(
|
|
50
|
+
signer: Signer,
|
|
51
|
+
request: TransactionRequest,
|
|
52
|
+
opts?: ResendTxnOptions
|
|
53
|
+
): Promise<{ txnHash: string; txnReceipt: TransactionReceipt }>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Transaction service to provide interaction with blockchain transactions.
|
|
58
|
+
* allows to: get tx receipt by tx id, send and resend transaction with new fees.
|
|
59
|
+
* @class TransactionService
|
|
60
|
+
* @public
|
|
61
|
+
* @implements ITransactionService interface
|
|
62
|
+
*/
|
|
63
|
+
export class TransactionService implements ITransactionService {
|
|
64
|
+
/**
|
|
65
|
+
* Creates an instance of TransactionService.
|
|
66
|
+
* @param {JsonRpcProvider} - RPC provider
|
|
67
|
+
*/
|
|
68
|
+
constructor(private readonly _provider: JsonRpcProvider) {}
|
|
69
|
+
|
|
70
|
+
/** {@inheritDoc ITransactionService.getTransactionReceiptAndBlock} */
|
|
71
|
+
async getTransactionReceiptAndBlock(
|
|
72
|
+
txnHash: string
|
|
73
|
+
): Promise<{ receipt?: TransactionReceipt; block?: Block }> {
|
|
74
|
+
const receipt = await this._provider.getTransactionReceipt(txnHash);
|
|
75
|
+
const block = await receipt?.getBlock();
|
|
76
|
+
return { receipt: receipt || undefined, block };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** {@inheritDoc ITransactionService.sendTransactionRequest} */
|
|
80
|
+
async sendTransactionRequest(
|
|
81
|
+
signer: Signer,
|
|
82
|
+
request: TransactionRequest
|
|
83
|
+
): Promise<{ txnHash: string; txnReceipt: TransactionReceipt }> {
|
|
84
|
+
const tx = await signer.sendTransaction(request);
|
|
85
|
+
const txnReceipt = await tx.wait();
|
|
86
|
+
if (!txnReceipt) {
|
|
87
|
+
throw new Error(`transaction: ${tx.hash} failed to mined`);
|
|
88
|
+
}
|
|
89
|
+
const status: number | null = txnReceipt.status;
|
|
90
|
+
const txnHash: string = txnReceipt.hash;
|
|
91
|
+
|
|
92
|
+
if (!status) {
|
|
93
|
+
throw new Error(`transaction: ${txnHash} failed to mined`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return { txnHash, txnReceipt };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** {@inheritDoc ITransactionService.resendTransaction} */
|
|
100
|
+
async resendTransaction(
|
|
101
|
+
signer: Signer,
|
|
102
|
+
request: TransactionRequest,
|
|
103
|
+
opts?: ResendTxnOptions
|
|
104
|
+
): Promise<{ txnHash: string; txnReceipt: TransactionReceipt }> {
|
|
105
|
+
const feeData = await this._provider.getFeeData();
|
|
106
|
+
let { maxFeePerGas, maxPriorityFeePerGas, gasPrice } = feeData;
|
|
107
|
+
|
|
108
|
+
if (opts?.increasedFeesPercentage) {
|
|
109
|
+
const multiplyVal = BigInt((opts.increasedFeesPercentage + 100) / 100);
|
|
110
|
+
maxFeePerGas = maxFeePerGas ? maxFeePerGas * multiplyVal : null;
|
|
111
|
+
maxPriorityFeePerGas = maxPriorityFeePerGas ? maxPriorityFeePerGas * multiplyVal : null;
|
|
112
|
+
gasPrice = gasPrice ? gasPrice * multiplyVal : null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
request.maxFeePerGas = maxFeePerGas;
|
|
116
|
+
request.maxPriorityFeePerGas = maxPriorityFeePerGas;
|
|
117
|
+
request.gasPrice = gasPrice;
|
|
118
|
+
|
|
119
|
+
return this.sendTransactionRequest(signer, request);
|
|
120
|
+
}
|
|
121
|
+
}
|