@aptos-labs/ts-sdk 1.27.1 → 1.28.0-zeta.1
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/common/{accountAddress-LOYE4_sG.d.ts → accountAddress-0OnKb1b9.d.ts} +5 -3
- package/dist/common/chunk-HBPH2AD3.js +2 -0
- package/dist/common/chunk-HBPH2AD3.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +252 -41
- package/dist/common/index.js +28 -28
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-B1VMJOY2.d.mts → Ed25519Account-9zBaZEnp.d.mts} +1 -1
- package/dist/esm/account/Account.d.mts +2 -2
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +2 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +75 -0
- package/dist/esm/account/FederatedKeylessAccount.mjs +2 -0
- package/dist/esm/account/KeylessAccount.d.mts +13 -130
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccountCommon.d.mts +207 -0
- package/dist/esm/account/KeylessAccountCommon.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +4 -3
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +6 -3
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +4 -3
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +2 -2
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +5 -2
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +2 -2
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +2 -2
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +5 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +35 -21
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +2 -2
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/index.d.mts +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +10 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/chunk-23J256KA.mjs +2 -0
- package/dist/esm/chunk-23J256KA.mjs.map +1 -0
- package/dist/esm/{chunk-QE5OL6KN.mjs → chunk-2MDJ763P.mjs} +2 -2
- package/dist/esm/{chunk-WFOYGJS5.mjs → chunk-2Z6HETKH.mjs} +2 -2
- package/dist/esm/{chunk-G5MGSV7Y.mjs → chunk-3CE63FFN.mjs} +2 -2
- package/dist/esm/chunk-3TSO6PDV.mjs +2 -0
- package/dist/esm/{chunk-2N2VEGT6.mjs → chunk-3XX3675G.mjs} +2 -2
- package/dist/esm/{chunk-ZXYTLPP6.mjs → chunk-4I6IUAHQ.mjs} +2 -2
- package/dist/esm/{chunk-UV7M72QD.mjs → chunk-4QVGK2KD.mjs} +2 -2
- package/dist/esm/{chunk-SUJLWCRN.mjs → chunk-5FPWLBZT.mjs} +2 -2
- package/dist/esm/chunk-5HI4R3A2.mjs +2 -0
- package/dist/esm/{chunk-AYX5JMB4.mjs → chunk-5HWJ3SN4.mjs} +2 -2
- package/dist/esm/{chunk-3SPU4V2B.mjs → chunk-5RNKD3GW.mjs} +2 -2
- package/dist/esm/{chunk-SCHZ67F3.mjs → chunk-5VQK4F5X.mjs} +2 -2
- package/dist/esm/{chunk-SCHZ67F3.mjs.map → chunk-5VQK4F5X.mjs.map} +1 -1
- package/dist/esm/{chunk-7Y3MRBG6.mjs → chunk-6LC7ZJEI.mjs} +2 -2
- package/dist/esm/{chunk-76HTG7Z7.mjs → chunk-7BPKOPP7.mjs} +2 -2
- package/dist/esm/chunk-7T5CUI2H.mjs +2 -0
- package/dist/esm/{chunk-Q7MD4V7H.mjs.map → chunk-7T5CUI2H.mjs.map} +1 -1
- package/dist/esm/{chunk-HRIYZBXY.mjs → chunk-ADLWXCGV.mjs} +2 -2
- package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
- package/dist/esm/chunk-ASQIKTEF.mjs +2 -0
- package/dist/esm/chunk-ASQIKTEF.mjs.map +1 -0
- package/dist/esm/{chunk-GNFEBKFV.mjs → chunk-AT2A7OZD.mjs} +2 -2
- package/dist/esm/{chunk-A4T373F3.mjs → chunk-AWQNX3RT.mjs} +2 -2
- package/dist/esm/{chunk-NWOMSL6K.mjs → chunk-AZ642ORV.mjs} +2 -2
- package/dist/esm/chunk-B2RQPJYZ.mjs +2 -0
- package/dist/esm/chunk-B2RQPJYZ.mjs.map +1 -0
- package/dist/esm/{chunk-52KPINA4.mjs → chunk-B5NYEWNM.mjs} +2 -2
- package/dist/esm/chunk-BC5BEOKM.mjs +2 -0
- package/dist/esm/{chunk-G7UNU5GI.mjs → chunk-BQPQLOIW.mjs} +2 -2
- package/dist/esm/chunk-CBRVPQV6.mjs +2 -0
- package/dist/esm/chunk-CBRVPQV6.mjs.map +1 -0
- package/dist/esm/chunk-CDIKSNSU.mjs +2 -0
- package/dist/esm/{chunk-7AIKM3UF.mjs → chunk-CSNIVFPZ.mjs} +2 -2
- package/dist/esm/chunk-DYMN66K5.mjs +2 -0
- package/dist/esm/{chunk-4ZMI5G5L.mjs.map → chunk-DYMN66K5.mjs.map} +1 -1
- package/dist/esm/{chunk-3NRBTP3S.mjs → chunk-E2WOZVJX.mjs} +2 -2
- package/dist/esm/{chunk-H33YIMTU.mjs → chunk-E5LYYWAS.mjs} +2 -2
- package/dist/esm/chunk-E7VSBBQM.mjs +2 -0
- package/dist/esm/{chunk-YPHH6CAO.mjs.map → chunk-E7VSBBQM.mjs.map} +1 -1
- package/dist/esm/{chunk-OHRL766V.mjs → chunk-EDVGFSB5.mjs} +2 -2
- package/dist/esm/{chunk-OHRL766V.mjs.map → chunk-EDVGFSB5.mjs.map} +1 -1
- package/dist/esm/{chunk-ZQFFRZJ4.mjs → chunk-ELPTV7ZG.mjs} +2 -2
- package/dist/esm/chunk-EXP5STXZ.mjs +2 -0
- package/dist/esm/chunk-EXP5STXZ.mjs.map +1 -0
- package/dist/esm/chunk-FBPNHF54.mjs +2 -0
- package/dist/esm/{chunk-UWPO7WWS.mjs → chunk-FDD6WNN6.mjs} +2 -2
- package/dist/esm/{chunk-6ERHGCK2.mjs → chunk-FDTLBR6D.mjs} +2 -2
- package/dist/esm/chunk-FOLCONSQ.mjs +2 -0
- package/dist/esm/{chunk-5IUXBOS5.mjs → chunk-FTBXTZM2.mjs} +2 -2
- package/dist/esm/{chunk-UO52TECC.mjs → chunk-G6HZPSZ3.mjs} +2 -2
- package/dist/esm/chunk-GAEAYY44.mjs +1 -0
- package/dist/esm/chunk-GAEAYY44.mjs.map +1 -0
- package/dist/esm/{chunk-ZXPBRVOA.mjs → chunk-GKRIMGKW.mjs} +2 -2
- package/dist/esm/{chunk-MEKXPGK7.mjs → chunk-GX2II7H4.mjs} +2 -2
- package/dist/esm/{chunk-I5XQKNOK.mjs → chunk-H3TJNBHX.mjs} +2 -2
- package/dist/esm/{chunk-MLL54PYO.mjs → chunk-HAT5S2XX.mjs} +2 -2
- package/dist/esm/{chunk-MLL54PYO.mjs.map → chunk-HAT5S2XX.mjs.map} +1 -1
- package/dist/esm/chunk-IA4RELOH.mjs +1 -0
- package/dist/esm/chunk-IA4RELOH.mjs.map +1 -0
- package/dist/esm/{chunk-USOIC4HO.mjs → chunk-J3PN353M.mjs} +2 -2
- package/dist/esm/{chunk-SONTIUAM.mjs → chunk-J45FMNYT.mjs} +2 -2
- package/dist/esm/{chunk-HHU7UCFI.mjs → chunk-K7ZPRL7C.mjs} +2 -2
- package/dist/esm/chunk-K7ZPRL7C.mjs.map +1 -0
- package/dist/esm/{chunk-NRRADUK4.mjs → chunk-KBIYKNM2.mjs} +2 -2
- package/dist/esm/{chunk-T2NJUIOQ.mjs → chunk-KSOKGREZ.mjs} +2 -2
- package/dist/esm/{chunk-ORXEFE6X.mjs → chunk-LY7ZRAJT.mjs} +2 -2
- package/dist/esm/chunk-MSK4O4KB.mjs +2 -0
- package/dist/esm/chunk-MSK4O4KB.mjs.map +1 -0
- package/dist/esm/{chunk-FOHGSNYZ.mjs → chunk-MYRN7MDF.mjs} +2 -2
- package/dist/esm/{chunk-PO33LVUF.mjs → chunk-MZB3J6CV.mjs} +2 -2
- package/dist/esm/chunk-N6EC72OZ.mjs +2 -0
- package/dist/esm/chunk-ND23H3AK.mjs +2 -0
- package/dist/esm/{chunk-JKNTGRSQ.mjs → chunk-NGIPNL7N.mjs} +2 -2
- package/dist/esm/{chunk-ZZRSKHWS.mjs → chunk-NOVJ2ROD.mjs} +2 -2
- package/dist/esm/chunk-OOVNFKA6.mjs +2 -0
- package/dist/esm/{chunk-OEOUZFHD.mjs → chunk-OVI2RY5L.mjs} +2 -2
- package/dist/esm/{chunk-FNT3VLRD.mjs → chunk-P4FYT4LC.mjs} +2 -2
- package/dist/esm/chunk-PBMXWRZG.mjs +2 -0
- package/dist/esm/chunk-PBMXWRZG.mjs.map +1 -0
- package/dist/esm/chunk-PEYLPXU6.mjs +2 -0
- package/dist/esm/chunk-PEYLPXU6.mjs.map +1 -0
- package/dist/esm/chunk-QIOBANW2.mjs +2 -0
- package/dist/esm/chunk-QIOBANW2.mjs.map +1 -0
- package/dist/esm/chunk-QP2A5ISX.mjs +2 -0
- package/dist/esm/{chunk-KEN2VRIM.mjs → chunk-QQGCMXIV.mjs} +2 -2
- package/dist/esm/{chunk-O4BBULNE.mjs → chunk-QTTDBQAJ.mjs} +2 -2
- package/dist/esm/{chunk-6BYVG7H4.mjs → chunk-QUTP2ACU.mjs} +2 -2
- package/dist/esm/{chunk-PY4TS34X.mjs → chunk-RLGIYYI7.mjs} +2 -2
- package/dist/esm/{chunk-5L3PLK3W.mjs → chunk-S3I4THN5.mjs} +2 -2
- package/dist/esm/{chunk-GHKMF253.mjs → chunk-S7KCJQOA.mjs} +2 -2
- package/dist/esm/{chunk-WRRQ7L5K.mjs → chunk-SHOPSMRK.mjs} +2 -2
- package/dist/esm/{chunk-YDZBU2DJ.mjs → chunk-SP4PT77Z.mjs} +2 -2
- package/dist/esm/chunk-SVO6PVAX.mjs +2 -0
- package/dist/esm/chunk-SVO6PVAX.mjs.map +1 -0
- package/dist/esm/{chunk-74YFNJ7A.mjs → chunk-SYKVA363.mjs} +2 -2
- package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
- package/dist/esm/chunk-TKQEC2WD.mjs +2 -0
- package/dist/esm/chunk-TKQEC2WD.mjs.map +1 -0
- package/dist/esm/chunk-TVWAYKEP.mjs +2 -0
- package/dist/esm/{chunk-CTJX4CUF.mjs → chunk-U72MLMGP.mjs} +2 -2
- package/dist/esm/chunk-UAL27G6B.mjs +2 -0
- package/dist/esm/chunk-UAL27G6B.mjs.map +1 -0
- package/dist/esm/chunk-UW5TIZFE.mjs +2 -0
- package/dist/esm/chunk-UYYQZDVB.mjs +2 -0
- package/dist/esm/chunk-UYYQZDVB.mjs.map +1 -0
- package/dist/esm/{chunk-NMD45OTM.mjs → chunk-VTEOS4PS.mjs} +2 -2
- package/dist/esm/{chunk-NCWD4NA3.mjs → chunk-VVWBJKEA.mjs} +2 -2
- package/dist/esm/chunk-W2KQ2TSH.mjs +2 -0
- package/dist/esm/chunk-W2KQ2TSH.mjs.map +1 -0
- package/dist/esm/{chunk-HKMG3LZX.mjs → chunk-YACGA3YS.mjs} +2 -2
- package/dist/esm/{chunk-ECKJI2TV.mjs → chunk-YBZI6U43.mjs} +2 -2
- package/dist/esm/chunk-YELQZVBK.mjs +2 -0
- package/dist/esm/chunk-YELQZVBK.mjs.map +1 -0
- package/dist/esm/{chunk-F7NVDHR2.mjs → chunk-YNLAYIFQ.mjs} +2 -2
- package/dist/esm/chunk-YNLAYIFQ.mjs.map +1 -0
- package/dist/esm/{chunk-2CC67KW5.mjs → chunk-YSVXROOO.mjs} +2 -2
- package/dist/esm/chunk-ZAHUEAGT.mjs +2 -0
- package/dist/esm/chunk-ZAHUEAGT.mjs.map +1 -0
- package/dist/esm/chunk-ZASN3QQQ.mjs +2 -0
- package/dist/esm/chunk-ZXVQ2OBJ.mjs +2 -0
- package/dist/esm/{chunk-ZEYOFDIO.mjs.map → chunk-ZXVQ2OBJ.mjs.map} +1 -1
- package/dist/esm/{chunk-A63SMUOU.mjs → chunk-ZZIMFLVT.mjs} +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +97 -0
- package/dist/esm/core/crypto/federatedKeyless.mjs +2 -0
- package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -0
- package/dist/esm/core/crypto/index.d.mts +4 -3
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +1 -1
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +1 -1
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +2 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +9 -6
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +2 -2
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +2 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +2 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +25 -14
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +2 -2
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +1 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +3 -3
- package/dist/esm/types/index.d.mts +4 -2
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +2 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +41 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +2 -2
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/src/account/FederatedKeylessAccount.ts +115 -0
- package/src/account/KeylessAccount.ts +6 -291
- package/src/account/KeylessAccountCommon.ts +329 -0
- package/src/account/MultiKeyAccount.ts +4 -4
- package/src/account/index.ts +2 -0
- package/src/api/account.ts +31 -4
- package/src/api/keyless.ts +50 -4
- package/src/bcs/serializable/moveStructs.ts +41 -8
- package/src/cli/move.ts +1 -1
- package/src/core/crypto/federatedKeyless.ts +134 -0
- package/src/core/crypto/index.ts +1 -0
- package/src/core/crypto/singleKey.ts +6 -0
- package/src/internal/account.ts +6 -5
- package/src/internal/event.ts +10 -3
- package/src/internal/keyless.ts +86 -8
- package/src/internal/transactionSubmission.ts +2 -2
- package/src/transactions/instances/transactionPayload.ts +3 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +25 -14
- package/src/transactions/types.ts +4 -2
- package/src/types/index.ts +2 -0
- package/src/utils/apiEndpoints.ts +2 -2
- package/src/utils/const.ts +1 -0
- package/src/utils/helpers.ts +70 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-J4IUXT5W.js +0 -2
- package/dist/common/chunk-J4IUXT5W.js.map +0 -1
- package/dist/esm/chunk-4SDUQ7AS.mjs +0 -2
- package/dist/esm/chunk-4SDUQ7AS.mjs.map +0 -1
- package/dist/esm/chunk-4ZMI5G5L.mjs +0 -2
- package/dist/esm/chunk-76OH2Z4Q.mjs +0 -2
- package/dist/esm/chunk-7Z6DYLCA.mjs +0 -1
- package/dist/esm/chunk-AQ4I7VVB.mjs +0 -1
- package/dist/esm/chunk-BOYYQAB4.mjs +0 -2
- package/dist/esm/chunk-EZIF26UH.mjs +0 -2
- package/dist/esm/chunk-EZIF26UH.mjs.map +0 -1
- package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
- package/dist/esm/chunk-F7NVDHR2.mjs.map +0 -1
- package/dist/esm/chunk-GXTEJ7NO.mjs +0 -2
- package/dist/esm/chunk-H6YNXJNF.mjs +0 -2
- package/dist/esm/chunk-HHU7UCFI.mjs.map +0 -1
- package/dist/esm/chunk-KMJ6TF6Y.mjs +0 -2
- package/dist/esm/chunk-KMJ6TF6Y.mjs.map +0 -1
- package/dist/esm/chunk-L36ZHC7J.mjs +0 -2
- package/dist/esm/chunk-L36ZHC7J.mjs.map +0 -1
- package/dist/esm/chunk-LDTF3ABK.mjs +0 -2
- package/dist/esm/chunk-LDTF3ABK.mjs.map +0 -1
- package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
- package/dist/esm/chunk-MLDQ2TY2.mjs +0 -2
- package/dist/esm/chunk-MQGW234H.mjs +0 -2
- package/dist/esm/chunk-NU55IEL4.mjs +0 -2
- package/dist/esm/chunk-NU55IEL4.mjs.map +0 -1
- package/dist/esm/chunk-P5V7OZNN.mjs +0 -2
- package/dist/esm/chunk-Q67DUNMI.mjs +0 -2
- package/dist/esm/chunk-Q7MD4V7H.mjs +0 -2
- package/dist/esm/chunk-QV6EZL2G.mjs +0 -2
- package/dist/esm/chunk-RA3YPQG2.mjs +0 -2
- package/dist/esm/chunk-RA3YPQG2.mjs.map +0 -1
- package/dist/esm/chunk-TDGQGILY.mjs +0 -2
- package/dist/esm/chunk-THRXIXIO.mjs +0 -2
- package/dist/esm/chunk-THRXIXIO.mjs.map +0 -1
- package/dist/esm/chunk-WABFFJGI.mjs +0 -2
- package/dist/esm/chunk-WABFFJGI.mjs.map +0 -1
- package/dist/esm/chunk-WHW4Z7TK.mjs +0 -2
- package/dist/esm/chunk-WHW4Z7TK.mjs.map +0 -1
- package/dist/esm/chunk-Y3HLYCF3.mjs +0 -2
- package/dist/esm/chunk-YPHH6CAO.mjs +0 -2
- package/dist/esm/chunk-YUNDX5I7.mjs +0 -2
- package/dist/esm/chunk-YXITAP46.mjs +0 -2
- package/dist/esm/chunk-YXITAP46.mjs.map +0 -1
- package/dist/esm/chunk-YY2XW5R4.mjs +0 -2
- package/dist/esm/chunk-YY2XW5R4.mjs.map +0 -1
- package/dist/esm/chunk-ZEYOFDIO.mjs +0 -2
- package/dist/esm/chunk-ZOMXBB6Z.mjs +0 -2
- package/dist/esm/chunk-ZOMXBB6Z.mjs.map +0 -1
- /package/dist/esm/{chunk-7Z6DYLCA.mjs.map → account/FederatedKeylessAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-AQ4I7VVB.mjs.map → account/KeylessAccountCommon.mjs.map} +0 -0
- /package/dist/esm/{chunk-QE5OL6KN.mjs.map → chunk-2MDJ763P.mjs.map} +0 -0
- /package/dist/esm/{chunk-WFOYGJS5.mjs.map → chunk-2Z6HETKH.mjs.map} +0 -0
- /package/dist/esm/{chunk-G5MGSV7Y.mjs.map → chunk-3CE63FFN.mjs.map} +0 -0
- /package/dist/esm/{chunk-TDGQGILY.mjs.map → chunk-3TSO6PDV.mjs.map} +0 -0
- /package/dist/esm/{chunk-2N2VEGT6.mjs.map → chunk-3XX3675G.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZXYTLPP6.mjs.map → chunk-4I6IUAHQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-UV7M72QD.mjs.map → chunk-4QVGK2KD.mjs.map} +0 -0
- /package/dist/esm/{chunk-SUJLWCRN.mjs.map → chunk-5FPWLBZT.mjs.map} +0 -0
- /package/dist/esm/{chunk-YUNDX5I7.mjs.map → chunk-5HI4R3A2.mjs.map} +0 -0
- /package/dist/esm/{chunk-AYX5JMB4.mjs.map → chunk-5HWJ3SN4.mjs.map} +0 -0
- /package/dist/esm/{chunk-3SPU4V2B.mjs.map → chunk-5RNKD3GW.mjs.map} +0 -0
- /package/dist/esm/{chunk-7Y3MRBG6.mjs.map → chunk-6LC7ZJEI.mjs.map} +0 -0
- /package/dist/esm/{chunk-76HTG7Z7.mjs.map → chunk-7BPKOPP7.mjs.map} +0 -0
- /package/dist/esm/{chunk-HRIYZBXY.mjs.map → chunk-ADLWXCGV.mjs.map} +0 -0
- /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
- /package/dist/esm/{chunk-GNFEBKFV.mjs.map → chunk-AT2A7OZD.mjs.map} +0 -0
- /package/dist/esm/{chunk-A4T373F3.mjs.map → chunk-AWQNX3RT.mjs.map} +0 -0
- /package/dist/esm/{chunk-NWOMSL6K.mjs.map → chunk-AZ642ORV.mjs.map} +0 -0
- /package/dist/esm/{chunk-52KPINA4.mjs.map → chunk-B5NYEWNM.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q67DUNMI.mjs.map → chunk-BC5BEOKM.mjs.map} +0 -0
- /package/dist/esm/{chunk-G7UNU5GI.mjs.map → chunk-BQPQLOIW.mjs.map} +0 -0
- /package/dist/esm/{chunk-P5V7OZNN.mjs.map → chunk-CDIKSNSU.mjs.map} +0 -0
- /package/dist/esm/{chunk-7AIKM3UF.mjs.map → chunk-CSNIVFPZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-3NRBTP3S.mjs.map → chunk-E2WOZVJX.mjs.map} +0 -0
- /package/dist/esm/{chunk-H33YIMTU.mjs.map → chunk-E5LYYWAS.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZQFFRZJ4.mjs.map → chunk-ELPTV7ZG.mjs.map} +0 -0
- /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
- /package/dist/esm/{chunk-UWPO7WWS.mjs.map → chunk-FDD6WNN6.mjs.map} +0 -0
- /package/dist/esm/{chunk-6ERHGCK2.mjs.map → chunk-FDTLBR6D.mjs.map} +0 -0
- /package/dist/esm/{chunk-76OH2Z4Q.mjs.map → chunk-FOLCONSQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-5IUXBOS5.mjs.map → chunk-FTBXTZM2.mjs.map} +0 -0
- /package/dist/esm/{chunk-UO52TECC.mjs.map → chunk-G6HZPSZ3.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZXPBRVOA.mjs.map → chunk-GKRIMGKW.mjs.map} +0 -0
- /package/dist/esm/{chunk-MEKXPGK7.mjs.map → chunk-GX2II7H4.mjs.map} +0 -0
- /package/dist/esm/{chunk-I5XQKNOK.mjs.map → chunk-H3TJNBHX.mjs.map} +0 -0
- /package/dist/esm/{chunk-USOIC4HO.mjs.map → chunk-J3PN353M.mjs.map} +0 -0
- /package/dist/esm/{chunk-SONTIUAM.mjs.map → chunk-J45FMNYT.mjs.map} +0 -0
- /package/dist/esm/{chunk-NRRADUK4.mjs.map → chunk-KBIYKNM2.mjs.map} +0 -0
- /package/dist/esm/{chunk-T2NJUIOQ.mjs.map → chunk-KSOKGREZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-ORXEFE6X.mjs.map → chunk-LY7ZRAJT.mjs.map} +0 -0
- /package/dist/esm/{chunk-FOHGSNYZ.mjs.map → chunk-MYRN7MDF.mjs.map} +0 -0
- /package/dist/esm/{chunk-PO33LVUF.mjs.map → chunk-MZB3J6CV.mjs.map} +0 -0
- /package/dist/esm/{chunk-MQGW234H.mjs.map → chunk-N6EC72OZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-GXTEJ7NO.mjs.map → chunk-ND23H3AK.mjs.map} +0 -0
- /package/dist/esm/{chunk-JKNTGRSQ.mjs.map → chunk-NGIPNL7N.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZZRSKHWS.mjs.map → chunk-NOVJ2ROD.mjs.map} +0 -0
- /package/dist/esm/{chunk-QV6EZL2G.mjs.map → chunk-OOVNFKA6.mjs.map} +0 -0
- /package/dist/esm/{chunk-OEOUZFHD.mjs.map → chunk-OVI2RY5L.mjs.map} +0 -0
- /package/dist/esm/{chunk-FNT3VLRD.mjs.map → chunk-P4FYT4LC.mjs.map} +0 -0
- /package/dist/esm/{chunk-MLDQ2TY2.mjs.map → chunk-QP2A5ISX.mjs.map} +0 -0
- /package/dist/esm/{chunk-KEN2VRIM.mjs.map → chunk-QQGCMXIV.mjs.map} +0 -0
- /package/dist/esm/{chunk-O4BBULNE.mjs.map → chunk-QTTDBQAJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-6BYVG7H4.mjs.map → chunk-QUTP2ACU.mjs.map} +0 -0
- /package/dist/esm/{chunk-PY4TS34X.mjs.map → chunk-RLGIYYI7.mjs.map} +0 -0
- /package/dist/esm/{chunk-5L3PLK3W.mjs.map → chunk-S3I4THN5.mjs.map} +0 -0
- /package/dist/esm/{chunk-GHKMF253.mjs.map → chunk-S7KCJQOA.mjs.map} +0 -0
- /package/dist/esm/{chunk-WRRQ7L5K.mjs.map → chunk-SHOPSMRK.mjs.map} +0 -0
- /package/dist/esm/{chunk-YDZBU2DJ.mjs.map → chunk-SP4PT77Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-74YFNJ7A.mjs.map → chunk-SYKVA363.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
- /package/dist/esm/{chunk-H6YNXJNF.mjs.map → chunk-TVWAYKEP.mjs.map} +0 -0
- /package/dist/esm/{chunk-CTJX4CUF.mjs.map → chunk-U72MLMGP.mjs.map} +0 -0
- /package/dist/esm/{chunk-BOYYQAB4.mjs.map → chunk-UW5TIZFE.mjs.map} +0 -0
- /package/dist/esm/{chunk-NMD45OTM.mjs.map → chunk-VTEOS4PS.mjs.map} +0 -0
- /package/dist/esm/{chunk-NCWD4NA3.mjs.map → chunk-VVWBJKEA.mjs.map} +0 -0
- /package/dist/esm/{chunk-HKMG3LZX.mjs.map → chunk-YACGA3YS.mjs.map} +0 -0
- /package/dist/esm/{chunk-ECKJI2TV.mjs.map → chunk-YBZI6U43.mjs.map} +0 -0
- /package/dist/esm/{chunk-2CC67KW5.mjs.map → chunk-YSVXROOO.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y3HLYCF3.mjs.map → chunk-ZASN3QQQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-A63SMUOU.mjs.map → chunk-ZZIMFLVT.mjs.map} +0 -0
- /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
package/src/api/account.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
MoveModuleBytecode,
|
|
16
16
|
MoveResource,
|
|
17
17
|
MoveStructId,
|
|
18
|
+
MoveValue,
|
|
18
19
|
OrderByArg,
|
|
19
20
|
PaginationArgs,
|
|
20
21
|
TokenStandardArg,
|
|
@@ -40,10 +41,12 @@ import {
|
|
|
40
41
|
getTransactions,
|
|
41
42
|
lookupOriginalAccountAddress,
|
|
42
43
|
} from "../internal/account";
|
|
43
|
-
import { APTOS_COIN, ProcessorType } from "../utils/const";
|
|
44
|
+
import { APTOS_COIN, APTOS_FA, ProcessorType } from "../utils/const";
|
|
44
45
|
import { AptosConfig } from "./aptosConfig";
|
|
45
46
|
import { waitForIndexerOnVersion } from "./utils";
|
|
46
47
|
import { CurrentFungibleAssetBalancesBoolExp } from "../types/generated/types";
|
|
48
|
+
import { view } from "../internal/view";
|
|
49
|
+
import { isEncodedStruct, parseEncodedStruct } from "../utils";
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
52
|
* A class to query all `Account` related queries on Aptos.
|
|
@@ -428,7 +431,7 @@ export class Account {
|
|
|
428
431
|
accountAddress: AccountAddressInput;
|
|
429
432
|
minimumLedgerVersion?: AnyNumber;
|
|
430
433
|
}): Promise<number> {
|
|
431
|
-
return this.getAccountCoinAmount({ coinType: APTOS_COIN, ...args });
|
|
434
|
+
return this.getAccountCoinAmount({ coinType: APTOS_COIN, faMetadataAddress: APTOS_FA, ...args });
|
|
432
435
|
}
|
|
433
436
|
|
|
434
437
|
/**
|
|
@@ -438,7 +441,8 @@ export class Account {
|
|
|
438
441
|
* const accountCoinAmount = await aptos.getAccountCoinAmount({accountAddress:"0x123", coinType:"0x1::aptos_coin::AptosCoin"})
|
|
439
442
|
*
|
|
440
443
|
* @param args.accountAddress The account address we want to get the total count for
|
|
441
|
-
* @param args.coinType The coin type to query
|
|
444
|
+
* @param args.coinType The coin type to query.
|
|
445
|
+
* Note: faMetadataAddress will automatically fill this in if not provided when migrated to fungible assets
|
|
442
446
|
* @param args.faMetadataAddress The fungible asset metadata address to query.
|
|
443
447
|
* Note: coinType will automatically fill this in if not provided when migrated to fungible assets
|
|
444
448
|
* @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
|
|
@@ -450,12 +454,35 @@ export class Account {
|
|
|
450
454
|
faMetadataAddress?: AccountAddressInput;
|
|
451
455
|
minimumLedgerVersion?: AnyNumber;
|
|
452
456
|
}): Promise<number> {
|
|
457
|
+
const { coinType, faMetadataAddress } = args;
|
|
453
458
|
await waitForIndexerOnVersion({
|
|
454
459
|
config: this.config,
|
|
455
460
|
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
456
461
|
processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,
|
|
457
462
|
});
|
|
458
|
-
|
|
463
|
+
|
|
464
|
+
// Attempt to populate the CoinType field if the FA address is provided.
|
|
465
|
+
// We cannot do this internally due to dependency cycles issue.
|
|
466
|
+
let coinAssetType: MoveStructId | undefined = coinType;
|
|
467
|
+
if (coinType === undefined && faMetadataAddress !== undefined) {
|
|
468
|
+
try {
|
|
469
|
+
const pairedCoinTypeStruct = (
|
|
470
|
+
await view({
|
|
471
|
+
aptosConfig: this.config,
|
|
472
|
+
payload: { function: "0x1::coin::paired_coin", functionArguments: [faMetadataAddress] },
|
|
473
|
+
})
|
|
474
|
+
).at(0) as { vec: MoveValue[] };
|
|
475
|
+
|
|
476
|
+
// Check if the Option has a value, and if so, parse the struct
|
|
477
|
+
if (pairedCoinTypeStruct.vec.length > 0 && isEncodedStruct(pairedCoinTypeStruct.vec[0])) {
|
|
478
|
+
coinAssetType = parseEncodedStruct(pairedCoinTypeStruct.vec[0]);
|
|
479
|
+
}
|
|
480
|
+
} catch (error) {
|
|
481
|
+
/* No paired coin type found */
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
return getAccountCoinAmount({ aptosConfig: this.config, ...args, coinType: coinAssetType });
|
|
459
486
|
}
|
|
460
487
|
|
|
461
488
|
/**
|
package/src/api/keyless.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from "../account";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { Account, EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from "../account";
|
|
5
|
+
import { FederatedKeylessAccount } from "../account/FederatedKeylessAccount";
|
|
6
|
+
import { AccountAddressInput, ZeroKnowledgeSig } from "../core";
|
|
7
|
+
import {
|
|
8
|
+
deriveKeylessAccount,
|
|
9
|
+
getPepper,
|
|
10
|
+
getProof,
|
|
11
|
+
updateFederatedKeylessJwkSetTransaction,
|
|
12
|
+
} from "../internal/keyless";
|
|
13
|
+
import { SimpleTransaction } from "../transactions";
|
|
7
14
|
import { HexInput } from "../types";
|
|
8
15
|
import { AptosConfig } from "./aptosConfig";
|
|
9
16
|
|
|
@@ -52,12 +59,30 @@ export class Keyless {
|
|
|
52
59
|
return getProof({ aptosConfig: this.config, ...args });
|
|
53
60
|
}
|
|
54
61
|
|
|
62
|
+
async deriveKeylessAccount(args: {
|
|
63
|
+
jwt: string;
|
|
64
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
65
|
+
uidKey?: string;
|
|
66
|
+
pepper?: HexInput;
|
|
67
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
68
|
+
}): Promise<KeylessAccount>;
|
|
69
|
+
|
|
70
|
+
async deriveKeylessAccount(args: {
|
|
71
|
+
jwt: string;
|
|
72
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
73
|
+
jwkAddress: AccountAddressInput;
|
|
74
|
+
uidKey?: string;
|
|
75
|
+
pepper?: HexInput;
|
|
76
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
77
|
+
}): Promise<FederatedKeylessAccount>;
|
|
78
|
+
|
|
55
79
|
/**
|
|
56
80
|
* Derives the Keyless Account from the JWT token and corresponding EphemeralKeyPair. It will lookup the pepper from
|
|
57
81
|
* the pepper service if not explicitly provided. It will compute the proof via the proving service. It will ch
|
|
58
82
|
*
|
|
59
83
|
* @param args.jwt JWT token
|
|
60
84
|
* @param args.ephemeralKeyPair the EphemeralKeyPair used to generate the nonce in the JWT token
|
|
85
|
+
* @param args.jwkAddress the where the JWKs used to verify signatures are found. Setting the value derives a FederatedKeylessAccount
|
|
61
86
|
* @param args.uidKey a key in the JWT token to use to set the uidVal in the IdCommitment
|
|
62
87
|
* @param args.pepper the pepper
|
|
63
88
|
* @param args.proofFetchCallback a callback function that if set, the fetch of the proof will be done in the background. Once
|
|
@@ -69,10 +94,31 @@ export class Keyless {
|
|
|
69
94
|
async deriveKeylessAccount(args: {
|
|
70
95
|
jwt: string;
|
|
71
96
|
ephemeralKeyPair: EphemeralKeyPair;
|
|
97
|
+
jwkAddress?: AccountAddressInput;
|
|
72
98
|
uidKey?: string;
|
|
73
99
|
pepper?: HexInput;
|
|
74
100
|
proofFetchCallback?: ProofFetchCallback;
|
|
75
|
-
}): Promise<KeylessAccount> {
|
|
101
|
+
}): Promise<KeylessAccount | FederatedKeylessAccount> {
|
|
76
102
|
return deriveKeylessAccount({ aptosConfig: this.config, ...args });
|
|
77
103
|
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* This installs a set of FederatedJWKs at an address for a given iss.
|
|
107
|
+
*
|
|
108
|
+
* It will fetch the JWK set from the well-known endpoint and update the FederatedJWKs at the sender's address
|
|
109
|
+
* to reflect it.
|
|
110
|
+
*
|
|
111
|
+
* @param args.sender The account that will install the JWKs
|
|
112
|
+
* @param args.iss the iss claim of the federated OIDC provider.
|
|
113
|
+
* @param args.jwksUrl the URL to find the corresponding JWKs. For supported IDP providers this parameter in not necessary.
|
|
114
|
+
*
|
|
115
|
+
* @returns The pending transaction that results from submission.
|
|
116
|
+
*/
|
|
117
|
+
async updateFederatedKeylessJwkSetTransaction(args: {
|
|
118
|
+
sender: Account;
|
|
119
|
+
iss: string;
|
|
120
|
+
jwksUrl?: string;
|
|
121
|
+
}): Promise<SimpleTransaction> {
|
|
122
|
+
return updateFederatedKeylessJwkSetTransaction({ aptosConfig: this.config, ...args });
|
|
123
|
+
}
|
|
78
124
|
}
|
|
@@ -67,13 +67,12 @@ export class MoveVector<T extends Serializable & EntryFunctionArgument>
|
|
|
67
67
|
* @param serializer
|
|
68
68
|
*/
|
|
69
69
|
serializeForScriptFunction(serializer: Serializer): void {
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
throw new Error("Script function arguments only accept u8 vectors");
|
|
70
|
+
// This checks if the type of a non-empty vector is of type other than U8. If so, we use the Serialized
|
|
71
|
+
// transaction argument type to serialize the argument.
|
|
72
|
+
if (this.values[0] !== undefined && !(this.values[0] instanceof U8)) {
|
|
73
|
+
const serialized = new Serialized(this.bcsToBytes());
|
|
74
|
+
serialized.serializeForScriptFunction(serializer);
|
|
75
|
+
return;
|
|
77
76
|
}
|
|
78
77
|
serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U8Vector);
|
|
79
78
|
serializer.serialize(this);
|
|
@@ -225,6 +224,39 @@ export class MoveVector<T extends Serializable & EntryFunctionArgument>
|
|
|
225
224
|
}
|
|
226
225
|
}
|
|
227
226
|
|
|
227
|
+
export class Serialized extends Serializable implements TransactionArgument {
|
|
228
|
+
public readonly value: Uint8Array;
|
|
229
|
+
|
|
230
|
+
constructor(value: HexInput) {
|
|
231
|
+
super();
|
|
232
|
+
this.value = Hex.fromHexInput(value).toUint8Array();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
serialize(serializer: Serializer): void {
|
|
236
|
+
serializer.serializeBytes(this.value);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
serializeForEntryFunction(serializer: Serializer): void {
|
|
240
|
+
this.serialize(serializer);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
serializeForScriptFunction(serializer: Serializer): void {
|
|
244
|
+
serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Serialized);
|
|
245
|
+
this.serialize(serializer);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
static deserialize(deserializer: Deserializer): Serialized {
|
|
249
|
+
return new Serialized(deserializer.deserializeBytes());
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
toMoveVector<T extends Serializable & EntryFunctionArgument>(cls: Deserializable<T>): MoveVector<T> {
|
|
253
|
+
const deserializer = new Deserializer(this.bcsToBytes());
|
|
254
|
+
deserializer.deserializeUleb128AsU32();
|
|
255
|
+
const vec = deserializer.deserializeVector(cls);
|
|
256
|
+
return new MoveVector(vec);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
228
260
|
export class MoveString extends Serializable implements TransactionArgument {
|
|
229
261
|
public value: string;
|
|
230
262
|
|
|
@@ -244,7 +276,8 @@ export class MoveString extends Serializable implements TransactionArgument {
|
|
|
244
276
|
|
|
245
277
|
serializeForScriptFunction(serializer: Serializer): void {
|
|
246
278
|
// Serialize the string as a fixed byte string, i.e., without the length prefix
|
|
247
|
-
const
|
|
279
|
+
const textEncoder = new TextEncoder();
|
|
280
|
+
const fixedStringBytes = textEncoder.encode(this.value);
|
|
248
281
|
// Put those bytes into a vector<u8> and serialize it as a script function argument
|
|
249
282
|
const vectorU8 = MoveVector.U8(fixedStringBytes);
|
|
250
283
|
vectorU8.serializeForScriptFunction(serializer);
|
package/src/cli/move.ts
CHANGED
|
@@ -425,7 +425,7 @@ export class Move {
|
|
|
425
425
|
*/
|
|
426
426
|
// eslint-disable-next-line class-methods-use-this
|
|
427
427
|
private extractAddressFromOutput(output: string): string {
|
|
428
|
-
const match = output.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)
|
|
428
|
+
const match = output.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)");
|
|
429
429
|
if (match) {
|
|
430
430
|
return match[1];
|
|
431
431
|
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { AccountPublicKey, PublicKey } from "./publicKey";
|
|
5
|
+
import { Deserializer, Serializer } from "../../bcs";
|
|
6
|
+
import { Hex } from "../hex";
|
|
7
|
+
import { HexInput, AnyPublicKeyVariant, SigningScheme } from "../../types";
|
|
8
|
+
import { AuthenticationKey } from "../authenticationKey";
|
|
9
|
+
import { AccountAddress, AccountAddressInput } from "../accountAddress";
|
|
10
|
+
import { KeylessPublicKey, KeylessSignature } from "./keyless";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Represents the FederatedKeylessPublicKey public key
|
|
14
|
+
*
|
|
15
|
+
* These keys use an onchain address as a source of truth for the JWK used to verify signatures.
|
|
16
|
+
*
|
|
17
|
+
* FederatedKeylessPublicKey authentication key is represented in the SDK as `AnyPublicKey`.
|
|
18
|
+
*/
|
|
19
|
+
export class FederatedKeylessPublicKey extends AccountPublicKey {
|
|
20
|
+
/**
|
|
21
|
+
* The address that contains the JWK set to be used for verification.
|
|
22
|
+
*/
|
|
23
|
+
readonly jwkAddress: AccountAddress;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The inner public key which contains the standard Keyless public key.
|
|
27
|
+
*/
|
|
28
|
+
readonly keylessPublicKey: KeylessPublicKey;
|
|
29
|
+
|
|
30
|
+
constructor(jwkAddress: AccountAddressInput, keylessPublicKey: KeylessPublicKey) {
|
|
31
|
+
super();
|
|
32
|
+
this.jwkAddress = AccountAddress.from(jwkAddress);
|
|
33
|
+
this.keylessPublicKey = keylessPublicKey;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Get the authentication key for the federated keyless public key
|
|
38
|
+
*
|
|
39
|
+
* @returns AuthenticationKey
|
|
40
|
+
*/
|
|
41
|
+
authKey(): AuthenticationKey {
|
|
42
|
+
const serializer = new Serializer();
|
|
43
|
+
serializer.serializeU32AsUleb128(AnyPublicKeyVariant.FederatedKeyless);
|
|
44
|
+
serializer.serializeFixedBytes(this.bcsToBytes());
|
|
45
|
+
return AuthenticationKey.fromSchemeAndBytes({
|
|
46
|
+
scheme: SigningScheme.SingleKey,
|
|
47
|
+
input: serializer.toUint8Array(),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get the public key in bytes (Uint8Array).
|
|
53
|
+
*
|
|
54
|
+
* @returns Uint8Array representation of the public key
|
|
55
|
+
*/
|
|
56
|
+
toUint8Array(): Uint8Array {
|
|
57
|
+
return this.bcsToBytes();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get the public key as a hex string with the 0x prefix.
|
|
62
|
+
*
|
|
63
|
+
* @returns string representation of the public key
|
|
64
|
+
*/
|
|
65
|
+
toString(): string {
|
|
66
|
+
return Hex.fromHexInput(this.toUint8Array()).toString();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Verifies a signed data with a public key
|
|
71
|
+
*
|
|
72
|
+
* @param args.message message
|
|
73
|
+
* @param args.signature The signature
|
|
74
|
+
* @returns true if the signature is valid
|
|
75
|
+
*/
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
|
|
77
|
+
verifySignature(args: { message: HexInput; signature: KeylessSignature }): boolean {
|
|
78
|
+
throw new Error("Not yet implemented");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
serialize(serializer: Serializer): void {
|
|
82
|
+
this.jwkAddress.serialize(serializer);
|
|
83
|
+
this.keylessPublicKey.serialize(serializer);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static deserialize(deserializer: Deserializer): FederatedKeylessPublicKey {
|
|
87
|
+
const jwkAddress = AccountAddress.deserialize(deserializer);
|
|
88
|
+
const keylessPublicKey = KeylessPublicKey.deserialize(deserializer);
|
|
89
|
+
return new FederatedKeylessPublicKey(jwkAddress, keylessPublicKey);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static isPublicKey(publicKey: PublicKey): publicKey is FederatedKeylessPublicKey {
|
|
93
|
+
return publicKey instanceof FederatedKeylessPublicKey;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Creates a FederatedKeylessPublicKey from the JWT components plus pepper
|
|
98
|
+
*
|
|
99
|
+
* @param args.iss the iss of the identity
|
|
100
|
+
* @param args.uidKey the key to use to get the uidVal in the JWT token
|
|
101
|
+
* @param args.uidVal the value of the uidKey in the JWT token
|
|
102
|
+
* @param args.aud the client ID of the application
|
|
103
|
+
* @param args.pepper The pepper used to maintain privacy of the account
|
|
104
|
+
* @returns FederatedKeylessPublicKey
|
|
105
|
+
*/
|
|
106
|
+
static create(args: {
|
|
107
|
+
iss: string;
|
|
108
|
+
uidKey: string;
|
|
109
|
+
uidVal: string;
|
|
110
|
+
aud: string;
|
|
111
|
+
pepper: HexInput;
|
|
112
|
+
jwkAddress: AccountAddressInput;
|
|
113
|
+
}): FederatedKeylessPublicKey {
|
|
114
|
+
return new FederatedKeylessPublicKey(args.jwkAddress, KeylessPublicKey.create(args));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static fromJwtAndPepper(args: {
|
|
118
|
+
jwt: string;
|
|
119
|
+
pepper: HexInput;
|
|
120
|
+
jwkAddress: AccountAddressInput;
|
|
121
|
+
uidKey?: string;
|
|
122
|
+
}): FederatedKeylessPublicKey {
|
|
123
|
+
return new FederatedKeylessPublicKey(args.jwkAddress, KeylessPublicKey.fromJwtAndPepper(args));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
static isInstance(publicKey: PublicKey) {
|
|
127
|
+
return (
|
|
128
|
+
"jwkAddress" in publicKey &&
|
|
129
|
+
publicKey.jwkAddress instanceof AccountAddress &&
|
|
130
|
+
"keylessPublicKey" in publicKey &&
|
|
131
|
+
publicKey.keylessPublicKey instanceof KeylessPublicKey
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
package/src/core/crypto/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { AccountPublicKey, PublicKey, VerifySignatureArgs } from "./publicKey";
|
|
|
6
6
|
import { Secp256k1PublicKey, Secp256k1Signature } from "./secp256k1";
|
|
7
7
|
import { KeylessPublicKey, KeylessSignature } from "./keyless";
|
|
8
8
|
import { Signature } from "./signature";
|
|
9
|
+
import { FederatedKeylessPublicKey } from "./federatedKeyless";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Represents any public key supported by Aptos.
|
|
@@ -37,6 +38,8 @@ export class AnyPublicKey extends AccountPublicKey {
|
|
|
37
38
|
this.variant = AnyPublicKeyVariant.Secp256k1;
|
|
38
39
|
} else if (publicKey instanceof KeylessPublicKey) {
|
|
39
40
|
this.variant = AnyPublicKeyVariant.Keyless;
|
|
41
|
+
} else if (publicKey instanceof FederatedKeylessPublicKey) {
|
|
42
|
+
this.variant = AnyPublicKeyVariant.FederatedKeyless;
|
|
40
43
|
} else {
|
|
41
44
|
throw new Error("Unsupported public key type");
|
|
42
45
|
}
|
|
@@ -91,6 +94,9 @@ export class AnyPublicKey extends AccountPublicKey {
|
|
|
91
94
|
case AnyPublicKeyVariant.Keyless:
|
|
92
95
|
publicKey = KeylessPublicKey.deserialize(deserializer);
|
|
93
96
|
break;
|
|
97
|
+
case AnyPublicKeyVariant.FederatedKeyless:
|
|
98
|
+
publicKey = FederatedKeylessPublicKey.deserialize(deserializer);
|
|
99
|
+
break;
|
|
94
100
|
default:
|
|
95
101
|
throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);
|
|
96
102
|
}
|
package/src/internal/account.ts
CHANGED
|
@@ -409,26 +409,27 @@ export async function getAccountCoinAmount(args: {
|
|
|
409
409
|
faMetadataAddress?: AccountAddressInput;
|
|
410
410
|
}): Promise<number> {
|
|
411
411
|
const { aptosConfig, accountAddress, coinType, faMetadataAddress } = args;
|
|
412
|
-
|
|
412
|
+
|
|
413
|
+
let coinAssetType: string | undefined = coinType;
|
|
413
414
|
let faAddress: string;
|
|
414
415
|
|
|
415
416
|
if (coinType !== undefined && faMetadataAddress !== undefined) {
|
|
416
417
|
faAddress = AccountAddress.from(faMetadataAddress).toStringLong();
|
|
417
418
|
} else if (coinType !== undefined && faMetadataAddress === undefined) {
|
|
418
|
-
coinAssetType = coinType;
|
|
419
419
|
// TODO Move to a separate function as defined in the AIP for coin migration
|
|
420
|
-
if (
|
|
420
|
+
if (coinType === APTOS_COIN) {
|
|
421
421
|
faAddress = AccountAddress.A.toStringLong();
|
|
422
422
|
} else {
|
|
423
423
|
faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();
|
|
424
424
|
}
|
|
425
425
|
} else if (coinType === undefined && faMetadataAddress !== undefined) {
|
|
426
|
-
// TODO: add a view function lookup for non-APT migrated coins
|
|
427
426
|
const addr = AccountAddress.from(faMetadataAddress);
|
|
428
427
|
faAddress = addr.toStringLong();
|
|
429
428
|
if (addr === AccountAddress.A) {
|
|
430
429
|
coinAssetType = APTOS_COIN;
|
|
431
430
|
}
|
|
431
|
+
// The paired CoinType should be populated outside of this function in another
|
|
432
|
+
// async call. We cannot do this internally due to dependency cycles issue.
|
|
432
433
|
} else {
|
|
433
434
|
throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");
|
|
434
435
|
}
|
|
@@ -436,7 +437,7 @@ export async function getAccountCoinAmount(args: {
|
|
|
436
437
|
|
|
437
438
|
// Search by fungible asset address, unless it has a coin it migrated from
|
|
438
439
|
let where: any = { asset_type: { _eq: faAddress } };
|
|
439
|
-
if (
|
|
440
|
+
if (coinAssetType !== undefined) {
|
|
440
441
|
where = { asset_type: { _in: [coinAssetType, faAddress] } };
|
|
441
442
|
}
|
|
442
443
|
|
package/src/internal/event.ts
CHANGED
|
@@ -31,9 +31,16 @@ export async function getModuleEventsByEventType(args: {
|
|
|
31
31
|
const { aptosConfig, eventType, options } = args;
|
|
32
32
|
|
|
33
33
|
const whereCondition: EventsBoolExp = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
_or: [
|
|
35
|
+
// EventHandle events
|
|
36
|
+
{ account_address: { _eq: eventType.split("::")[0] } },
|
|
37
|
+
// Module events
|
|
38
|
+
{
|
|
39
|
+
account_address: { _eq: "0x0000000000000000000000000000000000000000000000000000000000000000" },
|
|
40
|
+
sequence_number: { _eq: 0 },
|
|
41
|
+
creation_number: { _eq: 0 },
|
|
42
|
+
},
|
|
43
|
+
],
|
|
37
44
|
indexed_type: { _eq: eventType },
|
|
38
45
|
};
|
|
39
46
|
|
package/src/internal/keyless.ts
CHANGED
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* other namespaces and processes can access these methods without depending on the entire
|
|
8
8
|
* keyless namespace and without having a dependency cycle error.
|
|
9
9
|
*/
|
|
10
|
+
import { jwtDecode, JwtPayload } from "jwt-decode";
|
|
10
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
11
12
|
import { postAptosPepperService, postAptosProvingService } from "../client";
|
|
12
13
|
import {
|
|
14
|
+
AccountAddressInput,
|
|
13
15
|
EphemeralSignature,
|
|
14
16
|
Groth16Zkp,
|
|
15
17
|
Hex,
|
|
@@ -19,10 +21,14 @@ import {
|
|
|
19
21
|
getKeylessConfig,
|
|
20
22
|
} from "../core";
|
|
21
23
|
import { HexInput, ZkpVariant } from "../types";
|
|
22
|
-
import { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from "../account";
|
|
24
|
+
import { Account, EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from "../account";
|
|
23
25
|
import { PepperFetchRequest, PepperFetchResponse, ProverRequest, ProverResponse } from "../types/keyless";
|
|
24
|
-
import { nowInSeconds } from "../utils/helpers";
|
|
25
26
|
import { lookupOriginalAccountAddress } from "./account";
|
|
27
|
+
import { FederatedKeylessPublicKey } from "../core/crypto/federatedKeyless";
|
|
28
|
+
import { FederatedKeylessAccount } from "../account/FederatedKeylessAccount";
|
|
29
|
+
import { MoveVector } from "../bcs";
|
|
30
|
+
import { generateTransaction } from "./transactionSubmission";
|
|
31
|
+
import { SimpleTransaction } from "../transactions";
|
|
26
32
|
|
|
27
33
|
export async function getPepper(args: {
|
|
28
34
|
aptosConfig: AptosConfig;
|
|
@@ -63,7 +69,7 @@ export async function getProof(args: {
|
|
|
63
69
|
throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);
|
|
64
70
|
}
|
|
65
71
|
const { maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });
|
|
66
|
-
if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs -
|
|
72
|
+
if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs - jwtDecode<JwtPayload>(jwt).iat!) {
|
|
67
73
|
throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${maxExpHorizonSecs}`);
|
|
68
74
|
}
|
|
69
75
|
const json = {
|
|
@@ -76,6 +82,8 @@ export async function getProof(args: {
|
|
|
76
82
|
uid_key: uidKey,
|
|
77
83
|
};
|
|
78
84
|
|
|
85
|
+
console.log(JSON.stringify(json))
|
|
86
|
+
|
|
79
87
|
const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({
|
|
80
88
|
aptosConfig,
|
|
81
89
|
path: "prove",
|
|
@@ -84,6 +92,8 @@ export async function getProof(args: {
|
|
|
84
92
|
overrides: { WITH_CREDENTIALS: false },
|
|
85
93
|
});
|
|
86
94
|
|
|
95
|
+
console.log(JSON.stringify(data))
|
|
96
|
+
|
|
87
97
|
const proofPoints = data.proof;
|
|
88
98
|
const groth16Zkp = new Groth16Zkp({
|
|
89
99
|
a: proofPoints.a,
|
|
@@ -106,8 +116,28 @@ export async function deriveKeylessAccount(args: {
|
|
|
106
116
|
uidKey?: string;
|
|
107
117
|
pepper?: HexInput;
|
|
108
118
|
proofFetchCallback?: ProofFetchCallback;
|
|
109
|
-
}): Promise<KeylessAccount
|
|
110
|
-
|
|
119
|
+
}): Promise<KeylessAccount>;
|
|
120
|
+
|
|
121
|
+
export async function deriveKeylessAccount(args: {
|
|
122
|
+
aptosConfig: AptosConfig;
|
|
123
|
+
jwt: string;
|
|
124
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
125
|
+
jwkAddress: AccountAddressInput;
|
|
126
|
+
uidKey?: string;
|
|
127
|
+
pepper?: HexInput;
|
|
128
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
129
|
+
}): Promise<FederatedKeylessAccount>;
|
|
130
|
+
|
|
131
|
+
export async function deriveKeylessAccount(args: {
|
|
132
|
+
aptosConfig: AptosConfig;
|
|
133
|
+
jwt: string;
|
|
134
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
135
|
+
jwkAddress?: AccountAddressInput;
|
|
136
|
+
uidKey?: string;
|
|
137
|
+
pepper?: HexInput;
|
|
138
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
139
|
+
}): Promise<KeylessAccount | FederatedKeylessAccount> {
|
|
140
|
+
const { aptosConfig, jwt, jwkAddress, uidKey, proofFetchCallback, pepper = await getPepper(args) } = args;
|
|
111
141
|
const proofPromise = getProof({ ...args, pepper });
|
|
112
142
|
// If a callback is provided, pass in the proof as a promise to KeylessAccount.create. This will make the proof be fetched in the
|
|
113
143
|
// background and the callback will handle the outcome of the fetch. This allows the developer to not have to block on the proof fetch
|
|
@@ -116,14 +146,62 @@ export async function deriveKeylessAccount(args: {
|
|
|
116
146
|
// If no callback is provided, the just await the proof fetch and continue syncronously.
|
|
117
147
|
const proof = proofFetchCallback ? proofPromise : await proofPromise;
|
|
118
148
|
|
|
119
|
-
// Look up the original address to handle key rotations
|
|
149
|
+
// Look up the original address to handle key rotations and then instantiate the account.
|
|
150
|
+
if (jwkAddress !== undefined) {
|
|
151
|
+
const publicKey = FederatedKeylessPublicKey.fromJwtAndPepper({ jwt, pepper, jwkAddress, uidKey });
|
|
152
|
+
const address = await lookupOriginalAccountAddress({
|
|
153
|
+
aptosConfig,
|
|
154
|
+
authenticationKey: publicKey.authKey().derivedAddress(),
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
return FederatedKeylessAccount.create({ ...args, address, proof, pepper, proofFetchCallback, jwkAddress });
|
|
158
|
+
}
|
|
159
|
+
|
|
120
160
|
const publicKey = KeylessPublicKey.fromJwtAndPepper({ jwt, pepper, uidKey });
|
|
121
161
|
const address = await lookupOriginalAccountAddress({
|
|
122
162
|
aptosConfig,
|
|
123
163
|
authenticationKey: publicKey.authKey().derivedAddress(),
|
|
124
164
|
});
|
|
165
|
+
return KeylessAccount.create({ ...args, address, proof, pepper, proofFetchCallback });
|
|
166
|
+
}
|
|
125
167
|
|
|
126
|
-
|
|
168
|
+
interface JWK {
|
|
169
|
+
kty: string; // Key type
|
|
170
|
+
kid: string; // Key ID
|
|
171
|
+
alg: string; // Algorithm used with the key
|
|
172
|
+
n: string; // Modulus (for RSA keys)
|
|
173
|
+
e: string; // Exponent (for RSA keys)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface JWKS {
|
|
177
|
+
keys: JWK[];
|
|
178
|
+
}
|
|
127
179
|
|
|
128
|
-
|
|
180
|
+
export async function updateFederatedKeylessJwkSetTransaction(args: {
|
|
181
|
+
aptosConfig: AptosConfig;
|
|
182
|
+
sender: Account;
|
|
183
|
+
iss: string;
|
|
184
|
+
jwksUrl?: string;
|
|
185
|
+
}): Promise<SimpleTransaction> {
|
|
186
|
+
const { aptosConfig, sender, iss } = args;
|
|
187
|
+
const jwksUrl = args.jwksUrl ?? (iss.endsWith("/") ? `${iss}.well-known/jwks.json` : `${iss}/.well-known/jwks.json`);
|
|
188
|
+
const response = await fetch(jwksUrl);
|
|
189
|
+
if (!response.ok) {
|
|
190
|
+
throw new Error(`Failed to fetch JWKS: ${response.status} ${response.statusText}`);
|
|
191
|
+
}
|
|
192
|
+
const jwks: JWKS = await response.json();
|
|
193
|
+
return generateTransaction({
|
|
194
|
+
aptosConfig,
|
|
195
|
+
sender: sender.accountAddress,
|
|
196
|
+
data: {
|
|
197
|
+
function: "0x1::jwks::update_federated_jwk_set",
|
|
198
|
+
functionArguments: [
|
|
199
|
+
iss,
|
|
200
|
+
MoveVector.MoveString(jwks.keys.map((key) => key.kid)),
|
|
201
|
+
MoveVector.MoveString(jwks.keys.map((key) => key.alg)),
|
|
202
|
+
MoveVector.MoveString(jwks.keys.map((key) => key.e)),
|
|
203
|
+
MoveVector.MoveString(jwks.keys.map((key) => key.n)),
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
});
|
|
129
207
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { AptosConfig } from "../api/aptosConfig";
|
|
9
9
|
import { MoveVector, U8 } from "../bcs";
|
|
10
10
|
import { postAptosFullNode } from "../client";
|
|
11
|
-
import { Account,
|
|
11
|
+
import { Account, KeylessAccountCommon, MultiKeyAccount } from "../account";
|
|
12
12
|
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
13
13
|
import { PrivateKey } from "../core/crypto";
|
|
14
14
|
import { AccountAuthenticator } from "../transactions/authenticator/account";
|
|
@@ -277,7 +277,7 @@ export async function signAndSubmitTransaction(args: {
|
|
|
277
277
|
const { aptosConfig, signer, transaction } = args;
|
|
278
278
|
// If the signer contains a KeylessAccount, await proof fetching in case the proof
|
|
279
279
|
// was fetched asyncronously.
|
|
280
|
-
if (signer instanceof
|
|
280
|
+
if (signer instanceof KeylessAccountCommon || signer instanceof MultiKeyAccount) {
|
|
281
281
|
await signer.waitForProofFetch();
|
|
282
282
|
}
|
|
283
283
|
const authenticator = signTransaction({ signer, transaction });
|
|
@@ -7,7 +7,7 @@ import { Deserializer } from "../../bcs/deserializer";
|
|
|
7
7
|
import { Serializable, Serializer } from "../../bcs/serializer";
|
|
8
8
|
import { EntryFunctionBytes } from "../../bcs/serializable/entryFunctionBytes";
|
|
9
9
|
import { Bool, U128, U16, U256, U32, U64, U8 } from "../../bcs/serializable/movePrimitives";
|
|
10
|
-
import { MoveVector } from "../../bcs/serializable/moveStructs";
|
|
10
|
+
import { MoveVector, Serialized } from "../../bcs/serializable/moveStructs";
|
|
11
11
|
import { AccountAddress } from "../../core";
|
|
12
12
|
import { Identifier } from "./identifier";
|
|
13
13
|
import { ModuleId } from "./moduleId";
|
|
@@ -40,6 +40,8 @@ export function deserializeFromScriptArgument(deserializer: Deserializer): Trans
|
|
|
40
40
|
return U32.deserialize(deserializer);
|
|
41
41
|
case ScriptTransactionArgumentVariants.U256:
|
|
42
42
|
return U256.deserialize(deserializer);
|
|
43
|
+
case ScriptTransactionArgumentVariants.Serialized:
|
|
44
|
+
return Serialized.deserialize(deserializer);
|
|
43
45
|
default:
|
|
44
46
|
throw new Error(`Unknown variant index for ScriptTransactionArgument: ${index}`);
|
|
45
47
|
}
|