Skip to content

Commit 950afce

Browse files
committed
Support mult-mint and multi-vm remote send
1 parent a2a0b06 commit 950afce

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

pkg/code/async/account/gift_card.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func insertAutoReturnIntentRecord(ctx context.Context, data code_data.Provider,
317317
IntentId: getAutoReturnIntentId(giftCardIssuedIntent.IntentId),
318318
IntentType: intent.ReceivePaymentsPublicly,
319319

320-
MintAccount: common.CoreMintAccount.PublicKey().ToBase58(),
320+
MintAccount: mintAccount.PublicKey().ToBase58(),
321321

322322
InitiatorOwnerAccount: giftCardIssuedIntent.InitiatorOwnerAccount,
323323

pkg/code/server/transaction/intent.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -787,13 +787,13 @@ func (s *transactionServer) GetIntentMetadata(ctx context.Context, req *transact
787787
log.WithError(err).Warn("failure getting source account info record")
788788
return nil, status.Error(codes.Internal, "")
789789
}
790-
coreMintSourceAccountInfoRecord, ok := sourceAccountInfoRecordsByMint[mintAccount.PublicKey().ToBase58()]
790+
sourceAccountInfoRecord, ok := sourceAccountInfoRecordsByMint[mintAccount.PublicKey().ToBase58()]
791791
if !ok {
792792
log.WithError(err).Warn("core mint source account info record doesn't exist")
793793
return nil, status.Error(codes.Internal, "")
794794
}
795795

796-
sourceAccount, err := common.NewAccountFromPublicKeyString(coreMintSourceAccountInfoRecord.TokenAccount)
796+
sourceAccount, err := common.NewAccountFromPublicKeyString(sourceAccountInfoRecord.TokenAccount)
797797
if err != nil {
798798
log.WithError(err).Warn("invalid source account")
799799
return nil, status.Error(codes.Internal, "")
@@ -1050,7 +1050,13 @@ func (s *transactionServer) VoidGiftCard(ctx context.Context, req *transactionpb
10501050

10511051
claimedActionRecord, err := s.data.GetGiftCardClaimedAction(ctx, giftCardVault.PublicKey().ToBase58())
10521052
if err == nil {
1053-
vmConfig, err := common.GetVmConfigForMint(ctx, s.data, common.CoreMintAccount)
1053+
mintAccount, err := common.NewAccountFromPublicKeyString(accountInfoRecord.MintAccount)
1054+
if err != nil {
1055+
log.WithError(err).Warn("invalid mint account")
1056+
return nil, status.Error(codes.Internal, "")
1057+
}
1058+
1059+
vmConfig, err := common.GetVmConfigForMint(ctx, s.data, mintAccount)
10541060
if err != nil {
10551061
log.WithError(err).Warn("failure getting vm config")
10561062
return nil, status.Error(codes.Internal, "")

pkg/code/server/transaction/intent_handler.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,6 @@ func (h *SendPublicPaymentIntentHandler) PopulateMetadata(ctx context.Context, i
346346
if err != nil {
347347
return err
348348
}
349-
if !common.IsCoreMint(mint) && typedProtoMetadata.IsRemoteSend {
350-
return NewIntentValidationError("only the core mint is supported for remote send")
351-
}
352349
if !common.IsCoreMint(mint) && typedProtoMetadata.IsWithdrawal {
353350
return NewIntentValidationError("only the core mint is supported for withdrawals")
354351
}

0 commit comments

Comments
 (0)