@laceio/sdk 0.1.0 → 0.1.1-canary.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/dist/{Ed25519PublicKey-lvu1s54U.cjs → Address-AMKTo-dA.cjs} +17150 -61
- package/dist/{Ed25519PublicKey-CjnuAYRR.js → Address-_c_-9hLC.js} +16955 -264
- package/dist/{Bip32Account-r3KAhCgU.js → Bip32Account-CaW1zC9Y.js} +4 -5
- package/dist/{Bip32Account-Cz3h0ZUa.cjs → Bip32Account-DOaGmKpv.cjs} +4 -5
- package/dist/Cardano-B-gyqBBD.js +311 -0
- package/dist/Cardano-BQ_af0Y3.cjs +322 -0
- package/dist/Ed25519PublicKey-B3QcR0J2.cjs +88 -0
- package/dist/Ed25519PublicKey-DIE19xHg.js +83 -0
- package/dist/InMemoryKeyAgent-Bc_xZY-v.cjs +652 -0
- package/dist/InMemoryKeyAgent-D8T3vtXy.js +631 -0
- package/dist/{PaymentAddress-DhbtuYb7.cjs → PaymentAddress-B4n1KZMx.cjs} +1 -2
- package/dist/{PaymentAddress-xSmGUQ-8.js → PaymentAddress-Cml3EA1n.js} +1 -2
- package/dist/Percent-Cfuw5YyL.cjs +11 -0
- package/dist/Percent-DpvyJ_93.js +5 -0
- package/dist/SodiumBip32Ed25519-BaD-kjyx.cjs +380 -0
- package/dist/SodiumBip32Ed25519-DCikAMsl.js +363 -0
- package/dist/{TransactionBuilder-CeJTNzm-.cjs → TransactionBuilder-BakTJvsJ.cjs} +59 -89
- package/dist/{TransactionBuilder-DGNDM4kt.js → TransactionBuilder-D2ErwVWv.js} +5 -71
- package/dist/_md-6zV2Cme0.cjs +684 -0
- package/dist/_md-gbUqlhqd.js +399 -0
- package/dist/_web-crypto-random-bytes-BvzwTYPG.js +197 -0
- package/dist/acc-module-NL_8mEHH.cjs +27654 -0
- package/dist/acc-module-ur8CkBd1.js +27624 -0
- package/dist/account-call-B7cF8ly4.cjs +293 -0
- package/dist/account-call-BF4rBcNw.js +3 -0
- package/dist/account-call-CoCq3V55.js +252 -0
- package/dist/account-call-DFcD257E.cjs +4 -0
- package/dist/account-guards-BeKbV9D1.cjs +41 -0
- package/dist/account-guards-qnFXuXSE.js +36 -0
- package/dist/{activity-type.stable-ClO9j_PH.cjs → activity-type-BPXxdHBP.cjs} +2 -1
- package/dist/{activity-type.stable-Ml0SOYv9.js → activity-type-C1geyPsH.js} +2 -1
- package/dist/address-OxwXIwbF.js +15502 -0
- package/dist/address-book-address-validator-BqYM0Uyp.cjs +41 -0
- package/dist/{address-book-address-validator-BhqRfmlL.cjs → address-book-address-validator-CGIcqn5W.cjs} +5 -4
- package/dist/{address-book-address-validator-VqIOB8PY.js → address-book-address-validator-FkkYim3z.js} +6 -4
- package/dist/address-book-address-validator-RSx2Jozy.js +39 -0
- package/dist/address-lECYBd9-.cjs +13043 -0
- package/dist/{apply-vkey-witnesses-Ctzk7eye.cjs → apply-vkey-witnesses-1jyczTkw.cjs} +1 -1
- package/dist/{apply-vkey-witnesses-Dfo7XfhL.js → apply-vkey-witnesses-Byb40-yJ.js} +1 -1
- package/dist/artefact-loader-Cqc9eSkL.cjs +182 -0
- package/dist/artefact-loader-D0T2f6F7.js +159 -0
- package/dist/auto-dismiss-failure-on-success-BWJceNXd.cjs +37 -0
- package/dist/auto-dismiss-failure-on-success-Bpod-v4r.js +31 -0
- package/dist/bip32-EPpcFrpH.cjs +3851 -0
- package/dist/{bip32ed25519-D2In8WzR.cjs → bip32ed25519-CRiG-Kjg.cjs} +5 -4
- package/dist/{bip32ed25519-qsLH_eWO.js → bip32ed25519-E-fCUZNv.js} +6 -4
- package/dist/bip39-DZomfqeY.js +9 -0
- package/dist/bip39-MAck9iod.cjs +26 -0
- package/dist/bitcoin-data-provider-D0OT_Uiu.cjs +26 -0
- package/dist/bitcoin-data-provider-LN_8oamW.js +21 -0
- package/dist/bitcoin.cjs +48 -0
- package/dist/bitcoin.d.ts +29805 -1
- package/dist/bitcoin.js +22 -0
- package/dist/{blake2b-BGHUWMsV.js → blake2b-BL-eR5G2.js} +6 -4
- package/dist/{blake2b-DspUqw68.cjs → blake2b-Iy324FwH.cjs} +5 -4
- package/dist/{blockfrost-tx-submit-provider-BUEOmdvc.js → blockfrost-tx-submit-provider-BHDLgOIE.js} +9 -162
- package/dist/{blockfrost-tx-submit-provider-B5dWbdrZ.cjs → blockfrost-tx-submit-provider-BxC19smv.cjs} +7 -171
- package/dist/{blockingWithLatestFrom-BhaE7pnA.js → blockingWithLatestFrom-FUfZFEUG.js} +1 -1
- package/dist/{blockingWithLatestFrom-DkuT3G2a.cjs → blockingWithLatestFrom-bmCPgA3c.cjs} +1 -1
- package/dist/bn-BFq5a4dk.cjs +2553 -0
- package/dist/{SodiumBip32Ed25519-BEfo1Q9m.js → browser-D5jRKv_L.js} +4 -401
- package/dist/bytes.vo-CziaOsba.js +24 -0
- package/dist/bytes.vo-hecRu3YZ.cjs +35 -0
- package/dist/{cardano-network-id-to-network-type-PXvn1ycQ.cjs → cardano-network-id-to-network-type-BwG_d6QP.cjs} +1 -1
- package/dist/{cardano-network-id-to-network-type-DHgKhDAK.js → cardano-network-id-to-network-type-CYJheetp.js} +1 -1
- package/dist/{cardano-network-id.vo-CbNNKd-k.cjs → cardano-network-id.vo-C5VuBXT3.cjs} +2 -2
- package/dist/{cardano-network-id.vo-CTYe-Oix.js → cardano-network-id.vo-CeLJqmb_.js} +2 -2
- package/dist/{cardano-tx-id.vo-BMwemq5x.js → cardano-tx-id.vo-DJ70NC0-.js} +1 -1
- package/dist/{cardano-tx-id.vo-NY-gCOWJ.cjs → cardano-tx-id.vo-lnyO9XaW.cjs} +1 -1
- package/dist/cardano.cjs +31 -24
- package/dist/cardano.d.ts +27602 -8121
- package/dist/cardano.js +21 -13
- package/dist/client-Bw2foG5E.cjs +808 -0
- package/dist/const-BB3MccLt.js +153 -0
- package/dist/{const-BErUlcZw.cjs → const-BWBAzOmN.cjs} +1 -1
- package/dist/const-CSWmOyzn.cjs +42 -0
- package/dist/{const-Dy8Ctnpd.cjs → const-D3mCkwrM.cjs} +5 -5
- package/dist/const-DW7z3R5k.js +13 -0
- package/dist/{const-DeUA7zYl.js → const-DbuUHSzR.js} +5 -5
- package/dist/const-DgBzKfz6.cjs +31995 -0
- package/dist/{const-DVW6DGkZ.js → const-xGSNCtwQ.js} +1 -1
- package/dist/contract-BsIGhsYa.js +171 -0
- package/dist/contract-DD6CGnpB.cjs +189 -0
- package/dist/create-add-accounts-2mQA0ST2.js +102 -0
- package/dist/create-add-accounts-B6mR2NMn.cjs +114 -0
- package/dist/{delegation-tx-builder-CF0VunDW.cjs → delegation-tx-builder-Cp30jtj9.cjs} +9 -8
- package/dist/{delegation-tx-builder-C8LQxU2R.js → delegation-tx-builder-DUMikSTg.js} +9 -7
- package/dist/{deregistration-tx-builder-DcUXA3Ls.cjs → deregistration-tx-builder-B-ZeY-dR.cjs} +10 -9
- package/dist/{deregistration-tx-builder-BOBPP8m_.js → deregistration-tx-builder-CRLrK99U.js} +10 -8
- package/dist/device-commitment-hex.vo-BIUYUNz1.cjs +31 -0
- package/dist/device-commitment-hex.vo-D9FsYLn7.js +26 -0
- package/dist/device-key-BToCoS4D.js +2394 -0
- package/dist/device-key-D6euvxFi.cjs +2489 -0
- package/dist/device-readers-BHJeNR8I.js +3 -0
- package/dist/device-readers-Dw7uTNM5.cjs +167 -0
- package/dist/device-readers-b4g2j3QL.js +144 -0
- package/dist/device-readers-cxcJcWq5.cjs +7 -0
- package/dist/dist-B00GN41m.js +141 -0
- package/dist/dist-BA1xnF9O.cjs +4413 -0
- package/dist/dist-BmHOXLe8.cjs +3814 -0
- package/dist/dist-Br0OVXKt.cjs +535 -0
- package/dist/dist-C1JK9C1I.cjs +3452 -0
- package/dist/dist-DKEViNEI.cjs +1306 -0
- package/dist/dist-Dwqx184a.cjs +43175 -0
- package/dist/dist-MJof_Ky1.cjs +145 -0
- package/dist/dist-p84sVVJ9.cjs +1394 -0
- package/dist/{earn-rewards-tx-builder-BRlTueHS.js → earn-rewards-tx-builder-8G_rouIk.js} +9 -7
- package/dist/{earn-rewards-tx-builder-RgO0QUY8.cjs → earn-rewards-tx-builder-cOUNV58E.cjs} +9 -8
- package/dist/enc-key-circuits-0Dud78IB.js +13 -0
- package/dist/enc-key-circuits-yjPHbuo_.cjs +24 -0
- package/dist/english-BZ_ebp2-.cjs +2057 -0
- package/dist/envelopes-B3QCzo5p.js +2658 -0
- package/dist/envelopes-BdE1xlgz.cjs +2777 -0
- package/dist/errors-BA3b8aVu.cjs +584 -0
- package/dist/errors-pkQdxW-7.js +392 -0
- package/dist/experimental.cjs +6820 -0
- package/dist/experimental.d.ts +63552 -0
- package/dist/experimental.js +6670 -0
- package/dist/fees-6C2uEWFK.js +653 -0
- package/dist/fees-DtC71fOx.cjs +820 -0
- package/dist/gated-call-BrPjKolT.js +3 -0
- package/dist/gated-call-CcsuW9L5.js +691 -0
- package/dist/gated-call-DdDrxEq5.cjs +732 -0
- package/dist/gated-call-Dk7PazhG.cjs +4 -0
- package/dist/grant-rules-B7eDuD5G.cjs +5468 -0
- package/dist/grant-rules-qLrKUIR3.js +5217 -0
- package/dist/grant-status-CDmZpx32.js +296 -0
- package/dist/grant-status-CQtwjLsA.cjs +337 -0
- package/dist/grants-Bnb-3Hkv.cjs +16 -0
- package/dist/grants-CIb6nOV7.cjs +273 -0
- package/dist/grants-CYY0AquW.js +202 -0
- package/dist/grants-DOsFSotP.js +4 -0
- package/dist/{group-cardano-addresses-by-account-C-1GHUu8.cjs → group-cardano-addresses-by-account-BGOtPV-Y.cjs} +4 -40
- package/dist/{group-cardano-addresses-by-account-p4dXmCoj.js → group-cardano-addresses-by-account-TqvESg9x.js} +6 -37
- package/dist/{guarded-transaction-signer-DZSGHp1K.js → guarded-transaction-signer-BbVDE9Nn.js} +12 -18
- package/dist/{guarded-transaction-signer-BLSezbfV.cjs → guarded-transaction-signer-DTLjAkif.cjs} +26 -26
- package/dist/hex-BVtOKJki.cjs +263 -0
- package/dist/hex-CGYJPK_Z.js +192 -0
- package/dist/http-client-B7_kBTYn.js +155 -0
- package/dist/http-client-DYQ_7Rdf.cjs +167 -0
- package/dist/identity-DxPhxkZs.js +239 -0
- package/dist/identity-y41Yle03.cjs +274 -0
- package/dist/in-memory-wallet-integration-5BKiAvPT.js +20861 -0
- package/dist/{in-memory-wallet-integration-CUTa68ET.js → in-memory-wallet-integration-BCOqDgbt.js} +10 -107
- package/dist/in-memory-wallet-integration-Bi8I9Dso.js +128 -0
- package/dist/in-memory-wallet-integration-Bsl2ONua.cjs +239 -0
- package/dist/in-memory-wallet-integration-DZ0CAyvY.cjs +20865 -0
- package/dist/{in-memory-wallet-integration-Dw_S7amX.cjs → in-memory-wallet-integration-DsFm8gLk.cjs} +21 -112
- package/dist/{in-memory-wallet-integration-Z4Bp_DTv.cjs → in-memory-wallet-integration-aW_SF-go.cjs} +8 -5
- package/dist/{in-memory-wallet-integration-B6cbAlvD.js → in-memory-wallet-integration-mIEc8EfR.js} +9 -5
- package/dist/index.cjs +95 -58
- package/dist/index.d.ts +45152 -13448
- package/dist/index.js +55 -28
- package/dist/{init-CVi8J0zk.cjs → init-5SfWgCYD.cjs} +3 -3
- package/dist/{init-Ci7aqWCf2.cjs → init-8NVWbo302.cjs} +2 -2
- package/dist/init-B-C7n6u6.js +5 -0
- package/dist/{init-BFMWRf-L.js → init-B-ppfGO-.js} +1 -1
- package/dist/{init-IiR093Jw.cjs → init-B2OUhY5T.cjs} +2 -2
- package/dist/{init-DXnus199.cjs → init-B6Eg_o6G.cjs} +5 -5
- package/dist/{init-4hDl5bpr.js → init-BAWMHL1k.js} +2 -2
- package/dist/init-BC2CZZOu2.cjs +2002 -0
- package/dist/{init-a228hXnS.cjs → init-BF-a2p6E.cjs} +65 -73
- package/dist/{init-fFirX8OY.cjs → init-BFxlQAD8.cjs} +1 -1
- package/dist/init-BJE1ry0O.js +17 -0
- package/dist/{init-BVnI4z2J.js → init-BPKBVOHU.js} +2 -2
- package/dist/{init-bdqZBd-o.js → init-BSP_xcpB.js} +2 -2
- package/dist/{init-CFNOn3lo.js → init-BSd7mznK.js} +3 -3
- package/dist/{init-MjR4swi6.js → init-BUJTT0MN.js} +36 -43
- package/dist/init-BUpFzYsD.cjs +143 -0
- package/dist/{init-BvpYHyLH.cjs → init-BZ-WyAIL.cjs} +3 -3
- package/dist/init-BZdfdLX7.js +422 -0
- package/dist/{init-CJeOys1w.cjs → init-B_HWNXMD.cjs} +2 -2
- package/dist/init-BbIMt6xU.cjs +6 -0
- package/dist/{init-BYdN1aqE.cjs → init-BewG6swt.cjs} +2 -2
- package/dist/{init-BX0AZAVH2.js → init-Bilqsbng.js} +2 -2
- package/dist/{init-Tpn9VkFu.cjs → init-BpwlQ6wF.cjs} +1 -1
- package/dist/{init-D5-P0HXK.js → init-BtQOzUjX.js} +1 -1
- package/dist/{init-BvGz3qUd2.js → init-CCTscPaY2.js} +2 -2
- package/dist/{init-D4hPipCD.cjs → init-CH0yyBof.cjs} +1 -1
- package/dist/init-CaIkrXal.cjs +121 -0
- package/dist/init-CkZy4IMf.cjs +107 -0
- package/dist/{init-Drr2f_Pr.js → init-CmfcY7SV.js} +1 -1
- package/dist/{init-Kf3_OLv6.js → init-CnJAlks_.js} +1 -1
- package/dist/{init-Cdjt_z-b.cjs → init-CqqmtAIK.cjs} +4 -4
- package/dist/{init-Bb0avZeZ.js → init-Cu2znmIc.js} +5 -5
- package/dist/init-Cz5LAizN.js +2001 -0
- package/dist/init-D4WM3-Mn.cjs +18 -0
- package/dist/init-DMi2FGpf.cjs +424 -0
- package/dist/{init-lcaUSOOG.js → init-DPTJohPd.js} +1 -1
- package/dist/{init-BTYLMF9F2.cjs → init-DexLSprL2.cjs} +258 -61
- package/dist/init-DfKPgD21.js +106 -0
- package/dist/init-DgzRsI-C.js +141 -0
- package/dist/init-Dj4Cn7-P.js +4789 -0
- package/dist/init-DktAnYI0.cjs +2354 -0
- package/dist/{init-DFwhgert.cjs → init-DmyuM9Lo.cjs} +1 -1
- package/dist/{init-CX_zLXc6.js → init-IBnizp1U.js} +5 -5
- package/dist/init-MDKB6tGI2.cjs +4790 -0
- package/dist/{init-DbZ5byj42.js → init-TbB38KNt2.js} +258 -60
- package/dist/init-X6m_cqDy.js +2353 -0
- package/dist/{init-DvVgKCaP2.cjs → init-bzvl1JhF.cjs} +2 -2
- package/dist/{init-BgrY29gW.js → init-dsYkC_0B.js} +4 -4
- package/dist/{init-B5BsI3DR.cjs → init-kvn5FlPS.cjs} +7 -7
- package/dist/init-vfy9DW_E.js +119 -0
- package/dist/{init-BE_6Jyc4.js → init-w7xl6LsP.js} +3 -3
- package/dist/{init-DEsWVyn5.cjs → init-wgiBUmyW.cjs} +1 -1
- package/dist/{is-retriable-error-DWv_ob-f.js → is-retriable-error-CmFR20pe.js} +1 -1
- package/dist/{is-retriable-error-Dtb4JGjd.cjs → is-retriable-error-D2yo0_lS.cjs} +1 -1
- package/dist/jubjub-authoriser-A2c8vmkN.js +84 -0
- package/dist/jubjub-authoriser-D3ZDgzcF.cjs +85 -0
- package/dist/key-source-CcLTx8HK.js +2761 -0
- package/dist/key-source-D2tTAag-.cjs +806 -0
- package/dist/{key-value-store-DTX1quRS.js → key-value-store-DZcNDB3n.js} +1 -1
- package/dist/{key-value-store-B-XRIwaM.cjs → key-value-store-Htj4RgMe.cjs} +1 -1
- package/dist/keyDerivation-DcKRUCVh.cjs +274 -0
- package/dist/keyDerivation-QGesIMbS.js +4077 -0
- package/dist/{lace-context-FpU3iG3f.cjs → lace-context-BN0b_ury.cjs} +4 -4
- package/dist/{lace-context-BQvvxVLm.js → lace-context-DMRJ87Vg.js} +4 -4
- package/dist/lib-BC-62Byh.cjs +2359 -0
- package/dist/lib-JYqcAX0c.js +2354 -0
- package/dist/midnight-account-id.vo--Vcx34Xk.cjs +10 -0
- package/dist/midnight-account-id.vo-BuB8fiVO.js +5 -0
- package/dist/midnight-engine-B7D2hbHo.js +5 -0
- package/dist/midnight-engine-D5ikN_5F.cjs +6 -0
- package/dist/midnight-wallet-BOdFD6SX.cjs +24 -0
- package/dist/midnight-wallet-CAqZrNVe.js +18 -0
- package/dist/midnight.cjs +1412 -0
- package/dist/midnight.d.ts +28609 -0
- package/dist/midnight.js +1355 -0
- package/dist/modules-cardano-BiL9hoM3.js +996 -0
- package/dist/modules-cardano-UeXks3sd.cjs +1109 -0
- package/dist/node-relay-BOuvdZvC.cjs +49 -0
- package/dist/node-relay-CLtc5n1v.js +48 -0
- package/dist/outputs-5qdW8s-f.js +196 -0
- package/dist/outputs-BEM1GPMf.cjs +339 -0
- package/dist/{SodiumBip32Ed25519-BQUcrQWX.cjs → pbkdf2-B1veireP.cjs} +6 -411
- package/dist/pending-operation-CfTUNQVD.cjs +26 -0
- package/dist/pending-operation-Ljijb1Uh.js +21 -0
- package/dist/providers-1on_fwJO.cjs +364 -0
- package/dist/providers-C1MsxfMA.js +341 -0
- package/dist/redacted-4SJPqt-G.js +81 -0
- package/dist/redacted-DwxIDdIF.cjs +86 -0
- package/dist/{reselect-DPML1uFN.cjs → reselect-kP4DaAII.cjs} +1 -1
- package/dist/{retry-config-oNtfdyrG.cjs → retry-config-BGv5q5QM.cjs} +1 -1
- package/dist/{retry-config-VdbuqBsI.js → retry-config-Bu5Yn5ua.js} +1 -1
- package/dist/safe-buffer-CqGpSFCQ.js +43 -0
- package/dist/safe-buffer-DbXbwhUQ.cjs +48 -0
- package/dist/sdk-1SRu8Ype.cjs +1445 -0
- package/dist/sdk-BneJm7ey.js +1249 -0
- package/dist/sdk-init-9TG1ZvHF.cjs +3795 -0
- package/dist/sdk-init-Ce3mD-8F.js +1047 -0
- package/dist/secret-box-CSmRp6Tt.js +3777 -0
- package/dist/secret-box-ZfbYwBgS.cjs +6970 -0
- package/dist/send-proof-progress-DtAcrMP6.cjs +33 -0
- package/dist/send-proof-progress-Dx2cUz1B.js +22 -0
- package/dist/sha2-DaRJZOjk.cjs +390 -0
- package/dist/sha2-c4sB6peD.js +378 -0
- package/dist/side-effects-C3BhLrdP.js +768 -0
- package/dist/side-effects-DG0R-KFc.cjs +804 -0
- package/dist/sign-bitcoin-transaction-with-seed-C7vq9om8.js +147 -0
- package/dist/sign-bitcoin-transaction-with-seed-Ds1dwzan.cjs +158 -0
- package/dist/signer--2I6poMD.js +2 -0
- package/dist/signer-CX21Ups_.cjs +121 -0
- package/dist/signer-Cnn9q9oY.js +92 -0
- package/dist/signer-DbSxjk0F.cjs +7 -0
- package/dist/signer-factory-B5oFuUZ-.cjs +130 -0
- package/dist/signer-factory-BAt8FPNc.cjs +281 -0
- package/dist/signer-factory-BGE4nL4k.js +129 -0
- package/dist/signer-factory-C4pgsiJi.js +281 -0
- package/dist/{signer-factory-DySc1wRX.cjs → signer-factory-D95jQIPV.cjs} +9 -6
- package/dist/{signer-factory-D4HrwFPl.js → signer-factory-PrpsGX-8.js} +10 -6
- package/dist/{slice-BZTQgYSs.js → slice-B-xJcuT1.js} +4 -4
- package/dist/slice-B4QOYaOG.cjs +105 -0
- package/dist/{slice-CtIMw2YT.cjs → slice-B9QKuhi0.cjs} +3 -3
- package/dist/slice-BKnGkAkd.cjs +9031 -0
- package/dist/{slice-Bhwmqn1p.cjs → slice-Bf4enJKZ.cjs} +8 -8
- package/dist/{slice-DaNVz7_l.js → slice-ByNWnxKS.js} +8 -8
- package/dist/{slice-C2UDQrdt.js → slice-C1zOeseG.js} +449 -355
- package/dist/{slice-DFLyKRm5.cjs → slice-C4toRM6A.cjs} +2 -2
- package/dist/{slice-Cx4dULDA.cjs → slice-C8YVv4Qn.cjs} +1 -1
- package/dist/{slice-jnpOgiSZ.cjs → slice-CaMfviYu.cjs} +3 -3
- package/dist/{slice-DFvrwUur.js → slice-CgeRsYRg.js} +6 -6
- package/dist/slice-Cwt8jShq.js +9013 -0
- package/dist/{slice-zNEspZND.js → slice-D0VzpMbY.js} +2 -2
- package/dist/slice-D14F78Ca.js +87 -0
- package/dist/{slice-F6A1YKOF.cjs → slice-DLflttAu.cjs} +479 -366
- package/dist/{slice-C96EdeY1.js → slice-DcO-iNz2.js} +1 -1
- package/dist/{slice-C19quNWM.cjs → slice-DimtxfAT.cjs} +2 -2
- package/dist/{slice-KiNoGwD9.js → slice-DlTEqIoI.js} +1 -1
- package/dist/{slice-ws8PccRX.js → slice-Dn0WojD7.js} +3 -3
- package/dist/{slice-BLSxLmie.cjs → slice-Dongunf7.cjs} +4 -4
- package/dist/{slice-B6vPum19.js → slice-DpufJAjJ.js} +2 -2
- package/dist/{slice-exhhmucR.cjs → slice-DtitVc9L.cjs} +7 -7
- package/dist/{slice-Bjj2t2ut.cjs → slice-WMMMc1Xv.cjs} +2 -2
- package/dist/slice-a8VuIqzS.cjs +378 -0
- package/dist/slice-bRASyM-m.js +354 -0
- package/dist/{slice-CBFrgHSH.js → slice-hNyKbDry.js} +3 -3
- package/dist/{InMemoryKeyAgent-pyB2gA-N.cjs → src-BayYMIjw.cjs} +20 -8228
- package/dist/{InMemoryKeyAgent-D-3HejxN.js → src-CgINPlSx.js} +29 -4811
- package/dist/store-AUlTfcI_.js +37 -0
- package/dist/store-C7AneHEY.cjs +66 -0
- package/dist/submit-BuBCVi-l.cjs +87 -0
- package/dist/submit-D37lxFrK.js +70 -0
- package/dist/submit-bitcoin-tx-DFLnhidO.js +983 -0
- package/dist/submit-bitcoin-tx-sih2hSfb.cjs +1049 -0
- package/dist/{subtractValueQuantities-DfZg6oiG.js → subtractValueQuantities-BuDJVxq6.js} +3 -22
- package/dist/{subtractValueQuantities-C8qDTtgH.cjs → subtractValueQuantities-CqR606HV.cjs} +2 -32
- package/dist/{sync-operation-utils-BrQyWFS_.cjs → sync-operation-utils--Z_IQfyW.cjs} +0 -66
- package/dist/{sync-operation-utils-CAaCGvEN.js → sync-operation-utils-BimBpvI3.js} +1 -37
- package/dist/token-color.vo-CItgoOjw.js +26 -0
- package/dist/token-color.vo-Ca4hUXfh.cjs +37 -0
- package/dist/token-id-mapper-BVau2RXa.js +16 -0
- package/dist/token-id-mapper-CSeLzM4o.cjs +18 -0
- package/dist/{token-id-mapper-pDaTxpw2.js → token-id-mapper-ClBeIdJR.js} +2 -2
- package/dist/{token-id-mapper-DYcd8hhQ.cjs → token-id-mapper-D0wFdbOy.cjs} +2 -2
- package/dist/types-BhzypKMS.cjs +15 -0
- package/dist/types-DTE1ctDB.js +10 -0
- package/dist/types-DXSxXGz0.js +12 -0
- package/dist/types-Dls6Z5gV.cjs +23 -0
- package/dist/{util-P4PX2muj.cjs → util-D1YlKzrc.cjs} +2 -2
- package/dist/{util-CQSJU0wT.js → util-DHxtzUzY.js} +2 -2
- package/dist/{utils-Bv4OHT4S.cjs → utils-DYf4iZKX.cjs} +7 -1
- package/dist/{utils-DrtzChYN.js → utils-DcnoETEP.js} +2 -2
- package/dist/utils-Du0YXRcU.cjs +112 -0
- package/dist/utils-fF_rnZe3.js +65 -0
- package/dist/v8Signatures-ClGpA8mS.cjs +71 -0
- package/dist/{vote-delegation-tx-builder-69gOEkCB.cjs → vote-delegation-tx-builder-BjZxCOd3.cjs} +9 -8
- package/dist/{vote-delegation-tx-builder-BRJ_pf-c.js → vote-delegation-tx-builder-DRJwPXkD.js} +9 -7
- package/dist/watch-FGE4B_Ge.js +13056 -0
- package/dist/watch-imlsRZDp.cjs +52207 -0
- package/package.json +95 -3
- package/dist/Address-4KjeDt_x.cjs +0 -17269
- package/dist/Address-_VPkf7Xh.js +0 -17101
- package/dist/account-guards.stable-BKyYPj4z.cjs +0 -10
- package/dist/account-guards.stable-BdmQ43vC.js +0 -5
- package/dist/init-BR9ZIbED.cjs +0 -378
- package/dist/init-B_k1RUN_.cjs +0 -21
- package/dist/init-Bs3b5ZQH.js +0 -378
- package/dist/init-ChfcrHgG2.cjs +0 -4354
- package/dist/init-D1uUMMpG.js +0 -19
- package/dist/init-DV1OSZiK.js +0 -4352
- package/dist/modules-cardano-BINzpXpk.js +0 -5454
- package/dist/modules-cardano-Dt8OwoQb.cjs +0 -5640
- package/dist/slice-Caf98m0d2.js +0 -107
- package/dist/slice-PM6llajQ2.cjs +0 -125
- /package/dist/{BigIntMath-CoJWXt1h.cjs → BigIntMath-CBciEQn2.cjs} +0 -0
- /package/dist/{BigIntMath-BWUJOsOW.js → BigIntMath-X3EniYDo.js} +0 -0
- /package/dist/{ChainId-sdLmlIRk.cjs → ChainId-CNPSU9nn.cjs} +0 -0
- /package/dist/{ChainId-CKbm87yQ.js → ChainId-CeoG8Sov.js} +0 -0
- /package/dist/{_polyfill-node.process-4fnlkbBi.cjs → _polyfill-node.process-5UxyjoHG.cjs} +0 -0
- /package/dist/{account-id.vo-Xpgnu-av.cjs → account-id.vo-DYZBZQsz.cjs} +0 -0
- /package/dist/{account-id.vo-DP0BtOoF.js → account-id.vo-KDTWJ-W5.js} +0 -0
- /package/dist/{actions-BNagEO6m.cjs → actions-BnHFVSr_.cjs} +0 -0
- /package/dist/{actions-BWTyAr7B.js → actions-Cwj0ApZf.js} +0 -0
- /package/dist/{asyncoption-po7-RiA5.cjs → asyncoption-CYcZNBRM.cjs} +0 -0
- /package/dist/{asyncoption-CzIVH5Y1.js → asyncoption-DZQGfznq.js} +0 -0
- /package/dist/{bignum.vo-DhhZ9HP1.js → bignum.vo-Co6tMH2q.js} +0 -0
- /package/dist/{bignum.vo-CpkrIXjH.cjs → bignum.vo-Du-bpvar.cjs} +0 -0
- /package/dist/{blockchain-network-id.vo-CbgrAY_K.js → blockchain-network-id.vo-C6Jowh8t.js} +0 -0
- /package/dist/{blockchain-network-id.vo-5iC6Kffo.cjs → blockchain-network-id.vo-DEQ14dYj.cjs} +0 -0
- /package/dist/{composite-signer-factory-DABpCe1_.js → composite-signer-factory-D9RWY-1V.js} +0 -0
- /package/dist/{composite-signer-factory-BizuNPP7.cjs → composite-signer-factory-v4Pxn8bA.cjs} +0 -0
- /package/dist/{error-ggOihIfv.cjs → error-B6wj9nPv.cjs} +0 -0
- /package/dist/{error-DHKO2iS4.js → error-CvEYL98P.js} +0 -0
- /package/dist/{esm-browser-DnXNvpcn.cjs → esm-browser-CZbMeVod.cjs} +0 -0
- /package/dist/{esm-browser-BBVQuyQv.js → esm-browser-DpAD_RKv.js} +0 -0
- /package/dist/{feature-flag-key.vo-DoGK5Bfh.js → feature-flag-key.vo-9reURsOQ.js} +0 -0
- /package/dist/{feature-flag-key.vo-CP1Z9s8e.cjs → feature-flag-key.vo-KTIdnzYX.cjs} +0 -0
- /package/dist/{first-state-of-status-Bx4-QQ5m.cjs → first-state-of-status-9ICeDNSa.cjs} +0 -0
- /package/dist/{first-state-of-status-D7XzEuSa.js → first-state-of-status-BscbKj_t.js} +0 -0
- /package/dist/{init-4319psUJ.cjs → init-BT67pd9x.cjs} +0 -0
- /package/dist/{init-AFUM1TSg.js → init-CHk1fvJ2.js} +0 -0
- /package/dist/{init-ZX90nEJe2.js → init-DIyNx6DZ.js} +0 -0
- /package/dist/{init-CTQ2g6Xt.js → init-DtxxFaCx.js} +0 -0
- /package/dist/{init-Dt1Xifg_2.cjs → init-J8QobR93.cjs} +0 -0
- /package/dist/{init-BNewLCqw.cjs → init-xzZPlQwB.cjs} +0 -0
- /package/dist/{is-redux-persist-state-DxJSsvxB.cjs → is-redux-persist-state-C5luvPEH.cjs} +0 -0
- /package/dist/{is-redux-persist-state-Bl2n4VMr.js → is-redux-persist-state-CjcqyCoh.js} +0 -0
- /package/dist/{isNotNil-CZxBMfL5.js → isNotNil-Be7gCY0m.js} +0 -0
- /package/dist/{isNotNil-C_SO1tcC.cjs → isNotNil-CrYIUFry.cjs} +0 -0
- /package/dist/{logging-BvMDKgl0.js → logging-BAMMfn5j.js} +0 -0
- /package/dist/{logging-Bh9ikph3.cjs → logging-CbxgIX9V.cjs} +0 -0
- /package/dist/{metadatum-B-sxBnSY.cjs → metadatum-BGvFqGPt.cjs} +0 -0
- /package/dist/{metadatum-Ego4jVas.js → metadatum-BVocMYy_.js} +0 -0
- /package/dist/{repo-slice-BzZQUTj8.cjs → repo-slice-BB_W-6OL.cjs} +0 -0
- /package/dist/{repo-slice-vCcQJotS.js → repo-slice-BQlssw9M.js} +0 -0
- /package/dist/{reselect-BPkMzw3k.js → reselect-JIgawvPe.js} +0 -0
- /package/dist/{serializable-BxFUShKY.js → serializable-F7OtYl8d.js} +0 -0
- /package/dist/{serializable-DWgkHhv_.cjs → serializable-n3UoxbZc.cjs} +0 -0
- /package/dist/{slice-DY-DNtSi.js → slice-5dGBAz6w.js} +0 -0
- /package/dist/{slice-BEFoeqgr.cjs → slice-BzJgg9FS.cjs} +0 -0
- /package/dist/{src-CPmX4KUh.cjs → src-CeBNkonz.cjs} +0 -0
- /package/dist/{src-XOZXPKxe.js → src-Cv1ifqbe.js} +0 -0
- /package/dist/{time-CQPt4FdU.js → time-ByoKevdZ.js} +0 -0
- /package/dist/{time-Blvoyh9G.cjs → time-qD7edGU0.cjs} +0 -0
- /package/dist/{time.vo-Xln4yGBU.js → time.vo-C17-tYq3.js} +0 -0
- /package/dist/{time.vo-rwWwJzmP.cjs → time.vo-TmYE-_Y2.cjs} +0 -0
- /package/dist/{toEmpty-CzmoZVLN.cjs → toEmpty-Db6V94Mf.cjs} +0 -0
- /package/dist/{toEmpty-DzLd-ZCi.js → toEmpty-Djj-QbpI.js} +0 -0
- /package/dist/{token-id.vo-l8fuSpem.cjs → token-id.vo-CZ622zcZ.cjs} +0 -0
- /package/dist/{token-id.vo-DMKSaMlc.js → token-id.vo-IDI9C_Qm.js} +0 -0
- /package/dist/{types-B61DQoFW.js → types-By-XeXWg.js} +0 -0
- /package/dist/{types-CUC-Kcqh.cjs → types-Cn6WlQV6.cjs} +0 -0
- /package/dist/{util-BV3iGOrz.cjs → util-Cp1h58uD.cjs} +0 -0
- /package/dist/{util-BsQKLorV.js → util-DHppXj7U.js} +0 -0
- /package/dist/{util-selector-CKIyoAOz.js → util-selector-BWmHpo92.js} +0 -0
- /package/dist/{util-selector-C9H5RsNw.cjs → util-selector-glXkO-jR.cjs} +0 -0
- /package/dist/{while-active-CNXeLxre.js → while-active-CDBnUlQA.js} +0 -0
- /package/dist/{while-active-BsDWSNrO.cjs → while-active-I2TlHtm7.cjs} +0 -0
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
import { n as import_buffer, r as init__polyfill_buffer_patch } from "./_polyfill-buffer-patch-JcrfT1gU.js";
|
|
2
|
+
import { Bt as AssetName, Ft as BaseAddress, Mt as CborWriter, S as TransactionOutput, Vt as PolicyId, a as CertIndex, at as isPlutusBigInt, c as EnterpriseAddress, ft as Script, it as isConstrPlutusData, n as AddressType, ot as isPlutusBoundedBytes, p as Transaction, r as CredentialType, s as TxIndex, st as isPlutusList, t as Address, zt as AssetId } from "./Address-_c_-9hLC.js";
|
|
3
|
+
import { t as BigIntMath } from "./BigIntMath-X3EniYDo.js";
|
|
4
|
+
import { t as isNotNil } from "./isNotNil-Be7gCY0m.js";
|
|
5
|
+
import { d as fail, f as ok, i as isLowerCaseHex, n as hexToBytes, r as isHash28Hex, t as bytesToHex } from "./hex-CGYJPK_Z.js";
|
|
6
|
+
//#region ../../node_modules/@cardano-sdk/core/dist/esm/Asset/util/coalesceTokenMaps.js
|
|
7
|
+
const coalesceTokenMaps = (totals) => {
|
|
8
|
+
const result = /* @__PURE__ */ new Map();
|
|
9
|
+
for (const assetTotals of totals.filter(isNotNil)) for (const [assetId, assetQuantity] of assetTotals.entries()) {
|
|
10
|
+
const sum = result.get(assetId) || 0n;
|
|
11
|
+
result.set(assetId, sum + assetQuantity);
|
|
12
|
+
}
|
|
13
|
+
if (result.size === 0) return;
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region ../../node_modules/@cardano-sdk/core/dist/esm/util/coalesceValueQuantities.js
|
|
18
|
+
const coalesceValueQuantities = (quantities) => ({
|
|
19
|
+
assets: coalesceTokenMaps(quantities.map(({ assets }) => assets)),
|
|
20
|
+
coins: BigIntMath.sum(quantities.map(({ coins }) => coins))
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ../../packages/lib/cardano-custody/src/codecs/plutus-data.ts
|
|
24
|
+
/** Raised inside the decoders only; `decodeResult` turns it into a result. */
|
|
25
|
+
var MalformedData = class extends Error {
|
|
26
|
+
constructor(path, expected) {
|
|
27
|
+
super(`Expected ${expected} at ${path || "the root"}`);
|
|
28
|
+
this.path = path;
|
|
29
|
+
this.expected = expected;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/** Runs a throwing decoder and reports a shape mismatch as a typed failure. */
|
|
33
|
+
const decodeResult = (decode) => {
|
|
34
|
+
try {
|
|
35
|
+
return ok(decode());
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (error instanceof MalformedData) return fail({
|
|
38
|
+
code: "malformed-data",
|
|
39
|
+
path: error.path,
|
|
40
|
+
expected: error.expected
|
|
41
|
+
});
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const fieldPath = (path, field) => `${path}.${field}`;
|
|
46
|
+
const itemPath = (path, index) => `${path}[${index}]`;
|
|
47
|
+
/**
|
|
48
|
+
* A fresh constructor value. Encoders always build new data, never reuse
|
|
49
|
+
* decoded data: the `cbor` cache on decoded values wins over any edit.
|
|
50
|
+
*/
|
|
51
|
+
const constr = (index, fields = []) => ({
|
|
52
|
+
constructor: BigInt(index),
|
|
53
|
+
fields: { items: fields }
|
|
54
|
+
});
|
|
55
|
+
const list = (items) => ({ items });
|
|
56
|
+
const bytes = (hex) => hexToBytes(hex);
|
|
57
|
+
/** The constructor index of a value that must be a constructor. */
|
|
58
|
+
const expectConstrIndex = (data, path, what) => {
|
|
59
|
+
if (!isConstrPlutusData(data)) throw new MalformedData(path, `${what} as a constructor`);
|
|
60
|
+
return data.constructor;
|
|
61
|
+
};
|
|
62
|
+
/** The fields of a constructor with exactly the given index and arity. */
|
|
63
|
+
const expectConstr = (data, { index, arity }, { path, what }) => {
|
|
64
|
+
if (!isConstrPlutusData(data) || data.constructor !== BigInt(index) || data.fields.items.length !== arity) throw new MalformedData(path, `${what} as constructor ${index} with ${arity} fields`);
|
|
65
|
+
return data.fields.items;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The fields of a constructor with the given index and at least `minArity`
|
|
69
|
+
* fields, for a reader that relies only on a stable leading prefix.
|
|
70
|
+
*/
|
|
71
|
+
const expectConstrPrefix = (data, { index, minArity }, { path, what }) => {
|
|
72
|
+
if (!isConstrPlutusData(data) || data.constructor !== BigInt(index) || data.fields.items.length < minArity) throw new MalformedData(path, `${what} as constructor ${index} with at least ${minArity} fields`);
|
|
73
|
+
return data.fields.items;
|
|
74
|
+
};
|
|
75
|
+
const expectBytes = (data, path, what) => {
|
|
76
|
+
if (!isPlutusBoundedBytes(data)) throw new MalformedData(path, `${what} as bytes`);
|
|
77
|
+
return bytesToHex(data);
|
|
78
|
+
};
|
|
79
|
+
const expectInt = (data, path, what) => {
|
|
80
|
+
if (!isPlutusBigInt(data)) throw new MalformedData(path, `${what} as an integer`);
|
|
81
|
+
return data;
|
|
82
|
+
};
|
|
83
|
+
const expectList = (data, path, what) => {
|
|
84
|
+
if (!isPlutusList(data)) throw new MalformedData(path, `${what} as a list`);
|
|
85
|
+
return data.items;
|
|
86
|
+
};
|
|
87
|
+
/** Refuses a constructor index no alternative of a union claims. */
|
|
88
|
+
const unknownAlternative = (path, what, index) => {
|
|
89
|
+
throw new MalformedData(path, `${what}, not constructor ${index}`);
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region ../../packages/lib/cardano-custody/src/codecs/recipient.ts
|
|
93
|
+
const credentialFrom = (credential) => ({
|
|
94
|
+
type: credential.type,
|
|
95
|
+
hash: credential.hash
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* The recipient form of a Shelley payment address. Base, enterprise and
|
|
99
|
+
* pointer addresses have one; reward and Byron addresses do not.
|
|
100
|
+
*/
|
|
101
|
+
const custodyRecipientFromAddress = (address) => {
|
|
102
|
+
const base = address.asBase();
|
|
103
|
+
if (base) return ok({
|
|
104
|
+
paymentCredential: credentialFrom(base.getPaymentCredential()),
|
|
105
|
+
stakeCredential: {
|
|
106
|
+
kind: "inline",
|
|
107
|
+
credential: credentialFrom(base.getStakeCredential())
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
const enterprise = address.asEnterprise();
|
|
111
|
+
if (enterprise) return ok({ paymentCredential: credentialFrom(enterprise.getPaymentCredential()) });
|
|
112
|
+
const pointer = address.asPointer();
|
|
113
|
+
if (pointer) {
|
|
114
|
+
const { slot, txIndex, certIndex } = pointer.getStakePointer();
|
|
115
|
+
return ok({
|
|
116
|
+
paymentCredential: credentialFrom(pointer.getPaymentCredential()),
|
|
117
|
+
stakeCredential: {
|
|
118
|
+
kind: "pointer",
|
|
119
|
+
slot,
|
|
120
|
+
transactionIndex: BigInt(txIndex),
|
|
121
|
+
certificateIndex: BigInt(certIndex)
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return fail({
|
|
126
|
+
code: "unsupported-recipient-address",
|
|
127
|
+
addressType: address.getType()
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const isPointerIndex = (value) => value >= 0n && value <= BigInt(Number.MAX_SAFE_INTEGER);
|
|
131
|
+
/**
|
|
132
|
+
* Whether a recipient names an address Cardano can encode: 28-byte credential
|
|
133
|
+
* hashes and, for a pointer, non-negative indices that fit a pointer address.
|
|
134
|
+
*/
|
|
135
|
+
const isRepresentableRecipient = (recipient) => {
|
|
136
|
+
if (!isHash28Hex(recipient.paymentCredential.hash)) return false;
|
|
137
|
+
const stake = recipient.stakeCredential;
|
|
138
|
+
if (!stake) return true;
|
|
139
|
+
if (stake.kind === "inline") return isHash28Hex(stake.credential.hash);
|
|
140
|
+
return stake.slot >= 0n && isPointerIndex(stake.transactionIndex) && isPointerIndex(stake.certificateIndex);
|
|
141
|
+
};
|
|
142
|
+
const toCardanoCredential = (credential) => ({
|
|
143
|
+
type: credential.type,
|
|
144
|
+
hash: credential.hash
|
|
145
|
+
});
|
|
146
|
+
/** The address of a recipient the caller has checked is representable. */
|
|
147
|
+
const addressOfRepresentableRecipient = (recipient, networkId) => {
|
|
148
|
+
const payment = toCardanoCredential(recipient.paymentCredential);
|
|
149
|
+
const stake = recipient.stakeCredential;
|
|
150
|
+
if (!stake) return EnterpriseAddress.fromCredentials(networkId, payment).toAddress();
|
|
151
|
+
if (stake.kind === "inline") return BaseAddress.fromCredentials(networkId, payment, toCardanoCredential(stake.credential)).toAddress();
|
|
152
|
+
return new Address({
|
|
153
|
+
type: payment.type === CredentialType.ScriptHash ? AddressType.PointerScript : AddressType.PointerKey,
|
|
154
|
+
networkId,
|
|
155
|
+
paymentPart: payment,
|
|
156
|
+
pointer: {
|
|
157
|
+
slot: stake.slot,
|
|
158
|
+
txIndex: TxIndex(Number(stake.transactionIndex)),
|
|
159
|
+
certIndex: CertIndex(Number(stake.certificateIndex))
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
/** The address a recipient stands for on the given network. */
|
|
164
|
+
const custodyRecipientToAddress = (recipient, networkId) => isRepresentableRecipient(recipient) ? ok(addressOfRepresentableRecipient(recipient, networkId)) : fail({
|
|
165
|
+
code: "unrepresentable-recipient",
|
|
166
|
+
recipient
|
|
167
|
+
});
|
|
168
|
+
/** A value two recipients share exactly when their Plutus data is equal. */
|
|
169
|
+
const recipientKey = (recipient) => {
|
|
170
|
+
const credentialKey = ({ type, hash }) => `${type}:${hash}`;
|
|
171
|
+
const stake = recipient.stakeCredential;
|
|
172
|
+
const stakeKey = !stake ? "none" : stake.kind === "inline" ? `inline:${credentialKey(stake.credential)}` : `pointer:${stake.slot}:${stake.transactionIndex}:${stake.certificateIndex}`;
|
|
173
|
+
return `${credentialKey(recipient.paymentCredential)}/${stakeKey}`;
|
|
174
|
+
};
|
|
175
|
+
const CREDENTIAL_CONSTRUCTOR = {
|
|
176
|
+
[CredentialType.KeyHash]: 0,
|
|
177
|
+
[CredentialType.ScriptHash]: 1
|
|
178
|
+
};
|
|
179
|
+
const encodeCredential = (credential) => constr(CREDENTIAL_CONSTRUCTOR[credential.type], [bytes(credential.hash)]);
|
|
180
|
+
const decodeCredential = (data, path) => {
|
|
181
|
+
const index = expectConstrIndex(data, path, "a credential");
|
|
182
|
+
const type = index === 0n ? CredentialType.KeyHash : index === 1n ? CredentialType.ScriptHash : unknownAlternative(path, "a key or script credential", index);
|
|
183
|
+
const [hash] = expectConstr(data, {
|
|
184
|
+
index: Number(index),
|
|
185
|
+
arity: 1
|
|
186
|
+
}, {
|
|
187
|
+
path,
|
|
188
|
+
what: "a credential"
|
|
189
|
+
});
|
|
190
|
+
return {
|
|
191
|
+
type,
|
|
192
|
+
hash: expectBytes(hash, fieldPath(path, "hash"), "a hash")
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
const encodeStakeCredential = (stake) => stake.kind === "inline" ? constr(0, [encodeCredential(stake.credential)]) : constr(1, [
|
|
196
|
+
stake.slot,
|
|
197
|
+
stake.transactionIndex,
|
|
198
|
+
stake.certificateIndex
|
|
199
|
+
]);
|
|
200
|
+
const decodeStakeCredential = (data, path) => {
|
|
201
|
+
const index = expectConstrIndex(data, path, "a stake credential");
|
|
202
|
+
if (index === 0n) {
|
|
203
|
+
const [credential] = expectConstr(data, {
|
|
204
|
+
index: 0,
|
|
205
|
+
arity: 1
|
|
206
|
+
}, {
|
|
207
|
+
path,
|
|
208
|
+
what: "an inline stake credential"
|
|
209
|
+
});
|
|
210
|
+
return {
|
|
211
|
+
kind: "inline",
|
|
212
|
+
credential: decodeCredential(credential, fieldPath(path, "credential"))
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
if (index !== 1n) return unknownAlternative(path, "an inline or pointer stake credential", index);
|
|
216
|
+
const [slot, transactionIndex, certificateIndex] = expectConstr(data, {
|
|
217
|
+
index: 1,
|
|
218
|
+
arity: 3
|
|
219
|
+
}, {
|
|
220
|
+
path,
|
|
221
|
+
what: "a stake pointer"
|
|
222
|
+
});
|
|
223
|
+
return {
|
|
224
|
+
kind: "pointer",
|
|
225
|
+
slot: expectInt(slot, fieldPath(path, "slot"), "a slot"),
|
|
226
|
+
transactionIndex: expectInt(transactionIndex, fieldPath(path, "transactionIndex"), "a transaction index"),
|
|
227
|
+
certificateIndex: expectInt(certificateIndex, fieldPath(path, "certificateIndex"), "a certificate index")
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
/** `Address { payment_credential, stake_credential: Option<StakeCredential> }`. */
|
|
231
|
+
const encodeRecipient = (recipient) => constr(0, [encodeCredential(recipient.paymentCredential), recipient.stakeCredential ? constr(0, [encodeStakeCredential(recipient.stakeCredential)]) : constr(1)]);
|
|
232
|
+
const decodeRecipient = (data, path) => {
|
|
233
|
+
const [payment, optionalStake] = expectConstr(data, {
|
|
234
|
+
index: 0,
|
|
235
|
+
arity: 2
|
|
236
|
+
}, {
|
|
237
|
+
path,
|
|
238
|
+
what: "an address"
|
|
239
|
+
});
|
|
240
|
+
const paymentCredential = decodeCredential(payment, fieldPath(path, "paymentCredential"));
|
|
241
|
+
const stakePath = fieldPath(path, "stakeCredential");
|
|
242
|
+
const option = expectConstrIndex(optionalStake, stakePath, "an option");
|
|
243
|
+
if (option === 1n) {
|
|
244
|
+
expectConstr(optionalStake, {
|
|
245
|
+
index: 1,
|
|
246
|
+
arity: 0
|
|
247
|
+
}, {
|
|
248
|
+
path: stakePath,
|
|
249
|
+
what: "None"
|
|
250
|
+
});
|
|
251
|
+
return { paymentCredential };
|
|
252
|
+
}
|
|
253
|
+
if (option !== 0n) return unknownAlternative(stakePath, "Some or None", option);
|
|
254
|
+
const [stake] = expectConstr(optionalStake, {
|
|
255
|
+
index: 0,
|
|
256
|
+
arity: 1
|
|
257
|
+
}, {
|
|
258
|
+
path: stakePath,
|
|
259
|
+
what: "Some"
|
|
260
|
+
});
|
|
261
|
+
return {
|
|
262
|
+
paymentCredential,
|
|
263
|
+
stakeCredential: decodeStakeCredential(stake, stakePath)
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region ../../packages/lib/cardano-custody/src/codecs/account-state.ts
|
|
268
|
+
const encodeAsset = (asset) => constr(0, [bytes(asset.policyId), bytes(asset.assetName)]);
|
|
269
|
+
const decodeAsset = (data, path) => {
|
|
270
|
+
const [policyId, assetName] = expectConstr(data, {
|
|
271
|
+
index: 0,
|
|
272
|
+
arity: 2
|
|
273
|
+
}, {
|
|
274
|
+
path,
|
|
275
|
+
what: "an asset"
|
|
276
|
+
});
|
|
277
|
+
return {
|
|
278
|
+
policyId: expectBytes(policyId, fieldPath(path, "policyId"), "a policy id"),
|
|
279
|
+
assetName: expectBytes(assetName, fieldPath(path, "assetName"), "an asset name")
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
/** Fields in declaration order: the lovelace per call cap precedes the lovelace cap. */
|
|
283
|
+
const encodeScope = (scope) => constr(0, [
|
|
284
|
+
encodeAsset(scope.asset),
|
|
285
|
+
scope.perCallCap,
|
|
286
|
+
scope.cap,
|
|
287
|
+
scope.lovelacePerCallCap,
|
|
288
|
+
scope.lovelaceCap,
|
|
289
|
+
scope.expiresAt,
|
|
290
|
+
list(scope.recipients.map(encodeRecipient))
|
|
291
|
+
]);
|
|
292
|
+
const decodeScope = (data, path) => {
|
|
293
|
+
const [asset, perCallCap, cap, lovelacePerCallCap, lovelaceCap, expiresAt, recipients] = expectConstr(data, {
|
|
294
|
+
index: 0,
|
|
295
|
+
arity: 7
|
|
296
|
+
}, {
|
|
297
|
+
path,
|
|
298
|
+
what: "a scope"
|
|
299
|
+
});
|
|
300
|
+
const recipientsPath = fieldPath(path, "recipients");
|
|
301
|
+
return {
|
|
302
|
+
asset: decodeAsset(asset, fieldPath(path, "asset")),
|
|
303
|
+
perCallCap: expectInt(perCallCap, fieldPath(path, "perCallCap"), "a per call cap"),
|
|
304
|
+
cap: expectInt(cap, fieldPath(path, "cap"), "a cap"),
|
|
305
|
+
lovelacePerCallCap: expectInt(lovelacePerCallCap, fieldPath(path, "lovelacePerCallCap"), "a lovelace per call cap"),
|
|
306
|
+
lovelaceCap: expectInt(lovelaceCap, fieldPath(path, "lovelaceCap"), "a lovelace cap"),
|
|
307
|
+
expiresAt: expectInt(expiresAt, fieldPath(path, "expiresAt"), "an expiry"),
|
|
308
|
+
recipients: expectList(recipients, recipientsPath, "recipients").map((recipient, index) => decodeRecipient(recipient, itemPath(recipientsPath, index)))
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* The inline datum of a grant UTxO. Always fresh Plutus data, like the state
|
|
313
|
+
* encoder. Throws `InvalidStringError` for a key hash, asset or credential
|
|
314
|
+
* hash that is not hex of whole bytes.
|
|
315
|
+
*/
|
|
316
|
+
const encodeCustodyGrant = (grant) => constr(0, [
|
|
317
|
+
grant.slot,
|
|
318
|
+
bytes(grant.grantee),
|
|
319
|
+
grant.generation,
|
|
320
|
+
encodeScope(grant.scope)
|
|
321
|
+
]);
|
|
322
|
+
/**
|
|
323
|
+
* The grant a grant UTxO datum carries. Accepts exactly the shapes the
|
|
324
|
+
* logic's soft cast accepts and applies no authoring rule;
|
|
325
|
+
* `findCustodyGrantViolations` marks what Lace would not author.
|
|
326
|
+
*/
|
|
327
|
+
const decodeCustodyGrant = (data) => decodeResult(() => {
|
|
328
|
+
const [slot, grantee, generation, scope] = expectConstr(data, {
|
|
329
|
+
index: 0,
|
|
330
|
+
arity: 4
|
|
331
|
+
}, {
|
|
332
|
+
path: "",
|
|
333
|
+
what: "a grant"
|
|
334
|
+
});
|
|
335
|
+
return {
|
|
336
|
+
slot: expectInt(slot, "slot", "a slot"),
|
|
337
|
+
grantee: expectBytes(grantee, "grantee", "a grantee key hash"),
|
|
338
|
+
generation: expectInt(generation, "generation", "a generation"),
|
|
339
|
+
scope: decodeScope(scope, "scope")
|
|
340
|
+
};
|
|
341
|
+
});
|
|
342
|
+
/**
|
|
343
|
+
* The control UTxO datum for a state. Always fresh Plutus data, so edits made
|
|
344
|
+
* to a decoded state are never masked by the original encoding.
|
|
345
|
+
*
|
|
346
|
+
* Throws `InvalidStringError` for a logic or device key hash that is not hex
|
|
347
|
+
* of whole bytes, instead of writing other bytes than the state holds. A
|
|
348
|
+
* decoded state, and a state `findCustodyStateViolations` accepts, always
|
|
349
|
+
* encode.
|
|
350
|
+
*/
|
|
351
|
+
const encodeCustodyAccountState = (state) => constr(0, [
|
|
352
|
+
bytes(state.logic),
|
|
353
|
+
list(state.devices.map((device) => bytes(device))),
|
|
354
|
+
state.grantGeneration,
|
|
355
|
+
state.nextSlot,
|
|
356
|
+
list([...state.revoked]),
|
|
357
|
+
state.outstanding
|
|
358
|
+
]);
|
|
359
|
+
const decodeLogic = (data) => expectBytes(data, "logic", "a logic hash");
|
|
360
|
+
const decodeDevices = (data) => expectList(data, "devices", "devices").map((device, index) => expectBytes(device, itemPath("devices", index), "a device key hash"));
|
|
361
|
+
/**
|
|
362
|
+
* The state a control UTxO datum carries. Accepts exactly the shapes the
|
|
363
|
+
* logic's soft cast accepts: canonical constructor indices and exact
|
|
364
|
+
* field counts. It applies no authoring rule, so an on-chain device with an
|
|
365
|
+
* ill-sized hash still decodes; `findCustodyStateViolations` marks it.
|
|
366
|
+
*/
|
|
367
|
+
const decodeCustodyAccountState = (data) => decodeResult(() => {
|
|
368
|
+
const [logic, devices, grantGeneration, nextSlot, revoked, outstanding] = expectConstr(data, {
|
|
369
|
+
index: 0,
|
|
370
|
+
arity: 6
|
|
371
|
+
}, {
|
|
372
|
+
path: "",
|
|
373
|
+
what: "an account state"
|
|
374
|
+
});
|
|
375
|
+
return {
|
|
376
|
+
logic: decodeLogic(logic),
|
|
377
|
+
devices: decodeDevices(devices),
|
|
378
|
+
grantGeneration: expectInt(grantGeneration, "grantGeneration", "a grant generation"),
|
|
379
|
+
nextSlot: expectInt(nextSlot, "nextSlot", "a next slot"),
|
|
380
|
+
revoked: expectList(revoked, "revoked", "revoked slots").map((slot, index) => expectInt(slot, itemPath("revoked", index), "a revoked slot")),
|
|
381
|
+
outstanding: expectInt(outstanding, "outstanding", "an outstanding count")
|
|
382
|
+
};
|
|
383
|
+
});
|
|
384
|
+
/**
|
|
385
|
+
* The logic hash a control UTxO datum names in its first field, whatever the
|
|
386
|
+
* field count, as the proxy reads it.
|
|
387
|
+
*/
|
|
388
|
+
const decodeCustodyStateLogic = (data) => decodeResult(() => {
|
|
389
|
+
const [logic] = expectConstrPrefix(data, {
|
|
390
|
+
index: 0,
|
|
391
|
+
minArity: 1
|
|
392
|
+
}, {
|
|
393
|
+
path: "",
|
|
394
|
+
what: "an account state"
|
|
395
|
+
});
|
|
396
|
+
return decodeLogic(logic);
|
|
397
|
+
});
|
|
398
|
+
/**
|
|
399
|
+
* The device key hashes of a control UTxO datum, read from its second field
|
|
400
|
+
* whatever the field count, as the stake script reads them. The devices are
|
|
401
|
+
* only as trustworthy as the logic that admitted them, so a reader first
|
|
402
|
+
* checks the logic `decodeCustodyStateLogic` names.
|
|
403
|
+
*/
|
|
404
|
+
const decodeCustodyStateDevices = (data) => decodeResult(() => {
|
|
405
|
+
const [, devices] = expectConstrPrefix(data, {
|
|
406
|
+
index: 0,
|
|
407
|
+
minArity: 2
|
|
408
|
+
}, {
|
|
409
|
+
path: "",
|
|
410
|
+
what: "an account state"
|
|
411
|
+
});
|
|
412
|
+
return decodeDevices(devices);
|
|
413
|
+
});
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region ../../packages/lib/cardano-custody/src/tokens.ts
|
|
416
|
+
/** Bytes of the big-endian slot a grant token name appends to the stake script hash. */
|
|
417
|
+
const SLOT_BYTES = 4;
|
|
418
|
+
const SLOT_HEX_LENGTH = SLOT_BYTES * 2;
|
|
419
|
+
const STAKE_SCRIPT_HASH_HEX_LENGTH = 56;
|
|
420
|
+
/** The first slot a grant token name cannot carry. */
|
|
421
|
+
const CUSTODY_SLOT_LIMIT = 1n << BigInt(SLOT_BYTES * 8);
|
|
422
|
+
/**
|
|
423
|
+
* The name of an account's grant token for `slot`: the stake script hash
|
|
424
|
+
* followed by the slot as four big-endian bytes. Throws `RangeError` for a
|
|
425
|
+
* slot outside 0 to 2^32 - 1, which no grant token can carry.
|
|
426
|
+
*
|
|
427
|
+
* @param stakeScriptHash - lower-case hex of exactly 28 bytes, checked by the caller
|
|
428
|
+
*/
|
|
429
|
+
const custodyGrantTokenName = (stakeScriptHash, slot) => {
|
|
430
|
+
if (slot < 0n || slot >= CUSTODY_SLOT_LIMIT) throw new RangeError(`Slot ${slot} does not fit a grant token name`);
|
|
431
|
+
return AssetName(`${stakeScriptHash}${slot.toString(16).padStart(SLOT_HEX_LENGTH, "0")}`);
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* The asset id of an account's grant token for `slot`, under the account
|
|
435
|
+
* validator's policy. Throws like `custodyGrantTokenName`.
|
|
436
|
+
*/
|
|
437
|
+
const custodyGrantAssetId = ({ accountValidatorHash, stakeScriptHash }, slot) => AssetId.fromParts(PolicyId(accountValidatorHash), custodyGrantTokenName(stakeScriptHash, slot));
|
|
438
|
+
/**
|
|
439
|
+
* What a token name under the account policy names, or undefined when it
|
|
440
|
+
* has neither contract shape. The policy is the caller's to check.
|
|
441
|
+
*/
|
|
442
|
+
const parseCustodyAccountTokenName = (name) => {
|
|
443
|
+
if (!isLowerCaseHex(name)) return void 0;
|
|
444
|
+
const stakeScriptHash = name.slice(0, STAKE_SCRIPT_HASH_HEX_LENGTH);
|
|
445
|
+
if (name.length === STAKE_SCRIPT_HASH_HEX_LENGTH) return {
|
|
446
|
+
kind: "state-nft",
|
|
447
|
+
stakeScriptHash
|
|
448
|
+
};
|
|
449
|
+
if (name.length === STAKE_SCRIPT_HASH_HEX_LENGTH + SLOT_HEX_LENGTH) return {
|
|
450
|
+
kind: "grant",
|
|
451
|
+
stakeScriptHash,
|
|
452
|
+
slot: BigInt(`0x${name.slice(STAKE_SCRIPT_HASH_HEX_LENGTH)}`)
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
const MAX_ASSET_NAME_BYTES = 32;
|
|
456
|
+
const POLICY_ID_BYTES = 28;
|
|
457
|
+
const CUSTODY_LOVELACE_ASSET = {
|
|
458
|
+
policyId: "",
|
|
459
|
+
assetName: ""
|
|
460
|
+
};
|
|
461
|
+
const isCustodyLovelaceAsset = (asset) => asset.policyId === "" && asset.assetName === "";
|
|
462
|
+
const isPolicyIdWellFormed = (policyId) => policyId === "" || isLowerCaseHex(policyId, POLICY_ID_BYTES);
|
|
463
|
+
const isAssetNameWellFormed = ({ policyId, assetName }) => isLowerCaseHex(assetName) && assetName.length <= MAX_ASSET_NAME_BYTES * 2 && (policyId !== "" || assetName === "");
|
|
464
|
+
const CAP_FIELDS = [
|
|
465
|
+
"perCallCap",
|
|
466
|
+
"cap",
|
|
467
|
+
"lovelacePerCallCap",
|
|
468
|
+
"lovelaceCap"
|
|
469
|
+
];
|
|
470
|
+
/** Every rule a grant breaks, in field order; empty for an authorable grant. */
|
|
471
|
+
const findCustodyGrantViolations = (grant) => {
|
|
472
|
+
const { slot, scope } = grant;
|
|
473
|
+
const violations = [];
|
|
474
|
+
if (slot < 0n || slot >= CUSTODY_SLOT_LIMIT) violations.push({
|
|
475
|
+
code: "slot-out-of-range",
|
|
476
|
+
slot
|
|
477
|
+
});
|
|
478
|
+
if (!isHash28Hex(grant.grantee)) violations.push({
|
|
479
|
+
code: "invalid-grantee-key-hash",
|
|
480
|
+
slot
|
|
481
|
+
});
|
|
482
|
+
if (grant.generation < 0n) violations.push({
|
|
483
|
+
code: "negative-generation",
|
|
484
|
+
slot
|
|
485
|
+
});
|
|
486
|
+
if (!isPolicyIdWellFormed(scope.asset.policyId)) violations.push({
|
|
487
|
+
code: "invalid-policy-id",
|
|
488
|
+
slot
|
|
489
|
+
});
|
|
490
|
+
if (!isAssetNameWellFormed(scope.asset)) violations.push({
|
|
491
|
+
code: "invalid-asset-name",
|
|
492
|
+
slot
|
|
493
|
+
});
|
|
494
|
+
for (const field of CAP_FIELDS) if (scope[field] < 0n) violations.push({
|
|
495
|
+
code: "negative-cap",
|
|
496
|
+
field,
|
|
497
|
+
slot
|
|
498
|
+
});
|
|
499
|
+
if (isCustodyLovelaceAsset(scope.asset) && (scope.lovelacePerCallCap !== 0n || scope.lovelaceCap !== 0n)) violations.push({
|
|
500
|
+
code: "lovelace-grant-lovelace-caps",
|
|
501
|
+
slot
|
|
502
|
+
});
|
|
503
|
+
if (scope.expiresAt <= 0n) violations.push({
|
|
504
|
+
code: "non-positive-expiry",
|
|
505
|
+
slot
|
|
506
|
+
});
|
|
507
|
+
if (scope.recipients.length > 8) violations.push({
|
|
508
|
+
code: "recipient-count",
|
|
509
|
+
count: scope.recipients.length,
|
|
510
|
+
slot
|
|
511
|
+
});
|
|
512
|
+
const seenRecipients = /* @__PURE__ */ new Set();
|
|
513
|
+
for (const [recipientIndex, recipient] of scope.recipients.entries()) {
|
|
514
|
+
if (!isRepresentableRecipient(recipient)) violations.push({
|
|
515
|
+
code: "unrepresentable-recipient",
|
|
516
|
+
recipientIndex,
|
|
517
|
+
slot
|
|
518
|
+
});
|
|
519
|
+
const key = recipientKey(recipient);
|
|
520
|
+
if (seenRecipients.has(key)) violations.push({
|
|
521
|
+
code: "duplicate-recipient",
|
|
522
|
+
recipientIndex,
|
|
523
|
+
slot
|
|
524
|
+
});
|
|
525
|
+
seenRecipients.add(key);
|
|
526
|
+
}
|
|
527
|
+
return violations;
|
|
528
|
+
};
|
|
529
|
+
/**
|
|
530
|
+
* Every rule a control state breaks: the contract's well-formedness bounds
|
|
531
|
+
* plus a 28-byte logic hash and 28-byte device key hashes. Apply it to every
|
|
532
|
+
* state Lace builds or approves. An on-chain state may hold an ill-sized
|
|
533
|
+
* device, which can never sign; its violation names it so a device can
|
|
534
|
+
* remove it.
|
|
535
|
+
*/
|
|
536
|
+
const findCustodyStateViolations = (state) => {
|
|
537
|
+
const violations = [];
|
|
538
|
+
if (!isHash28Hex(state.logic)) violations.push({
|
|
539
|
+
code: "invalid-logic-hash",
|
|
540
|
+
logic: state.logic
|
|
541
|
+
});
|
|
542
|
+
const deviceCount = state.devices.length;
|
|
543
|
+
if (deviceCount < 1 || deviceCount > 8) violations.push({
|
|
544
|
+
code: "device-count",
|
|
545
|
+
count: deviceCount
|
|
546
|
+
});
|
|
547
|
+
const seenDevices = /* @__PURE__ */ new Set();
|
|
548
|
+
for (const [deviceIndex, device] of state.devices.entries()) {
|
|
549
|
+
if (!isHash28Hex(device)) violations.push({
|
|
550
|
+
code: "invalid-device-key-hash",
|
|
551
|
+
device,
|
|
552
|
+
deviceIndex
|
|
553
|
+
});
|
|
554
|
+
if (seenDevices.has(device)) violations.push({
|
|
555
|
+
code: "duplicate-device",
|
|
556
|
+
device,
|
|
557
|
+
deviceIndex
|
|
558
|
+
});
|
|
559
|
+
seenDevices.add(device);
|
|
560
|
+
}
|
|
561
|
+
if (state.grantGeneration < 0n) violations.push({ code: "negative-grant-generation" });
|
|
562
|
+
if (state.nextSlot < 0n) violations.push({ code: "negative-next-slot" });
|
|
563
|
+
if (state.outstanding < 0n) violations.push({ code: "negative-outstanding" });
|
|
564
|
+
if (state.outstanding > BigInt(16)) violations.push({
|
|
565
|
+
code: "outstanding-count",
|
|
566
|
+
count: state.outstanding
|
|
567
|
+
});
|
|
568
|
+
if (state.revoked.length > 32) violations.push({
|
|
569
|
+
code: "revoked-count",
|
|
570
|
+
count: state.revoked.length
|
|
571
|
+
});
|
|
572
|
+
return violations;
|
|
573
|
+
};
|
|
574
|
+
/**
|
|
575
|
+
* Whether a grant can no longer be used at `now` (POSIX milliseconds): a
|
|
576
|
+
* spend's upper validity bound must not pass `expiresAt`, so a grant is
|
|
577
|
+
* expired from the instant it names. A non-finite `now` is a broken clock,
|
|
578
|
+
* which can never show a grant as usable, so it counts as expired.
|
|
579
|
+
*/
|
|
580
|
+
const isCustodyGrantExpired = (grant, now) => !Number.isFinite(now) || grant.scope.expiresAt <= BigInt(Math.floor(now));
|
|
581
|
+
/**
|
|
582
|
+
* Whether a grant is current against a control state, as the contract
|
|
583
|
+
* judges a spend: issued under the state's generation and not revoked by
|
|
584
|
+
* slot. Expiry is the validity range's business.
|
|
585
|
+
*/
|
|
586
|
+
const isCustodyGrantCurrent = (grant, state) => grant.generation === state.grantGeneration && !state.revoked.includes(grant.slot);
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region ../../node_modules/@cardano-sdk/tx-construction/dist/esm/fees/fees.js
|
|
589
|
+
init__polyfill_buffer_patch();
|
|
590
|
+
const MIN_ADA_CONSTANT_OVERHEAD = 160;
|
|
591
|
+
const serializeBigInt = (bigInt) => {
|
|
592
|
+
const writer = new CborWriter();
|
|
593
|
+
writer.writeInt(BigInt(bigInt));
|
|
594
|
+
return writer.encode();
|
|
595
|
+
};
|
|
596
|
+
const serializeTxOutputSize = (output) => TransactionOutput.fromCore(output).toCbor().length / 2;
|
|
597
|
+
const serializeTx = (tx) => import_buffer.Buffer.from(Transaction.fromCore(tx).toCbor(), "hex");
|
|
598
|
+
const getTotalExUnits = (redeemers) => {
|
|
599
|
+
const totalExUnits = {
|
|
600
|
+
memory: 0,
|
|
601
|
+
steps: 0
|
|
602
|
+
};
|
|
603
|
+
for (const redeemer of redeemers) {
|
|
604
|
+
totalExUnits.memory += redeemer.executionUnits.memory;
|
|
605
|
+
totalExUnits.steps += redeemer.executionUnits.steps;
|
|
606
|
+
}
|
|
607
|
+
return totalExUnits;
|
|
608
|
+
};
|
|
609
|
+
const minRefScriptFee = (tx, resolvedInputs, coinsPerRefScriptByte) => {
|
|
610
|
+
if (coinsPerRefScriptByte === 0) return BigInt(0);
|
|
611
|
+
let base = coinsPerRefScriptByte;
|
|
612
|
+
const range = 25600;
|
|
613
|
+
const multiplier = 1.2;
|
|
614
|
+
let totalRefScriptsSize = 0;
|
|
615
|
+
const totalInputs = [...tx.body.inputs, ...tx.body.referenceInputs ?? []];
|
|
616
|
+
for (const output of totalInputs) {
|
|
617
|
+
const resolvedInput = resolvedInputs.find((input) => input[0].txId === output.txId && input[0].index === output.index);
|
|
618
|
+
if (resolvedInput && resolvedInput[1].scriptReference) totalRefScriptsSize += Script.fromCore(resolvedInput[1].scriptReference).toCbor().length / 2;
|
|
619
|
+
}
|
|
620
|
+
let scriptRefFee = 0;
|
|
621
|
+
while (totalRefScriptsSize > 0) {
|
|
622
|
+
scriptRefFee += Math.ceil(Math.min(range, totalRefScriptsSize) * base);
|
|
623
|
+
totalRefScriptsSize = Math.max(totalRefScriptsSize - range, 0);
|
|
624
|
+
base *= multiplier;
|
|
625
|
+
}
|
|
626
|
+
return BigInt(scriptRefFee);
|
|
627
|
+
};
|
|
628
|
+
const minScriptFee = (tx, exUnitsPrice, resolvedInputs, coinsPerRefScriptByte) => {
|
|
629
|
+
const scriptRefFee = minRefScriptFee(tx, resolvedInputs, coinsPerRefScriptByte);
|
|
630
|
+
if (!tx.witness.redeemers) return BigInt(scriptRefFee);
|
|
631
|
+
const totalExUnits = getTotalExUnits(tx.witness.redeemers);
|
|
632
|
+
return BigInt(Math.ceil(totalExUnits.steps * exUnitsPrice.steps + totalExUnits.memory * exUnitsPrice.memory)) + scriptRefFee;
|
|
633
|
+
};
|
|
634
|
+
const minNoScriptFee = (tx, minFeeConstant, minFeeCoefficient) => {
|
|
635
|
+
const txSize = serializeTx(tx).length;
|
|
636
|
+
return BigInt(Math.ceil(txSize * minFeeCoefficient + minFeeConstant));
|
|
637
|
+
};
|
|
638
|
+
const minAdaRequired = (output, coinsPerUtxoByte) => {
|
|
639
|
+
const oldCoinSize = serializeBigInt(output.value.coins.toString()).length;
|
|
640
|
+
let latestSize = oldCoinSize;
|
|
641
|
+
let isDone = false;
|
|
642
|
+
while (!isDone) {
|
|
643
|
+
const sizeDiff = latestSize - oldCoinSize;
|
|
644
|
+
const newCoinSize = serializeBigInt((BigInt(serializeTxOutputSize(output) + MIN_ADA_CONSTANT_OVERHEAD + sizeDiff) * coinsPerUtxoByte).toString()).length;
|
|
645
|
+
isDone = latestSize === newCoinSize;
|
|
646
|
+
latestSize = newCoinSize;
|
|
647
|
+
}
|
|
648
|
+
const sizeChange = latestSize - oldCoinSize;
|
|
649
|
+
return BigInt(serializeTxOutputSize(output) + MIN_ADA_CONSTANT_OVERHEAD + sizeChange) * coinsPerUtxoByte;
|
|
650
|
+
};
|
|
651
|
+
const minFee = (tx, resolvedInputs, pparams) => minNoScriptFee(tx, pparams.minFeeConstant, pparams.minFeeCoefficient) + minScriptFee(tx, pparams.prices, resolvedInputs, pparams.minFeeRefScriptCostPerByte ? Number(pparams.minFeeRefScriptCostPerByte) : 0);
|
|
652
|
+
//#endregion
|
|
653
|
+
export { decodeResult as C, coalesceValueQuantities as D, unknownAlternative as E, coalesceTokenMaps as O, constr as S, expectConstrIndex as T, encodeCustodyGrant as _, findCustodyStateViolations as a, custodyRecipientToAddress as b, isCustodyLovelaceAsset as c, parseCustodyAccountTokenName as d, decodeCustodyAccountState as f, encodeCustodyAccountState as g, decodeCustodyStateLogic as h, findCustodyGrantViolations as i, CUSTODY_SLOT_LIMIT as l, decodeCustodyStateDevices as m, minFee as n, isCustodyGrantCurrent as o, decodeCustodyGrant as p, CUSTODY_LOVELACE_ASSET as r, isCustodyGrantExpired as s, minAdaRequired as t, custodyGrantAssetId as u, addressOfRepresentableRecipient as v, expectConstr as w, recipientKey as x, custodyRecipientFromAddress as y };
|