@buildonspark/issuer-sdk 0.0.22 → 0.0.23
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/chunk-GB7N6I5O.js +48 -0
- package/dist/index.cjs +518 -0
- package/dist/index.d.cts +110 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +497 -0
- package/dist/types.cjs +77 -0
- package/dist/types.d.cts +99 -0
- package/dist/{issuer-sdk/src/types.d.ts → types.d.ts} +14 -12
- package/dist/types.js +12 -0
- package/package.json +31 -32
- package/src/examples/example.ts +1 -1
- package/src/index.ts +1 -0
- package/src/interface/wallet-interface.ts +7 -6
- package/src/{issuer-sdk.ts → issuer-spark-wallet.ts} +5 -5
- package/src/tests/integration/spark.test.ts +3 -12
- package/src/types.ts +1 -2
- package/src/utils/constants.ts +2 -2
- package/dist/issuer-sdk/src/interface/wallet-interface.d.ts +0 -67
- package/dist/issuer-sdk/src/interface/wallet-interface.js +0 -2
- package/dist/issuer-sdk/src/interface/wallet-interface.js.map +0 -1
- package/dist/issuer-sdk/src/issuer-sdk.d.ts +0 -43
- package/dist/issuer-sdk/src/issuer-sdk.js +0 -153
- package/dist/issuer-sdk/src/issuer-sdk.js.map +0 -1
- package/dist/issuer-sdk/src/proto/common.d.ts +0 -58
- package/dist/issuer-sdk/src/proto/common.js +0 -350
- package/dist/issuer-sdk/src/proto/common.js.map +0 -1
- package/dist/issuer-sdk/src/proto/google/protobuf/descriptor.d.ts +0 -1228
- package/dist/issuer-sdk/src/proto/google/protobuf/descriptor.js +0 -5070
- package/dist/issuer-sdk/src/proto/google/protobuf/descriptor.js.map +0 -1
- package/dist/issuer-sdk/src/proto/google/protobuf/duration.d.ts +0 -99
- package/dist/issuer-sdk/src/proto/google/protobuf/duration.js +0 -90
- package/dist/issuer-sdk/src/proto/google/protobuf/duration.js.map +0 -1
- package/dist/issuer-sdk/src/proto/google/protobuf/empty.d.ts +0 -33
- package/dist/issuer-sdk/src/proto/google/protobuf/empty.js +0 -46
- package/dist/issuer-sdk/src/proto/google/protobuf/empty.js.map +0 -1
- package/dist/issuer-sdk/src/proto/google/protobuf/timestamp.d.ts +0 -128
- package/dist/issuer-sdk/src/proto/google/protobuf/timestamp.js +0 -90
- package/dist/issuer-sdk/src/proto/google/protobuf/timestamp.js.map +0 -1
- package/dist/issuer-sdk/src/proto/mock.d.ts +0 -48
- package/dist/issuer-sdk/src/proto/mock.js +0 -103
- package/dist/issuer-sdk/src/proto/mock.js.map +0 -1
- package/dist/issuer-sdk/src/proto/spark.d.ts +0 -1101
- package/dist/issuer-sdk/src/proto/spark.js +0 -9565
- package/dist/issuer-sdk/src/proto/spark.js.map +0 -1
- package/dist/issuer-sdk/src/proto/spark_authn.d.ts +0 -111
- package/dist/issuer-sdk/src/proto/spark_authn.js +0 -517
- package/dist/issuer-sdk/src/proto/spark_authn.js.map +0 -1
- package/dist/issuer-sdk/src/proto/validate/validate.d.ts +0 -1087
- package/dist/issuer-sdk/src/proto/validate/validate.js +0 -4437
- package/dist/issuer-sdk/src/proto/validate/validate.js.map +0 -1
- package/dist/issuer-sdk/src/services/freeze.d.ts +0 -11
- package/dist/issuer-sdk/src/services/freeze.js +0 -44
- package/dist/issuer-sdk/src/services/freeze.js.map +0 -1
- package/dist/issuer-sdk/src/services/token-transactions.d.ts +0 -8
- package/dist/issuer-sdk/src/services/token-transactions.js +0 -27
- package/dist/issuer-sdk/src/services/token-transactions.js.map +0 -1
- package/dist/issuer-sdk/src/tests/integration/spark.test.d.ts +0 -1
- package/dist/issuer-sdk/src/tests/integration/spark.test.js +0 -373
- package/dist/issuer-sdk/src/tests/integration/spark.test.js.map +0 -1
- package/dist/issuer-sdk/src/types.js +0 -33
- package/dist/issuer-sdk/src/types.js.map +0 -1
- package/dist/issuer-sdk/src/utils/constants.d.ts +0 -16
- package/dist/issuer-sdk/src/utils/constants.js +0 -18
- package/dist/issuer-sdk/src/utils/constants.js.map +0 -1
- package/dist/issuer-sdk/src/utils/enum-mappers.d.ts +0 -6
- package/dist/issuer-sdk/src/utils/enum-mappers.js +0 -66
- package/dist/issuer-sdk/src/utils/enum-mappers.js.map +0 -1
- package/dist/issuer-sdk/src/utils/token-hashing.d.ts +0 -2
- package/dist/issuer-sdk/src/utils/token-hashing.js +0 -45
- package/dist/issuer-sdk/src/utils/token-hashing.js.map +0 -1
- package/dist/issuer-sdk/src/utils/type-mappers.d.ts +0 -4
- package/dist/issuer-sdk/src/utils/type-mappers.js +0 -106
- package/dist/issuer-sdk/src/utils/type-mappers.js.map +0 -1
- package/dist/spark-sdk/src/graphql/client.d.ts +0 -29
- package/dist/spark-sdk/src/graphql/client.js +0 -246
- package/dist/spark-sdk/src/graphql/client.js.map +0 -1
- package/dist/spark-sdk/src/graphql/mutations/CompleteCoopExit.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/mutations/CompleteCoopExit.js +0 -19
- package/dist/spark-sdk/src/graphql/mutations/CompleteCoopExit.js.map +0 -1
- package/dist/spark-sdk/src/graphql/mutations/CompleteLeavesSwap.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/mutations/CompleteLeavesSwap.js +0 -17
- package/dist/spark-sdk/src/graphql/mutations/CompleteLeavesSwap.js.map +0 -1
- package/dist/spark-sdk/src/graphql/mutations/RequestCoopExit.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/mutations/RequestCoopExit.js +0 -20
- package/dist/spark-sdk/src/graphql/mutations/RequestCoopExit.js.map +0 -1
- package/dist/spark-sdk/src/graphql/mutations/RequestLightningReceive.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/mutations/RequestLightningReceive.js +0 -26
- package/dist/spark-sdk/src/graphql/mutations/RequestLightningReceive.js.map +0 -1
- package/dist/spark-sdk/src/graphql/mutations/RequestLightningSend.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/mutations/RequestLightningSend.js +0 -18
- package/dist/spark-sdk/src/graphql/mutations/RequestLightningSend.js.map +0 -1
- package/dist/spark-sdk/src/graphql/mutations/RequestSwapLeaves.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/mutations/RequestSwapLeaves.js +0 -24
- package/dist/spark-sdk/src/graphql/mutations/RequestSwapLeaves.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/BitcoinNetwork.d.ts +0 -17
- package/dist/spark-sdk/src/graphql/objects/BitcoinNetwork.js +0 -20
- package/dist/spark-sdk/src/graphql/objects/BitcoinNetwork.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CompleteCoopExitInput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/CompleteCoopExitInput.js +0 -14
- package/dist/spark-sdk/src/graphql/objects/CompleteCoopExitInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CompleteCoopExitOutput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/CompleteCoopExitOutput.js +0 -19
- package/dist/spark-sdk/src/graphql/objects/CompleteCoopExitOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CompleteLeavesSwapInput.d.ts +0 -8
- package/dist/spark-sdk/src/graphql/objects/CompleteLeavesSwapInput.js +0 -16
- package/dist/spark-sdk/src/graphql/objects/CompleteLeavesSwapInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CompleteLeavesSwapOutput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/CompleteLeavesSwapOutput.js +0 -19
- package/dist/spark-sdk/src/graphql/objects/CompleteLeavesSwapOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CompleteSeedReleaseInput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/CompleteSeedReleaseInput.js +0 -14
- package/dist/spark-sdk/src/graphql/objects/CompleteSeedReleaseInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CompleteSeedReleaseOutput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/CompleteSeedReleaseOutput.js +0 -17
- package/dist/spark-sdk/src/graphql/objects/CompleteSeedReleaseOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/Connection.d.ts +0 -16
- package/dist/spark-sdk/src/graphql/objects/Connection.js +0 -56
- package/dist/spark-sdk/src/graphql/objects/Connection.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CoopExitFeeEstimateInput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/CoopExitFeeEstimateInput.js +0 -14
- package/dist/spark-sdk/src/graphql/objects/CoopExitFeeEstimateInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CoopExitFeeEstimateOutput.d.ts +0 -8
- package/dist/spark-sdk/src/graphql/objects/CoopExitFeeEstimateOutput.js +0 -26
- package/dist/spark-sdk/src/graphql/objects/CoopExitFeeEstimateOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CoopExitRequest.d.ts +0 -35
- package/dist/spark-sdk/src/graphql/objects/CoopExitRequest.js +0 -68
- package/dist/spark-sdk/src/graphql/objects/CoopExitRequest.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CurrencyAmount.d.ts +0 -24
- package/dist/spark-sdk/src/graphql/objects/CurrencyAmount.js +0 -30
- package/dist/spark-sdk/src/graphql/objects/CurrencyAmount.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/CurrencyUnit.d.ts +0 -29
- package/dist/spark-sdk/src/graphql/objects/CurrencyUnit.js +0 -32
- package/dist/spark-sdk/src/graphql/objects/CurrencyUnit.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/Entity.d.ts +0 -16
- package/dist/spark-sdk/src/graphql/objects/Entity.js +0 -169
- package/dist/spark-sdk/src/graphql/objects/Entity.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/GetChallengeInput.d.ts +0 -6
- package/dist/spark-sdk/src/graphql/objects/GetChallengeInput.js +0 -12
- package/dist/spark-sdk/src/graphql/objects/GetChallengeInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/GetChallengeOutput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/GetChallengeOutput.js +0 -17
- package/dist/spark-sdk/src/graphql/objects/GetChallengeOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/Invoice.d.ts +0 -15
- package/dist/spark-sdk/src/graphql/objects/Invoice.js +0 -45
- package/dist/spark-sdk/src/graphql/objects/Invoice.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/Leaf.d.ts +0 -11
- package/dist/spark-sdk/src/graphql/objects/Leaf.js +0 -29
- package/dist/spark-sdk/src/graphql/objects/Leaf.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LeavesSwapFeeEstimateInput.d.ts +0 -6
- package/dist/spark-sdk/src/graphql/objects/LeavesSwapFeeEstimateInput.js +0 -12
- package/dist/spark-sdk/src/graphql/objects/LeavesSwapFeeEstimateInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LeavesSwapFeeEstimateOutput.d.ts +0 -8
- package/dist/spark-sdk/src/graphql/objects/LeavesSwapFeeEstimateOutput.js +0 -26
- package/dist/spark-sdk/src/graphql/objects/LeavesSwapFeeEstimateOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LeavesSwapRequest.d.ts +0 -42
- package/dist/spark-sdk/src/graphql/objects/LeavesSwapRequest.js +0 -123
- package/dist/spark-sdk/src/graphql/objects/LeavesSwapRequest.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveFeeEstimateInput.d.ts +0 -8
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveFeeEstimateInput.js +0 -15
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveFeeEstimateInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveFeeEstimateOutput.d.ts +0 -8
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveFeeEstimateOutput.js +0 -26
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveFeeEstimateOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveRequest.d.ts +0 -34
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveRequest.js +0 -97
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveRequest.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveRequestStatus.d.ts +0 -18
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveRequestStatus.js +0 -21
- package/dist/spark-sdk/src/graphql/objects/LightningReceiveRequestStatus.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LightningSendFeeEstimateInput.d.ts +0 -6
- package/dist/spark-sdk/src/graphql/objects/LightningSendFeeEstimateInput.js +0 -12
- package/dist/spark-sdk/src/graphql/objects/LightningSendFeeEstimateInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LightningSendFeeEstimateOutput.d.ts +0 -8
- package/dist/spark-sdk/src/graphql/objects/LightningSendFeeEstimateOutput.js +0 -26
- package/dist/spark-sdk/src/graphql/objects/LightningSendFeeEstimateOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LightningSendRequest.d.ts +0 -35
- package/dist/spark-sdk/src/graphql/objects/LightningSendRequest.js +0 -82
- package/dist/spark-sdk/src/graphql/objects/LightningSendRequest.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/LightningSendRequestStatus.d.ts +0 -15
- package/dist/spark-sdk/src/graphql/objects/LightningSendRequestStatus.js +0 -18
- package/dist/spark-sdk/src/graphql/objects/LightningSendRequestStatus.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/NotifyReceiverTransferInput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/NotifyReceiverTransferInput.js +0 -14
- package/dist/spark-sdk/src/graphql/objects/NotifyReceiverTransferInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/PageInfo.d.ts +0 -11
- package/dist/spark-sdk/src/graphql/objects/PageInfo.js +0 -26
- package/dist/spark-sdk/src/graphql/objects/PageInfo.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/Provider.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/Provider.js +0 -14
- package/dist/spark-sdk/src/graphql/objects/Provider.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/RequestCoopExitInput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/RequestCoopExitInput.js +0 -14
- package/dist/spark-sdk/src/graphql/objects/RequestCoopExitInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/RequestCoopExitOutput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/RequestCoopExitOutput.js +0 -19
- package/dist/spark-sdk/src/graphql/objects/RequestCoopExitOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/RequestLeavesSwapInput.d.ts +0 -11
- package/dist/spark-sdk/src/graphql/objects/RequestLeavesSwapInput.js +0 -22
- package/dist/spark-sdk/src/graphql/objects/RequestLeavesSwapInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/RequestLeavesSwapOutput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/RequestLeavesSwapOutput.js +0 -19
- package/dist/spark-sdk/src/graphql/objects/RequestLeavesSwapOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/RequestLightningReceiveInput.d.ts +0 -16
- package/dist/spark-sdk/src/graphql/objects/RequestLightningReceiveInput.js +0 -21
- package/dist/spark-sdk/src/graphql/objects/RequestLightningReceiveInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/RequestLightningReceiveOutput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/RequestLightningReceiveOutput.js +0 -19
- package/dist/spark-sdk/src/graphql/objects/RequestLightningReceiveOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/RequestLightningSendInput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/RequestLightningSendInput.js +0 -14
- package/dist/spark-sdk/src/graphql/objects/RequestLightningSendInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/RequestLightningSendOutput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/RequestLightningSendOutput.js +0 -19
- package/dist/spark-sdk/src/graphql/objects/RequestLightningSendOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/SparkCoopExitRequestStatus.d.ts +0 -14
- package/dist/spark-sdk/src/graphql/objects/SparkCoopExitRequestStatus.js +0 -17
- package/dist/spark-sdk/src/graphql/objects/SparkCoopExitRequestStatus.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/SparkLeavesSwapRequestStatus.d.ts +0 -14
- package/dist/spark-sdk/src/graphql/objects/SparkLeavesSwapRequestStatus.js +0 -17
- package/dist/spark-sdk/src/graphql/objects/SparkLeavesSwapRequestStatus.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/SparkTransferToLeavesConnection.d.ts +0 -19
- package/dist/spark-sdk/src/graphql/objects/SparkTransferToLeavesConnection.js +0 -45
- package/dist/spark-sdk/src/graphql/objects/SparkTransferToLeavesConnection.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/SparkWalletUser.d.ts +0 -21
- package/dist/spark-sdk/src/graphql/objects/SparkWalletUser.js +0 -45
- package/dist/spark-sdk/src/graphql/objects/SparkWalletUser.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/StartSeedReleaseInput.d.ts +0 -6
- package/dist/spark-sdk/src/graphql/objects/StartSeedReleaseInput.js +0 -12
- package/dist/spark-sdk/src/graphql/objects/StartSeedReleaseInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/SwapLeaf.d.ts +0 -9
- package/dist/spark-sdk/src/graphql/objects/SwapLeaf.js +0 -23
- package/dist/spark-sdk/src/graphql/objects/SwapLeaf.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/Transfer.d.ts +0 -24
- package/dist/spark-sdk/src/graphql/objects/Transfer.js +0 -82
- package/dist/spark-sdk/src/graphql/objects/Transfer.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/UserLeafInput.d.ts +0 -8
- package/dist/spark-sdk/src/graphql/objects/UserLeafInput.js +0 -16
- package/dist/spark-sdk/src/graphql/objects/UserLeafInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/UserRequest.d.ts +0 -22
- package/dist/spark-sdk/src/graphql/objects/UserRequest.js +0 -310
- package/dist/spark-sdk/src/graphql/objects/UserRequest.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/VerifyChallengeInput.d.ts +0 -10
- package/dist/spark-sdk/src/graphql/objects/VerifyChallengeInput.js +0 -20
- package/dist/spark-sdk/src/graphql/objects/VerifyChallengeInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/VerifyChallengeOutput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/VerifyChallengeOutput.js +0 -17
- package/dist/spark-sdk/src/graphql/objects/VerifyChallengeOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/WalletUserIdentityPublicKeyInput.d.ts +0 -6
- package/dist/spark-sdk/src/graphql/objects/WalletUserIdentityPublicKeyInput.js +0 -12
- package/dist/spark-sdk/src/graphql/objects/WalletUserIdentityPublicKeyInput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/WalletUserIdentityPublicKeyOutput.d.ts +0 -7
- package/dist/spark-sdk/src/graphql/objects/WalletUserIdentityPublicKeyOutput.js +0 -17
- package/dist/spark-sdk/src/graphql/objects/WalletUserIdentityPublicKeyOutput.js.map +0 -1
- package/dist/spark-sdk/src/graphql/objects/index.d.ts +0 -53
- package/dist/spark-sdk/src/graphql/objects/index.js +0 -14
- package/dist/spark-sdk/src/graphql/objects/index.js.map +0 -1
- package/dist/spark-sdk/src/graphql/queries/CoopExitFeeEstimate.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/queries/CoopExitFeeEstimate.js +0 -18
- package/dist/spark-sdk/src/graphql/queries/CoopExitFeeEstimate.js.map +0 -1
- package/dist/spark-sdk/src/graphql/queries/LeavesSwapFeeEstimate.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/queries/LeavesSwapFeeEstimate.js +0 -16
- package/dist/spark-sdk/src/graphql/queries/LeavesSwapFeeEstimate.js.map +0 -1
- package/dist/spark-sdk/src/graphql/queries/LightningReceiveFeeEstimate.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/queries/LightningReceiveFeeEstimate.js +0 -18
- package/dist/spark-sdk/src/graphql/queries/LightningReceiveFeeEstimate.js.map +0 -1
- package/dist/spark-sdk/src/graphql/queries/LightningSendFeeEstimate.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/queries/LightningSendFeeEstimate.js +0 -16
- package/dist/spark-sdk/src/graphql/queries/LightningSendFeeEstimate.js.map +0 -1
- package/dist/spark-sdk/src/graphql/queries/UserRequest.d.ts +0 -1
- package/dist/spark-sdk/src/graphql/queries/UserRequest.js +0 -10
- package/dist/spark-sdk/src/graphql/queries/UserRequest.js.map +0 -1
- package/dist/spark-sdk/src/proto/common.d.ts +0 -58
- package/dist/spark-sdk/src/proto/common.js +0 -350
- package/dist/spark-sdk/src/proto/common.js.map +0 -1
- package/dist/spark-sdk/src/proto/google/protobuf/empty.d.ts +0 -33
- package/dist/spark-sdk/src/proto/google/protobuf/empty.js +0 -46
- package/dist/spark-sdk/src/proto/google/protobuf/empty.js.map +0 -1
- package/dist/spark-sdk/src/proto/google/protobuf/timestamp.d.ts +0 -128
- package/dist/spark-sdk/src/proto/google/protobuf/timestamp.js +0 -90
- package/dist/spark-sdk/src/proto/google/protobuf/timestamp.js.map +0 -1
- package/dist/spark-sdk/src/proto/mock.d.ts +0 -48
- package/dist/spark-sdk/src/proto/mock.js +0 -103
- package/dist/spark-sdk/src/proto/mock.js.map +0 -1
- package/dist/spark-sdk/src/proto/spark.d.ts +0 -1209
- package/dist/spark-sdk/src/proto/spark.js +0 -10516
- package/dist/spark-sdk/src/proto/spark.js.map +0 -1
- package/dist/spark-sdk/src/proto/spark_authn.d.ts +0 -111
- package/dist/spark-sdk/src/proto/spark_authn.js +0 -517
- package/dist/spark-sdk/src/proto/spark_authn.js.map +0 -1
- package/dist/spark-sdk/src/services/config.d.ts +0 -17
- package/dist/spark-sdk/src/services/config.js +0 -54
- package/dist/spark-sdk/src/services/config.js.map +0 -1
- package/dist/spark-sdk/src/services/connection.d.ts +0 -22
- package/dist/spark-sdk/src/services/connection.js +0 -180
- package/dist/spark-sdk/src/services/connection.js.map +0 -1
- package/dist/spark-sdk/src/services/coop-exit.d.ts +0 -20
- package/dist/spark-sdk/src/services/coop-exit.js +0 -101
- package/dist/spark-sdk/src/services/coop-exit.js.map +0 -1
- package/dist/spark-sdk/src/services/deposit.d.ts +0 -21
- package/dist/spark-sdk/src/services/deposit.js +0 -214
- package/dist/spark-sdk/src/services/deposit.js.map +0 -1
- package/dist/spark-sdk/src/services/lightning.d.ts +0 -32
- package/dist/spark-sdk/src/services/lightning.js +0 -210
- package/dist/spark-sdk/src/services/lightning.js.map +0 -1
- package/dist/spark-sdk/src/services/lrc20.d.ts +0 -5
- package/dist/spark-sdk/src/services/lrc20.js +0 -27
- package/dist/spark-sdk/src/services/lrc20.js.map +0 -1
- package/dist/spark-sdk/src/services/token-transactions.d.ts +0 -16
- package/dist/spark-sdk/src/services/token-transactions.js +0 -299
- package/dist/spark-sdk/src/services/token-transactions.js.map +0 -1
- package/dist/spark-sdk/src/services/transfer.d.ts +0 -66
- package/dist/spark-sdk/src/services/transfer.js +0 -791
- package/dist/spark-sdk/src/services/transfer.js.map +0 -1
- package/dist/spark-sdk/src/services/tree-creation.d.ts +0 -29
- package/dist/spark-sdk/src/services/tree-creation.js +0 -399
- package/dist/spark-sdk/src/services/tree-creation.js.map +0 -1
- package/dist/spark-sdk/src/services/wallet-config.d.ts +0 -23
- package/dist/spark-sdk/src/services/wallet-config.js +0 -107
- package/dist/spark-sdk/src/services/wallet-config.js.map +0 -1
- package/dist/spark-sdk/src/signer/signer.d.ts +0 -106
- package/dist/spark-sdk/src/signer/signer.js +0 -275
- package/dist/spark-sdk/src/signer/signer.js.map +0 -1
- package/dist/spark-sdk/src/spark-sdk.d.ts +0 -414
- package/dist/spark-sdk/src/spark-sdk.js +0 -1285
- package/dist/spark-sdk/src/spark-sdk.js.map +0 -1
- package/dist/spark-sdk/src/tests/utils/test-faucet.d.ts +0 -24
- package/dist/spark-sdk/src/tests/utils/test-faucet.js +0 -182
- package/dist/spark-sdk/src/tests/utils/test-faucet.js.map +0 -1
- package/dist/spark-sdk/src/types/grpc.d.ts +0 -6
- package/dist/spark-sdk/src/types/grpc.js +0 -2
- package/dist/spark-sdk/src/types/grpc.js.map +0 -1
- package/dist/spark-sdk/src/types/index.d.ts +0 -3
- package/dist/spark-sdk/src/types/index.js +0 -4
- package/dist/spark-sdk/src/types/index.js.map +0 -1
- package/dist/spark-sdk/src/utils/adaptor-signature.d.ts +0 -7
- package/dist/spark-sdk/src/utils/adaptor-signature.js +0 -114
- package/dist/spark-sdk/src/utils/adaptor-signature.js.map +0 -1
- package/dist/spark-sdk/src/utils/bitcoin.d.ts +0 -12
- package/dist/spark-sdk/src/utils/bitcoin.js +0 -87
- package/dist/spark-sdk/src/utils/bitcoin.js.map +0 -1
- package/dist/spark-sdk/src/utils/crypto.d.ts +0 -1
- package/dist/spark-sdk/src/utils/crypto.js +0 -14
- package/dist/spark-sdk/src/utils/crypto.js.map +0 -1
- package/dist/spark-sdk/src/utils/index.d.ts +0 -12
- package/dist/spark-sdk/src/utils/index.js +0 -13
- package/dist/spark-sdk/src/utils/index.js.map +0 -1
- package/dist/spark-sdk/src/utils/keys.d.ts +0 -9
- package/dist/spark-sdk/src/utils/keys.js +0 -73
- package/dist/spark-sdk/src/utils/keys.js.map +0 -1
- package/dist/spark-sdk/src/utils/mempool.d.ts +0 -1
- package/dist/spark-sdk/src/utils/mempool.js +0 -29
- package/dist/spark-sdk/src/utils/mempool.js.map +0 -1
- package/dist/spark-sdk/src/utils/network.d.ts +0 -36
- package/dist/spark-sdk/src/utils/network.js +0 -65
- package/dist/spark-sdk/src/utils/network.js.map +0 -1
- package/dist/spark-sdk/src/utils/proof.d.ts +0 -1
- package/dist/spark-sdk/src/utils/proof.js +0 -12
- package/dist/spark-sdk/src/utils/proof.js.map +0 -1
- package/dist/spark-sdk/src/utils/response-validation.d.ts +0 -1
- package/dist/spark-sdk/src/utils/response-validation.js +0 -16
- package/dist/spark-sdk/src/utils/response-validation.js.map +0 -1
- package/dist/spark-sdk/src/utils/secret-sharing.d.ts +0 -26
- package/dist/spark-sdk/src/utils/secret-sharing.js +0 -174
- package/dist/spark-sdk/src/utils/secret-sharing.js.map +0 -1
- package/dist/spark-sdk/src/utils/signing.d.ts +0 -12
- package/dist/spark-sdk/src/utils/signing.js +0 -67
- package/dist/spark-sdk/src/utils/signing.js.map +0 -1
- package/dist/spark-sdk/src/utils/token-hashing.d.ts +0 -3
- package/dist/spark-sdk/src/utils/token-hashing.js +0 -116
- package/dist/spark-sdk/src/utils/token-hashing.js.map +0 -1
- package/dist/spark-sdk/src/utils/token-keyshares.d.ts +0 -5
- package/dist/spark-sdk/src/utils/token-keyshares.js +0 -17
- package/dist/spark-sdk/src/utils/token-keyshares.js.map +0 -1
- package/dist/spark-sdk/src/utils/token-transactions.d.ts +0 -5
- package/dist/spark-sdk/src/utils/token-transactions.js +0 -40
- package/dist/spark-sdk/src/utils/token-transactions.js.map +0 -1
- package/dist/spark-sdk/src/utils/transaction.d.ts +0 -9
- package/dist/spark-sdk/src/utils/transaction.js +0 -35
- package/dist/spark-sdk/src/utils/transaction.js.map +0 -1
- package/dist/spark-sdk/src/utils/wasm-wrapper.d.ts +0 -2
- package/dist/spark-sdk/src/utils/wasm-wrapper.js +0 -46
- package/dist/spark-sdk/src/utils/wasm-wrapper.js.map +0 -1
- package/dist/spark-sdk/src/utils/wasm.d.ts +0 -54
- package/dist/spark-sdk/src/utils/wasm.js +0 -26
- package/dist/spark-sdk/src/utils/wasm.js.map +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { DefaultSparkSigner } from "../signer/signer.js";
|
|
2
|
-
import { Network, NetworkToProto } from "../utils/network.js";
|
|
3
|
-
import { LOCAL_WALLET_CONFIG, MAINNET_WALLET_CONFIG, REGTEST_WALLET_CONFIG, } from "./wallet-config.js";
|
|
4
|
-
export class WalletConfigService {
|
|
5
|
-
config;
|
|
6
|
-
signer;
|
|
7
|
-
constructor(options, signer) {
|
|
8
|
-
const network = options?.network ?? "REGTEST";
|
|
9
|
-
this.config = {
|
|
10
|
-
...this.getDefaultConfig(Network[network]),
|
|
11
|
-
...options,
|
|
12
|
-
};
|
|
13
|
-
this.signer = signer ?? new DefaultSparkSigner();
|
|
14
|
-
}
|
|
15
|
-
getDefaultConfig(network) {
|
|
16
|
-
switch (network) {
|
|
17
|
-
case Network.MAINNET:
|
|
18
|
-
return MAINNET_WALLET_CONFIG;
|
|
19
|
-
case Network.REGTEST:
|
|
20
|
-
return REGTEST_WALLET_CONFIG;
|
|
21
|
-
default:
|
|
22
|
-
return LOCAL_WALLET_CONFIG;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
getCoordinatorAddress() {
|
|
26
|
-
const coordinator = this.config.signingOperators[this.config.coodinatorIdentifier];
|
|
27
|
-
if (!coordinator) {
|
|
28
|
-
throw new Error(`Coordinator ${this.config.coodinatorIdentifier} not found`);
|
|
29
|
-
}
|
|
30
|
-
return coordinator.address;
|
|
31
|
-
}
|
|
32
|
-
getLrc20Address() {
|
|
33
|
-
return this.config.lrc20Address;
|
|
34
|
-
}
|
|
35
|
-
getSigningOperators() {
|
|
36
|
-
return this.config.signingOperators;
|
|
37
|
-
}
|
|
38
|
-
getThreshold() {
|
|
39
|
-
return this.config.threshold;
|
|
40
|
-
}
|
|
41
|
-
getCoordinatorIdentifier() {
|
|
42
|
-
return this.config.coodinatorIdentifier;
|
|
43
|
-
}
|
|
44
|
-
getNetwork() {
|
|
45
|
-
return Network[this.config.network];
|
|
46
|
-
}
|
|
47
|
-
getNetworkProto() {
|
|
48
|
-
return NetworkToProto[Network[this.config.network]];
|
|
49
|
-
}
|
|
50
|
-
shouldSignTokenTransactionsWithSchnorr() {
|
|
51
|
-
return this.config.useTokenTransactionSchnorrSignatures;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../spark-sdk/src/services/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAe,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAEL,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,GAEtB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,OAAO,mBAAmB;IACb,MAAM,CAA0B;IACjC,MAAM,CAAc;IAEpC,YAAY,OAAuB,EAAE,MAAoB;QACvD,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,SAAS,CAAC;QAE9C,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC1C,GAAG,OAAO;SACX,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,IAAI,kBAAkB,EAAE,CAAC;IACnD,CAAC;IAEO,gBAAgB,CAAC,OAAgB;QACvC,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,OAAO,CAAC,OAAO;gBAClB,OAAO,qBAAqB,CAAC;YAC/B,KAAK,OAAO,CAAC,OAAO;gBAClB,OAAO,qBAAqB,CAAC;YAC/B;gBACE,OAAO,mBAAmB,CAAC;QAC/B,CAAC;IACH,CAAC;IAEM,qBAAqB;QAC1B,MAAM,WAAW,GACf,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QACjE,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,CAAC,MAAM,CAAC,oBAAoB,YAAY,CAC5D,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC,OAAO,CAAC;IAC7B,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;IAClC,CAAC;IAEM,mBAAmB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;IACtC,CAAC;IAEM,YAAY;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAEM,wBAAwB;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;IAC1C,CAAC;IAEM,UAAU;QACf,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,eAAe;QACpB,OAAO,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC;IAEM,sCAAsC;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,oCAAoC,CAAC;IAC1D,CAAC;CACF"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { MockServiceClient } from "../proto/mock.js";
|
|
2
|
-
import { SparkServiceClient } from "../proto/spark.js";
|
|
3
|
-
import { WalletConfigService } from "./config.js";
|
|
4
|
-
export declare class ConnectionManager {
|
|
5
|
-
private config;
|
|
6
|
-
private clients;
|
|
7
|
-
constructor(config: WalletConfigService);
|
|
8
|
-
createClients(): Promise<void>;
|
|
9
|
-
static createMockClient(address: string): MockServiceClient & {
|
|
10
|
-
close: () => void;
|
|
11
|
-
};
|
|
12
|
-
private static createChannelWithTLS;
|
|
13
|
-
createSparkClient(address: string, certPath?: string): Promise<SparkServiceClient & {
|
|
14
|
-
close?: () => void;
|
|
15
|
-
}>;
|
|
16
|
-
private authenticate;
|
|
17
|
-
private createSparkAuthnGrpcConnection;
|
|
18
|
-
private createAuthMiddleWare;
|
|
19
|
-
private createNodeMiddleware;
|
|
20
|
-
private createBrowserMiddleware;
|
|
21
|
-
private createGrpcClient;
|
|
22
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { sha256 } from "@scure/btc-signer/utils";
|
|
2
|
-
import { ChannelCredentials, createChannel, createClient, createClientFactory, Metadata, } from "nice-grpc";
|
|
3
|
-
import { retryMiddleware } from "nice-grpc-client-middleware-retry";
|
|
4
|
-
import { MockServiceDefinition } from "../proto/mock.js";
|
|
5
|
-
import { SparkServiceDefinition } from "../proto/spark.js";
|
|
6
|
-
import { Challenge, SparkAuthnServiceDefinition, } from "../proto/spark_authn.js";
|
|
7
|
-
// TODO: Some sort of client cleanup
|
|
8
|
-
export class ConnectionManager {
|
|
9
|
-
config;
|
|
10
|
-
clients = new Map();
|
|
11
|
-
constructor(config) {
|
|
12
|
-
this.config = config;
|
|
13
|
-
}
|
|
14
|
-
// When initializing wallet, go ahead and instantiate all clients
|
|
15
|
-
async createClients() {
|
|
16
|
-
await Promise.all(Object.values(this.config.getSigningOperators()).map((operator) => {
|
|
17
|
-
this.createSparkClient(operator.address);
|
|
18
|
-
}));
|
|
19
|
-
}
|
|
20
|
-
static createMockClient(address) {
|
|
21
|
-
const channel = this.createChannelWithTLS(address);
|
|
22
|
-
const client = createClient(MockServiceDefinition, channel);
|
|
23
|
-
return { ...client, close: () => channel.close() };
|
|
24
|
-
}
|
|
25
|
-
// TODO: Web transport handles TLS differently, verify that we don't need to do anything
|
|
26
|
-
static createChannelWithTLS(address, certPath) {
|
|
27
|
-
try {
|
|
28
|
-
if (typeof window === "undefined") {
|
|
29
|
-
// Node.js environment
|
|
30
|
-
if (certPath) {
|
|
31
|
-
try {
|
|
32
|
-
// Dynamic import for Node.js only
|
|
33
|
-
const fs = require('fs');
|
|
34
|
-
const cert = fs.readFileSync(certPath);
|
|
35
|
-
return createChannel(address, ChannelCredentials.createSsl(cert));
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.error("Error reading certificate:", error);
|
|
39
|
-
// Fallback to insecure for development
|
|
40
|
-
return createChannel(address, ChannelCredentials.createSsl(null, null, null, {
|
|
41
|
-
rejectUnauthorized: false,
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
// No cert provided, use insecure SSL for development
|
|
47
|
-
return createChannel(address, ChannelCredentials.createSsl(null, null, null, {
|
|
48
|
-
rejectUnauthorized: false,
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
// Browser environment - nice-grpc-web handles TLS automatically
|
|
54
|
-
return createChannel(address);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
console.error("Channel creation error:", error);
|
|
59
|
-
throw new Error("Failed to create channel");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async createSparkClient(address, certPath) {
|
|
63
|
-
if (this.clients.has(address)) {
|
|
64
|
-
return this.clients.get(address).client;
|
|
65
|
-
}
|
|
66
|
-
const authToken = await this.authenticate(address);
|
|
67
|
-
const channel = ConnectionManager.createChannelWithTLS(address, certPath);
|
|
68
|
-
const authMiddleware = this.createAuthMiddleWare(address, authToken);
|
|
69
|
-
const client = this.createGrpcClient(SparkServiceDefinition, channel, authMiddleware);
|
|
70
|
-
this.clients.set(address, { client, authToken });
|
|
71
|
-
return client;
|
|
72
|
-
}
|
|
73
|
-
async authenticate(address) {
|
|
74
|
-
try {
|
|
75
|
-
const identityPublicKey = await this.config.signer.getIdentityPublicKey();
|
|
76
|
-
const sparkAuthnClient = this.createSparkAuthnGrpcConnection(address);
|
|
77
|
-
const challengeResp = await sparkAuthnClient.get_challenge({
|
|
78
|
-
publicKey: identityPublicKey,
|
|
79
|
-
});
|
|
80
|
-
if (!challengeResp.protectedChallenge?.challenge) {
|
|
81
|
-
throw new Error("Invalid challenge response");
|
|
82
|
-
}
|
|
83
|
-
const challengeBytes = Challenge.encode(challengeResp.protectedChallenge.challenge).finish();
|
|
84
|
-
const hash = sha256(challengeBytes);
|
|
85
|
-
const derSignatureBytes = await this.config.signer.signMessageWithIdentityKey(hash);
|
|
86
|
-
const verifyResp = await sparkAuthnClient.verify_challenge({
|
|
87
|
-
protectedChallenge: challengeResp.protectedChallenge,
|
|
88
|
-
signature: derSignatureBytes,
|
|
89
|
-
publicKey: identityPublicKey,
|
|
90
|
-
});
|
|
91
|
-
sparkAuthnClient.close?.();
|
|
92
|
-
return verifyResp.sessionToken;
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
console.error("Authentication error:", error);
|
|
96
|
-
throw new Error(`Authentication failed: ${error.message}`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
createSparkAuthnGrpcConnection(address, certPath) {
|
|
100
|
-
const channel = ConnectionManager.createChannelWithTLS(address, certPath);
|
|
101
|
-
return this.createGrpcClient(SparkAuthnServiceDefinition, channel);
|
|
102
|
-
}
|
|
103
|
-
createAuthMiddleWare(address, authToken) {
|
|
104
|
-
if (typeof window === "undefined") {
|
|
105
|
-
return this.createNodeMiddleware(address, authToken);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
return this.createBrowserMiddleware(address, authToken);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
createNodeMiddleware(address, initialAuthToken) {
|
|
112
|
-
return async function* (call, options) {
|
|
113
|
-
try {
|
|
114
|
-
yield* call.next(call.request, {
|
|
115
|
-
...options,
|
|
116
|
-
metadata: Metadata(options.metadata).set("Authorization", `Bearer ${this.clients.get(address)?.authToken || initialAuthToken}`),
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
if (error.message?.includes("token has expired")) {
|
|
121
|
-
const newAuthToken = await this.authenticate(address);
|
|
122
|
-
// @ts-ignore - We can only get here if the client exists
|
|
123
|
-
this.clients.get(address).authToken = newAuthToken;
|
|
124
|
-
yield* call.next(call.request, {
|
|
125
|
-
...options,
|
|
126
|
-
metadata: Metadata(options.metadata).set("Authorization", `Bearer ${newAuthToken}`),
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
throw error;
|
|
130
|
-
}
|
|
131
|
-
}.bind(this);
|
|
132
|
-
}
|
|
133
|
-
createBrowserMiddleware(address, initialAuthToken) {
|
|
134
|
-
return async function* (call, options) {
|
|
135
|
-
try {
|
|
136
|
-
yield* call.next(call.request, {
|
|
137
|
-
...options,
|
|
138
|
-
metadata: Metadata(options.metadata)
|
|
139
|
-
.set("Authorization", `Bearer ${this.clients.get(address)?.authToken || initialAuthToken}`)
|
|
140
|
-
.set("X-Requested-With", "XMLHttpRequest")
|
|
141
|
-
.set("X-Grpc-Web", "1")
|
|
142
|
-
.set("Content-Type", "application/grpc-web+proto"),
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
if (error.message?.includes("token has expired")) {
|
|
147
|
-
const newAuthToken = await this.authenticate(address);
|
|
148
|
-
// @ts-ignore - We can only get here if the client exists
|
|
149
|
-
this.clients.get(address).authToken = newAuthToken;
|
|
150
|
-
yield* call.next(call.request, {
|
|
151
|
-
...options,
|
|
152
|
-
metadata: Metadata(options.metadata)
|
|
153
|
-
.set("Authorization", `Bearer ${newAuthToken}`)
|
|
154
|
-
.set("X-Requested-With", "XMLHttpRequest")
|
|
155
|
-
.set("X-Grpc-Web", "1")
|
|
156
|
-
.set("Content-Type", "application/grpc-web+proto"),
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
throw error;
|
|
160
|
-
}
|
|
161
|
-
}.bind(this);
|
|
162
|
-
}
|
|
163
|
-
createGrpcClient(defintion, channel, middleware) {
|
|
164
|
-
const clientFactory = createClientFactory().use(retryMiddleware);
|
|
165
|
-
if (middleware) {
|
|
166
|
-
clientFactory.use(middleware);
|
|
167
|
-
}
|
|
168
|
-
const client = clientFactory.create(defintion, channel, {
|
|
169
|
-
"*": {
|
|
170
|
-
retry: true,
|
|
171
|
-
retryMaxAttempts: 3,
|
|
172
|
-
},
|
|
173
|
-
});
|
|
174
|
-
return {
|
|
175
|
-
...client,
|
|
176
|
-
close: channel.close?.bind(channel),
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
//# sourceMappingURL=connection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../../../spark-sdk/src/services/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAEL,kBAAkB,EAElB,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAqB,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAsB,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EACL,SAAS,EAET,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AAIjC,oCAAoC;AACpC,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAsB;IAC5B,OAAO,GAMX,IAAI,GAAG,EAAE,CAAC;IAEd,YAAY,MAA2B;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,iEAAiE;IAC1D,KAAK,CAAC,aAAa;QACxB,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YAChE,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,OAAe;QAGrC,MAAM,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAA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GAAG,CAAC,eAAe,CAAC,CAAC;QACjE,IAAI,UAAU,EAAE,CAAC;YACf,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAChC,CAAC;QAED,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE;YACtD,GAAG,EAAE;gBACH,KAAK,EAAE,IAAI;gBACX,gBAAgB,EAAE,CAAC;aACpB;SACF,CAAM,CAAC;QACR,OAAO;YACL,GAAG,MAAM;YACT,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;SACpC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { TransactionInput } from "@scure/btc-signer/psbt";
|
|
2
|
-
import { Transfer } from "../proto/spark.js";
|
|
3
|
-
import { WalletConfigService } from "./config.js";
|
|
4
|
-
import { ConnectionManager } from "./connection.js";
|
|
5
|
-
import { BaseTransferService, LeafKeyTweak } from "./transfer.js";
|
|
6
|
-
export type GetConnectorRefundSignaturesParams = {
|
|
7
|
-
leaves: LeafKeyTweak[];
|
|
8
|
-
exitTxId: Uint8Array;
|
|
9
|
-
connectorOutputs: TransactionInput[];
|
|
10
|
-
receiverPubKey: Uint8Array;
|
|
11
|
-
};
|
|
12
|
-
export declare class CoopExitService extends BaseTransferService {
|
|
13
|
-
constructor(config: WalletConfigService, connectionManager: ConnectionManager);
|
|
14
|
-
getConnectorRefundSignatures({ leaves, exitTxId, connectorOutputs, receiverPubKey, }: GetConnectorRefundSignaturesParams): Promise<{
|
|
15
|
-
transfer: Transfer;
|
|
16
|
-
signaturesMap: Map<string, Uint8Array>;
|
|
17
|
-
}>;
|
|
18
|
-
private createConnectorRefundTransaction;
|
|
19
|
-
private signCoopExitRefunds;
|
|
20
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Transaction } from "@scure/btc-signer";
|
|
2
|
-
import { getP2TRScriptFromPublicKey, getTxFromRawTxBytes, } from "../utils/bitcoin.js";
|
|
3
|
-
import { getCrypto } from "../utils/crypto.js";
|
|
4
|
-
import { getNextTransactionSequence } from "../utils/transaction.js";
|
|
5
|
-
import { BaseTransferService, } from "./transfer.js";
|
|
6
|
-
const crypto = getCrypto();
|
|
7
|
-
export class CoopExitService extends BaseTransferService {
|
|
8
|
-
constructor(config, connectionManager) {
|
|
9
|
-
super(config, connectionManager);
|
|
10
|
-
}
|
|
11
|
-
async getConnectorRefundSignatures({ leaves, exitTxId, connectorOutputs, receiverPubKey, }) {
|
|
12
|
-
const { transfer, signaturesMap } = await this.signCoopExitRefunds(leaves, exitTxId, connectorOutputs, receiverPubKey);
|
|
13
|
-
const transferTweak = await this.sendTransferTweakKey(transfer, leaves, signaturesMap);
|
|
14
|
-
return { transfer: transferTweak, signaturesMap };
|
|
15
|
-
}
|
|
16
|
-
createConnectorRefundTransaction(sequence, nodeOutPoint, connectorOutput, amountSats, receiverPubKey) {
|
|
17
|
-
const refundTx = new Transaction();
|
|
18
|
-
if (!nodeOutPoint.txid || nodeOutPoint.index === undefined) {
|
|
19
|
-
throw new Error("Node outpoint txid or index is undefined");
|
|
20
|
-
}
|
|
21
|
-
refundTx.addInput({
|
|
22
|
-
txid: nodeOutPoint.txid,
|
|
23
|
-
index: nodeOutPoint.index,
|
|
24
|
-
sequence,
|
|
25
|
-
});
|
|
26
|
-
refundTx.addInput(connectorOutput);
|
|
27
|
-
const receiverScript = getP2TRScriptFromPublicKey(receiverPubKey, this.config.getNetwork());
|
|
28
|
-
refundTx.addOutput({
|
|
29
|
-
script: receiverScript,
|
|
30
|
-
amount: amountSats,
|
|
31
|
-
});
|
|
32
|
-
return refundTx;
|
|
33
|
-
}
|
|
34
|
-
async signCoopExitRefunds(leaves, exitTxId, connectorOutputs, receiverPubKey) {
|
|
35
|
-
if (leaves.length !== connectorOutputs.length) {
|
|
36
|
-
throw new Error("Number of leaves and connector outputs must match");
|
|
37
|
-
}
|
|
38
|
-
const signingJobs = [];
|
|
39
|
-
const leafDataMap = new Map();
|
|
40
|
-
for (let i = 0; i < leaves.length; i++) {
|
|
41
|
-
const leaf = leaves[i];
|
|
42
|
-
const connectorOutput = connectorOutputs[i];
|
|
43
|
-
if (!leaf?.leaf) {
|
|
44
|
-
throw new Error("Leaf not found");
|
|
45
|
-
}
|
|
46
|
-
if (!connectorOutput) {
|
|
47
|
-
throw new Error("Connector output not found");
|
|
48
|
-
}
|
|
49
|
-
const currentRefundTx = getTxFromRawTxBytes(leaf.leaf.refundTx);
|
|
50
|
-
const { nextSequence } = getNextTransactionSequence(currentRefundTx.getInput(0).sequence);
|
|
51
|
-
const refundTx = this.createConnectorRefundTransaction(nextSequence, currentRefundTx.getInput(0), connectorOutput, BigInt(leaf.leaf.value), receiverPubKey);
|
|
52
|
-
const signingNonceCommitment = await this.config.signer.getRandomSigningCommitment();
|
|
53
|
-
const signingJob = {
|
|
54
|
-
leafId: leaf.leaf.id,
|
|
55
|
-
refundTxSigningJob: {
|
|
56
|
-
signingPublicKey: leaf.signingPubKey,
|
|
57
|
-
rawTx: refundTx.toBytes(),
|
|
58
|
-
signingNonceCommitment: signingNonceCommitment,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
signingJobs.push(signingJob);
|
|
62
|
-
const tx = getTxFromRawTxBytes(leaf.leaf.nodeTx);
|
|
63
|
-
leafDataMap.set(leaf.leaf.id, {
|
|
64
|
-
signingPubKey: leaf.signingPubKey,
|
|
65
|
-
refundTx,
|
|
66
|
-
signingNonceCommitment,
|
|
67
|
-
tx,
|
|
68
|
-
vout: leaf.leaf.vout,
|
|
69
|
-
receivingPubkey: receiverPubKey,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
const sparkClient = await this.connectionManager.createSparkClient(this.config.getCoordinatorAddress());
|
|
73
|
-
let response;
|
|
74
|
-
try {
|
|
75
|
-
response = await sparkClient.cooperative_exit({
|
|
76
|
-
transfer: {
|
|
77
|
-
transferId: crypto.randomUUID(),
|
|
78
|
-
leavesToSend: signingJobs,
|
|
79
|
-
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
80
|
-
receiverIdentityPublicKey: receiverPubKey,
|
|
81
|
-
expiryTime: new Date(Date.now() + 3 * 60 * 60 * 1000), // 3 hours
|
|
82
|
-
},
|
|
83
|
-
exitId: crypto.randomUUID(),
|
|
84
|
-
exitTxid: exitTxId,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
throw new Error(`Error initiating cooperative exit: ${error}`);
|
|
89
|
-
}
|
|
90
|
-
if (!response.transfer) {
|
|
91
|
-
throw new Error("Failed to initiate cooperative exit");
|
|
92
|
-
}
|
|
93
|
-
const signatures = await this.signRefunds(leafDataMap, response.signingResults);
|
|
94
|
-
const signaturesMap = new Map();
|
|
95
|
-
for (const signature of signatures) {
|
|
96
|
-
signaturesMap.set(signature.nodeId, signature.refundTxSignature);
|
|
97
|
-
}
|
|
98
|
-
return { transfer: response.transfer, signaturesMap };
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=coop-exit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coop-exit.js","sourceRoot":"","sources":["../../../../../spark-sdk/src/services/coop-exit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAGrE,OAAO,EACL,mBAAmB,GAGpB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;AAS3B,MAAM,OAAO,eAAgB,SAAQ,mBAAmB;IACtD,YACE,MAA2B,EAC3B,iBAAoC;QAEpC,KAAK,CAAC,MAA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I,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,WAAW,CACvC,WAAW,EACX,QAAQ,CAAC,cAAc,CACxB,CAAC;QAEF,MAAM,aAAa,GAA4B,IAAI,GAAG,EAAE,CAAC;QACzD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC;IACxD,CAAC;CACF"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Transaction } from "@scure/btc-signer";
|
|
2
|
-
import { FinalizeNodeSignaturesResponse, GenerateDepositAddressResponse } from "../proto/spark.js";
|
|
3
|
-
import { WalletConfigService } from "./config.js";
|
|
4
|
-
import { ConnectionManager } from "./connection.js";
|
|
5
|
-
export type GenerateDepositAddressParams = {
|
|
6
|
-
signingPubkey: Uint8Array;
|
|
7
|
-
};
|
|
8
|
-
export type CreateTreeRootParams = {
|
|
9
|
-
signingPubKey: Uint8Array;
|
|
10
|
-
verifyingKey: Uint8Array;
|
|
11
|
-
depositTx: Transaction;
|
|
12
|
-
vout: number;
|
|
13
|
-
};
|
|
14
|
-
export declare class DepositService {
|
|
15
|
-
private readonly config;
|
|
16
|
-
private readonly connectionManager;
|
|
17
|
-
constructor(config: WalletConfigService, connectionManager: ConnectionManager);
|
|
18
|
-
private validateDepositAddress;
|
|
19
|
-
generateDepositAddress({ signingPubkey, }: GenerateDepositAddressParams): Promise<GenerateDepositAddressResponse>;
|
|
20
|
-
createTreeRoot({ signingPubKey, verifyingKey, depositTx, vout, }: CreateTreeRootParams): Promise<FinalizeNodeSignaturesResponse>;
|
|
21
|
-
}
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { schnorr, secp256k1 } from "@noble/curves/secp256k1";
|
|
2
|
-
import * as btc from "@scure/btc-signer";
|
|
3
|
-
import { p2tr, Transaction } from "@scure/btc-signer";
|
|
4
|
-
import { equalBytes, sha256 } from "@scure/btc-signer/utils";
|
|
5
|
-
import { SignatureIntent } from "../proto/common.js";
|
|
6
|
-
import { getP2TRAddressFromPublicKey, getSigHashFromTx, getTxId, } from "../utils/bitcoin.js";
|
|
7
|
-
import { subtractPublicKeys } from "../utils/keys.js";
|
|
8
|
-
import { getNetwork } from "../utils/network.js";
|
|
9
|
-
import { proofOfPossessionMessageHashForDepositAddress } from "../utils/proof.js";
|
|
10
|
-
import { createWasmSigningCommitment } from "../utils/signing.js";
|
|
11
|
-
const INITIAL_TIME_LOCK = 2000;
|
|
12
|
-
export class DepositService {
|
|
13
|
-
config;
|
|
14
|
-
connectionManager;
|
|
15
|
-
constructor(config, connectionManager) {
|
|
16
|
-
this.config = config;
|
|
17
|
-
this.connectionManager = connectionManager;
|
|
18
|
-
}
|
|
19
|
-
async validateDepositAddress({ address, userPubkey, }) {
|
|
20
|
-
if (!address.depositAddressProof ||
|
|
21
|
-
!address.depositAddressProof.proofOfPossessionSignature ||
|
|
22
|
-
!address.depositAddressProof.addressSignatures) {
|
|
23
|
-
throw new Error("proof of possession signature or address signatures is null");
|
|
24
|
-
}
|
|
25
|
-
const operatorPubkey = subtractPublicKeys(address.verifyingKey, userPubkey);
|
|
26
|
-
const msg = proofOfPossessionMessageHashForDepositAddress(await this.config.signer.getIdentityPublicKey(), operatorPubkey, address.address);
|
|
27
|
-
const taprootKey = p2tr(operatorPubkey.slice(1, 33), undefined, getNetwork(this.config.getNetwork())).tweakedPubkey;
|
|
28
|
-
const isVerified = schnorr.verify(address.depositAddressProof.proofOfPossessionSignature, msg, taprootKey);
|
|
29
|
-
if (!isVerified) {
|
|
30
|
-
throw new Error("proof of possession signature verification failed");
|
|
31
|
-
}
|
|
32
|
-
const addrHash = sha256(address.address);
|
|
33
|
-
for (const operator of Object.values(this.config.getSigningOperators())) {
|
|
34
|
-
if (operator.identifier === this.config.getCoordinatorIdentifier()) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
const operatorPubkey = operator.identityPublicKey;
|
|
38
|
-
const operatorSig = address.depositAddressProof.addressSignatures[operator.identifier];
|
|
39
|
-
if (!operatorSig) {
|
|
40
|
-
throw new Error("operator signature not found");
|
|
41
|
-
}
|
|
42
|
-
const sig = secp256k1.Signature.fromDER(operatorSig);
|
|
43
|
-
const isVerified = secp256k1.verify(sig, addrHash, operatorPubkey);
|
|
44
|
-
if (!isVerified) {
|
|
45
|
-
throw new Error("signature verification failed");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
async generateDepositAddress({ signingPubkey, }) {
|
|
50
|
-
const sparkClient = await this.connectionManager.createSparkClient(this.config.getCoordinatorAddress());
|
|
51
|
-
let depositResp;
|
|
52
|
-
try {
|
|
53
|
-
depositResp = await sparkClient.generate_deposit_address({
|
|
54
|
-
signingPublicKey: signingPubkey,
|
|
55
|
-
identityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
56
|
-
network: this.config.getNetworkProto(),
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
throw new Error(`Error generating deposit address: ${error}`);
|
|
61
|
-
}
|
|
62
|
-
if (!depositResp.depositAddress) {
|
|
63
|
-
throw new Error("No deposit address response from coordinator");
|
|
64
|
-
}
|
|
65
|
-
await this.validateDepositAddress({
|
|
66
|
-
address: depositResp.depositAddress,
|
|
67
|
-
userPubkey: signingPubkey,
|
|
68
|
-
});
|
|
69
|
-
return depositResp;
|
|
70
|
-
}
|
|
71
|
-
async createTreeRoot({ signingPubKey, verifyingKey, depositTx, vout, }) {
|
|
72
|
-
// Create a root tx
|
|
73
|
-
const rootTx = new Transaction();
|
|
74
|
-
const output = depositTx.getOutput(vout);
|
|
75
|
-
if (!output) {
|
|
76
|
-
throw new Error("No output found in deposit tx");
|
|
77
|
-
}
|
|
78
|
-
const script = output.script;
|
|
79
|
-
const amount = output.amount;
|
|
80
|
-
if (!script || !amount) {
|
|
81
|
-
throw new Error("No script or amount found in deposit tx");
|
|
82
|
-
}
|
|
83
|
-
rootTx.addInput({
|
|
84
|
-
txid: getTxId(depositTx),
|
|
85
|
-
index: vout,
|
|
86
|
-
});
|
|
87
|
-
rootTx.addOutput({
|
|
88
|
-
script,
|
|
89
|
-
amount,
|
|
90
|
-
});
|
|
91
|
-
const rootNonceCommitment = await this.config.signer.getRandomSigningCommitment();
|
|
92
|
-
const rootTxSighash = getSigHashFromTx(rootTx, 0, output);
|
|
93
|
-
// Create a refund tx
|
|
94
|
-
const refundTx = new Transaction();
|
|
95
|
-
const sequence = (1 << 30) | INITIAL_TIME_LOCK;
|
|
96
|
-
refundTx.addInput({
|
|
97
|
-
txid: getTxId(rootTx),
|
|
98
|
-
index: 0,
|
|
99
|
-
sequence,
|
|
100
|
-
});
|
|
101
|
-
const refundP2trAddress = getP2TRAddressFromPublicKey(signingPubKey, this.config.getNetwork());
|
|
102
|
-
const refundAddress = btc
|
|
103
|
-
.Address(getNetwork(this.config.getNetwork()))
|
|
104
|
-
.decode(refundP2trAddress);
|
|
105
|
-
const refundPkScript = btc.OutScript.encode(refundAddress);
|
|
106
|
-
refundTx.addOutput({
|
|
107
|
-
script: refundPkScript,
|
|
108
|
-
amount: amount,
|
|
109
|
-
});
|
|
110
|
-
const refundNonceCommitment = await this.config.signer.getRandomSigningCommitment();
|
|
111
|
-
const refundTxSighash = getSigHashFromTx(refundTx, 0, output);
|
|
112
|
-
const sparkClient = await this.connectionManager.createSparkClient(this.config.getCoordinatorAddress());
|
|
113
|
-
let treeResp;
|
|
114
|
-
try {
|
|
115
|
-
treeResp = await sparkClient.start_tree_creation({
|
|
116
|
-
identityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
117
|
-
onChainUtxo: {
|
|
118
|
-
vout: vout,
|
|
119
|
-
rawTx: depositTx.toBytes(),
|
|
120
|
-
network: this.config.getNetworkProto(),
|
|
121
|
-
},
|
|
122
|
-
rootTxSigningJob: {
|
|
123
|
-
rawTx: rootTx.toBytes(),
|
|
124
|
-
signingPublicKey: signingPubKey,
|
|
125
|
-
signingNonceCommitment: rootNonceCommitment,
|
|
126
|
-
},
|
|
127
|
-
refundTxSigningJob: {
|
|
128
|
-
rawTx: refundTx.toBytes(),
|
|
129
|
-
signingPublicKey: signingPubKey,
|
|
130
|
-
signingNonceCommitment: refundNonceCommitment,
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
throw new Error(`Error starting tree creation: ${error}`);
|
|
136
|
-
}
|
|
137
|
-
if (!treeResp.rootNodeSignatureShares?.verifyingKey) {
|
|
138
|
-
throw new Error("No verifying key found in tree response");
|
|
139
|
-
}
|
|
140
|
-
if (!treeResp.rootNodeSignatureShares.nodeTxSigningResult
|
|
141
|
-
?.signingNonceCommitments) {
|
|
142
|
-
throw new Error("No signing nonce commitments found in tree response");
|
|
143
|
-
}
|
|
144
|
-
if (!treeResp.rootNodeSignatureShares.refundTxSigningResult
|
|
145
|
-
?.signingNonceCommitments) {
|
|
146
|
-
throw new Error("No signing nonce commitments found in tree response");
|
|
147
|
-
}
|
|
148
|
-
if (!equalBytes(treeResp.rootNodeSignatureShares.verifyingKey, verifyingKey)) {
|
|
149
|
-
throw new Error("Verifying key does not match");
|
|
150
|
-
}
|
|
151
|
-
const rootSignature = await this.config.signer.signFrost({
|
|
152
|
-
message: rootTxSighash,
|
|
153
|
-
publicKey: signingPubKey,
|
|
154
|
-
privateAsPubKey: signingPubKey,
|
|
155
|
-
verifyingKey,
|
|
156
|
-
selfCommitment: rootNonceCommitment,
|
|
157
|
-
statechainCommitments: treeResp.rootNodeSignatureShares.nodeTxSigningResult
|
|
158
|
-
.signingNonceCommitments,
|
|
159
|
-
adaptorPubKey: new Uint8Array(),
|
|
160
|
-
});
|
|
161
|
-
const refundSignature = await this.config.signer.signFrost({
|
|
162
|
-
message: refundTxSighash,
|
|
163
|
-
publicKey: signingPubKey,
|
|
164
|
-
privateAsPubKey: signingPubKey,
|
|
165
|
-
verifyingKey,
|
|
166
|
-
selfCommitment: refundNonceCommitment,
|
|
167
|
-
statechainCommitments: treeResp.rootNodeSignatureShares.refundTxSigningResult
|
|
168
|
-
.signingNonceCommitments,
|
|
169
|
-
adaptorPubKey: new Uint8Array(),
|
|
170
|
-
});
|
|
171
|
-
const rootAggregate = await this.config.signer.aggregateFrost({
|
|
172
|
-
message: rootTxSighash,
|
|
173
|
-
statechainSignatures: treeResp.rootNodeSignatureShares.nodeTxSigningResult.signatureShares,
|
|
174
|
-
statechainPublicKeys: treeResp.rootNodeSignatureShares.nodeTxSigningResult.publicKeys,
|
|
175
|
-
verifyingKey: treeResp.rootNodeSignatureShares.verifyingKey,
|
|
176
|
-
statechainCommitments: treeResp.rootNodeSignatureShares.nodeTxSigningResult
|
|
177
|
-
.signingNonceCommitments,
|
|
178
|
-
selfCommitment: createWasmSigningCommitment(rootNonceCommitment),
|
|
179
|
-
publicKey: signingPubKey,
|
|
180
|
-
selfSignature: rootSignature,
|
|
181
|
-
adaptorPubKey: new Uint8Array(),
|
|
182
|
-
});
|
|
183
|
-
const refundAggregate = await this.config.signer.aggregateFrost({
|
|
184
|
-
message: refundTxSighash,
|
|
185
|
-
statechainSignatures: treeResp.rootNodeSignatureShares.refundTxSigningResult.signatureShares,
|
|
186
|
-
statechainPublicKeys: treeResp.rootNodeSignatureShares.refundTxSigningResult.publicKeys,
|
|
187
|
-
verifyingKey: treeResp.rootNodeSignatureShares.verifyingKey,
|
|
188
|
-
statechainCommitments: treeResp.rootNodeSignatureShares.refundTxSigningResult
|
|
189
|
-
.signingNonceCommitments,
|
|
190
|
-
selfCommitment: createWasmSigningCommitment(refundNonceCommitment),
|
|
191
|
-
publicKey: signingPubKey,
|
|
192
|
-
selfSignature: refundSignature,
|
|
193
|
-
adaptorPubKey: new Uint8Array(),
|
|
194
|
-
});
|
|
195
|
-
let finalizeResp;
|
|
196
|
-
try {
|
|
197
|
-
finalizeResp = await sparkClient.finalize_node_signatures({
|
|
198
|
-
intent: SignatureIntent.CREATION,
|
|
199
|
-
nodeSignatures: [
|
|
200
|
-
{
|
|
201
|
-
nodeId: treeResp.rootNodeSignatureShares.nodeId,
|
|
202
|
-
nodeTxSignature: rootAggregate,
|
|
203
|
-
refundTxSignature: refundAggregate,
|
|
204
|
-
},
|
|
205
|
-
],
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
catch (error) {
|
|
209
|
-
throw new Error(`Error finalizing node signatures in deposit: ${error}`);
|
|
210
|
-
}
|
|
211
|
-
return finalizeResp;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
//# sourceMappingURL=deposit.js.map
|