Skip to content

Commit

Permalink
Fix: Withdrawals for ledger compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Salvionied committed Nov 13, 2023
1 parent b9ddada commit cc0d755
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ApolloBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type Apollo struct {
totalCollateral int
referenceInputs []TransactionInput.TransactionInput
collateralReturn *TransactionOutput.TransactionOutput
withdrawals Withdrawal.Withdrawal
withdrawals *Withdrawal.Withdrawal
certificates *Certificate.Certificates
nativescripts []NativeScript.NativeScript
usedUtxos []string
Expand Down Expand Up @@ -106,7 +106,6 @@ func New(cc Base.ChainContext) *Apollo {
stakeRedeemers: make(map[string]Redeemer.Redeemer),
mint: make([]Unit, 0),
collaterals: make([]UTxO.UTxO, 0),
withdrawals: Withdrawal.New(),
Fee: 0,
FeePadding: 0,
usedUtxos: make([]string, 0),
Expand Down Expand Up @@ -647,7 +646,7 @@ func (b *Apollo) buildTxBody() (TransactionBody.TransactionBody, error) {
ValidityStart: b.ValidityStart,
Collateral: collaterals,
Certificates: b.certificates,
Withdrawals: &b.withdrawals,
Withdrawals: b.withdrawals,
ReferenceInputs: b.referenceInputs}
if b.totalCollateral != 0 {
txb.TotalCollateral = b.totalCollateral
Expand Down Expand Up @@ -1664,6 +1663,10 @@ func (b *Apollo) DisableExecutionUnitsEstimation() *Apollo {
}

func (b *Apollo) AddWithdrawal(address Address.Address, amount int, redeemerData PlutusData.PlutusData) *Apollo {
if b.withdrawals == nil {
newWithdrawal := Withdrawal.New()
b.withdrawals = &newWithdrawal
}
var stakeAddr [29]byte
stakeAddr[0] = address.HeaderByte
if len(address.StakingPart) != 28 {
Expand Down

0 comments on commit cc0d755

Please sign in to comment.