Skip to content

Commit

Permalink
feat: Updated transaction type for Starknet support
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoAguzzi committed Mar 5, 2024
1 parent d6e3e3b commit 9e76432
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/swap/src/providers/propeller-heads/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
StatusOptionsResponse,
SupportedNetworkName,
SwapQuote,
SwapTransaction,
TokenType,
TransactionStatus,
TransactionType,
Expand Down Expand Up @@ -58,8 +59,7 @@ const supportedNetworks: {
[SupportedNetworkName.Starknet]: {
approvalAddress:
"0x060b1a6a696cbd77df0b6be6a2a951cf0fc7b951304a9371eac2f5d05a77357f",
// TODO: Update chain id
chainId: "137",
chainId: "0x534e5f4d41494e",
},
};

Expand Down Expand Up @@ -177,7 +177,11 @@ class PropellerHeads extends ProviderClass {
})
.then((res) => res.json())
.then(async (response: PropellerHeadsResponseType) => {
const transactions: EVMTransaction[] = [];
const transactions: SwapTransaction[] = [];
const transactionType: TransactionType =
this.network === SupportedNetworkName.Starknet
? TransactionType.generic
: TransactionType.evm;

if (options.fromToken.address !== NATIVE_TOKEN_ADDRESS) {
const approvalTxs = await getAllowanceTransactions({
Expand All @@ -196,7 +200,7 @@ class PropellerHeads extends ProviderClass {
to: options.fromAddress,
value: numberToHex(options.amount),
data: stringToHex(JSON.stringify(response)),
type: TransactionType.evm,
type: transactionType,
});

return {
Expand Down

0 comments on commit 9e76432

Please sign in to comment.