diff --git a/app/abis/strk-abi.ts b/app/abis/strk-abi.ts new file mode 100644 index 0000000..91871d2 --- /dev/null +++ b/app/abis/strk-abi.ts @@ -0,0 +1,1122 @@ +export const STRK_TOKEN_ABI = [ + { + "name": "LockingContract", + "type": "impl", + "interface_name": "src::mintable_lock_interface::ILockingContract" + }, + { + "name": "src::mintable_lock_interface::ILockingContract", + "type": "interface", + "items": [ + { + "name": "set_locking_contract", + "type": "function", + "inputs": [ + { + "name": "locking_contract", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "get_locking_contract", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "LockAndDelegate", + "type": "impl", + "interface_name": "src::mintable_lock_interface::ILockAndDelegate" + }, + { + "name": "core::integer::u256", + "type": "struct", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "name": "src::mintable_lock_interface::ILockAndDelegate", + "type": "interface", + "items": [ + { + "name": "lock_and_delegate", + "type": "function", + "inputs": [ + { + "name": "delegatee", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "lock_and_delegate_by_sig", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "delegatee", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + }, + { + "name": "nonce", + "type": "core::felt252" + }, + { + "name": "expiry", + "type": "core::integer::u64" + }, + { + "name": "signature", + "type": "core::array::Array::" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "MintableToken", + "type": "impl", + "interface_name": "src::mintable_token_interface::IMintableToken" + }, + { + "name": "src::mintable_token_interface::IMintableToken", + "type": "interface", + "items": [ + { + "name": "permissioned_mint", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "permissioned_burn", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "MintableTokenCamelImpl", + "type": "impl", + "interface_name": "src::mintable_token_interface::IMintableTokenCamel" + }, + { + "name": "src::mintable_token_interface::IMintableTokenCamel", + "type": "interface", + "items": [ + { + "name": "permissionedMint", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "permissionedBurn", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "Replaceable", + "type": "impl", + "interface_name": "src::replaceability_interface::IReplaceable" + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "src::replaceability_interface::EICData", + "type": "struct", + "members": [ + { + "name": "eic_hash", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "eic_init_data", + "type": "core::array::Span::" + } + ] + }, + { + "name": "core::option::Option::", + "type": "enum", + "variants": [ + { + "name": "Some", + "type": "src::replaceability_interface::EICData" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "name": "core::bool", + "type": "enum", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "name": "src::replaceability_interface::ImplementationData", + "type": "struct", + "members": [ + { + "name": "impl_hash", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "eic_data", + "type": "core::option::Option::" + }, + { + "name": "final", + "type": "core::bool" + } + ] + }, + { + "name": "src::replaceability_interface::IReplaceable", + "type": "interface", + "items": [ + { + "name": "get_upgrade_delay", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "get_impl_activation_time", + "type": "function", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "add_new_implementation", + "type": "function", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "remove_implementation", + "type": "function", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "replace_to", + "type": "function", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "AccessControlImplExternal", + "type": "impl", + "interface_name": "src::access_control_interface::IAccessControl" + }, + { + "name": "src::access_control_interface::IAccessControl", + "type": "interface", + "items": [ + { + "name": "has_role", + "type": "function", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + }, + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "get_role_admin", + "type": "function", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "RolesImpl", + "type": "impl", + "interface_name": "src::roles_interface::IMinimalRoles" + }, + { + "name": "src::roles_interface::IMinimalRoles", + "type": "interface", + "items": [ + { + "name": "is_governance_admin", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "is_upgrade_governor", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "register_governance_admin", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "remove_governance_admin", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "register_upgrade_governor", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "remove_upgrade_governor", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "renounce", + "type": "function", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "ERC20Impl", + "type": "impl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20" + }, + { + "name": "openzeppelin::token::erc20::interface::IERC20", + "type": "interface", + "items": [ + { + "name": "name", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "symbol", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "decimals", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u8" + } + ], + "state_mutability": "view" + }, + { + "name": "total_supply", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "balance_of", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "allowance", + "type": "function", + "inputs": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "transfer", + "type": "function", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "transfer_from", + "type": "function", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "approve", + "type": "function", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "name": "ERC20CamelOnlyImpl", + "type": "impl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20CamelOnly" + }, + { + "name": "openzeppelin::token::erc20::interface::IERC20CamelOnly", + "type": "interface", + "items": [ + { + "name": "totalSupply", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "balanceOf", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "transferFrom", + "type": "function", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "name": "constructor", + "type": "constructor", + "inputs": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "symbol", + "type": "core::felt252" + }, + { + "name": "decimals", + "type": "core::integer::u8" + }, + { + "name": "initial_supply", + "type": "core::integer::u256" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "permitted_minter", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "provisional_governance_admin", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "upgrade_delay", + "type": "core::integer::u64" + } + ] + }, + { + "name": "increase_allowance", + "type": "function", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "added_value", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "decrease_allowance", + "type": "function", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtracted_value", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "increaseAllowance", + "type": "function", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "addedValue", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "decreaseAllowance", + "type": "function", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtractedValue", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "kind": "struct", + "name": "src::strk::erc20_lockable::ERC20Lockable::Transfer", + "type": "event", + "members": [ + { + "kind": "data", + "name": "from", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "to", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "src::strk::erc20_lockable::ERC20Lockable::Approval", + "type": "event", + "members": [ + { + "kind": "data", + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "src::replaceability_interface::ImplementationAdded", + "type": "event", + "members": [ + { + "kind": "data", + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ] + }, + { + "kind": "struct", + "name": "src::replaceability_interface::ImplementationRemoved", + "type": "event", + "members": [ + { + "kind": "data", + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ] + }, + { + "kind": "struct", + "name": "src::replaceability_interface::ImplementationReplaced", + "type": "event", + "members": [ + { + "kind": "data", + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ] + }, + { + "kind": "struct", + "name": "src::replaceability_interface::ImplementationFinalized", + "type": "event", + "members": [ + { + "kind": "data", + "name": "impl_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ] + }, + { + "kind": "struct", + "name": "src::access_control_interface::RoleGranted", + "type": "event", + "members": [ + { + "kind": "data", + "name": "role", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "src::access_control_interface::RoleRevoked", + "type": "event", + "members": [ + { + "kind": "data", + "name": "role", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "src::access_control_interface::RoleAdminChanged", + "type": "event", + "members": [ + { + "kind": "data", + "name": "role", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "previous_admin_role", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "new_admin_role", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "src::roles_interface::GovernanceAdminAdded", + "type": "event", + "members": [ + { + "kind": "data", + "name": "added_account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "added_by", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "src::roles_interface::GovernanceAdminRemoved", + "type": "event", + "members": [ + { + "kind": "data", + "name": "removed_account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "removed_by", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "src::roles_interface::UpgradeGovernorAdded", + "type": "event", + "members": [ + { + "kind": "data", + "name": "added_account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "added_by", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "src::roles_interface::UpgradeGovernorRemoved", + "type": "event", + "members": [ + { + "kind": "data", + "name": "removed_account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "removed_by", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "enum", + "name": "src::strk::erc20_lockable::ERC20Lockable::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "Transfer", + "type": "src::strk::erc20_lockable::ERC20Lockable::Transfer" + }, + { + "kind": "nested", + "name": "Approval", + "type": "src::strk::erc20_lockable::ERC20Lockable::Approval" + }, + { + "kind": "nested", + "name": "ImplementationAdded", + "type": "src::replaceability_interface::ImplementationAdded" + }, + { + "kind": "nested", + "name": "ImplementationRemoved", + "type": "src::replaceability_interface::ImplementationRemoved" + }, + { + "kind": "nested", + "name": "ImplementationReplaced", + "type": "src::replaceability_interface::ImplementationReplaced" + }, + { + "kind": "nested", + "name": "ImplementationFinalized", + "type": "src::replaceability_interface::ImplementationFinalized" + }, + { + "kind": "nested", + "name": "RoleGranted", + "type": "src::access_control_interface::RoleGranted" + }, + { + "kind": "nested", + "name": "RoleRevoked", + "type": "src::access_control_interface::RoleRevoked" + }, + { + "kind": "nested", + "name": "RoleAdminChanged", + "type": "src::access_control_interface::RoleAdminChanged" + }, + { + "kind": "nested", + "name": "GovernanceAdminAdded", + "type": "src::roles_interface::GovernanceAdminAdded" + }, + { + "kind": "nested", + "name": "GovernanceAdminRemoved", + "type": "src::roles_interface::GovernanceAdminRemoved" + }, + { + "kind": "nested", + "name": "UpgradeGovernorAdded", + "type": "src::roles_interface::UpgradeGovernorAdded" + }, + { + "kind": "nested", + "name": "UpgradeGovernorRemoved", + "type": "src::roles_interface::UpgradeGovernorRemoved" + } + ] + } + ] \ No newline at end of file diff --git a/app/abis/swappr-abi.ts b/app/abis/swappr-abi.ts index 7f1e567..24dde51 100644 --- a/app/abis/swappr-abi.ts +++ b/app/abis/swappr-abi.ts @@ -2,17 +2,17 @@ import type { Abi } from "starknet"; export const SWAPPR_ABI = [ { - type: "impl", name: "UpgradeableImpl", + type: "impl", interface_name: "openzeppelin_upgrades::interface::IUpgradeable", }, { - type: "interface", name: "openzeppelin_upgrades::interface::IUpgradeable", + type: "interface", items: [ { - type: "function", name: "upgrade", + type: "function", inputs: [ { name: "new_class_hash", @@ -25,13 +25,13 @@ export const SWAPPR_ABI = [ ], }, { - type: "impl", name: "AutoSwappr", + type: "impl", interface_name: "auto_swappr::interfaces::iautoswappr::IAutoSwappr", }, { - type: "struct", name: "core::integer::u256", + type: "struct", members: [ { name: "low", @@ -44,8 +44,8 @@ export const SWAPPR_ABI = [ ], }, { - type: "struct", name: "auto_swappr::base::types::Route", + type: "struct", members: [ { name: "token_from", @@ -70,8 +70,8 @@ export const SWAPPR_ABI = [ ], }, { - type: "struct", name: "auto_swappr::base::types::RouteParams", + type: "struct", members: [ { name: "token_in", @@ -96,8 +96,8 @@ export const SWAPPR_ABI = [ ], }, { - type: "struct", name: "auto_swappr::base::types::SwapParams", + type: "struct", members: [ { name: "token_in", @@ -126,38 +126,56 @@ export const SWAPPR_ABI = [ ], }, { - type: "struct", + name: "auto_swappr::base::types::FeeType", + type: "enum", + variants: [ + { + name: "Fixed", + type: "()", + }, + { + name: "Percentage", + type: "()", + }, + ], + }, + { name: "auto_swappr::interfaces::iautoswappr::ContractInfo", + type: "struct", members: [ { name: "fees_collector", type: "core::starknet::contract_address::ContractAddress", }, - { - name: "avnu_exchange_address", - type: "core::starknet::contract_address::ContractAddress", - }, { name: "fibrous_exchange_address", type: "core::starknet::contract_address::ContractAddress", }, { - name: "strk_token", + name: "avnu_exchange_address", type: "core::starknet::contract_address::ContractAddress", }, { - name: "eth_token", + name: "oracle_address", type: "core::starknet::contract_address::ContractAddress", }, { name: "owner", type: "core::starknet::contract_address::ContractAddress", }, + { + name: "fee_type", + type: "auto_swappr::base::types::FeeType", + }, + { + name: "percentage_fee", + type: "core::integer::u16", + }, ], }, { - type: "enum", name: "core::bool", + type: "enum", variants: [ { name: "False", @@ -170,13 +188,121 @@ export const SWAPPR_ABI = [ ], }, { - type: "interface", + name: "ekubo::types::i129::i129", + type: "struct", + members: [ + { + name: "mag", + type: "core::integer::u128", + }, + { + name: "sign", + type: "core::bool", + }, + ], + }, + { + name: "ekubo::interfaces::core::SwapParameters", + type: "struct", + members: [ + { + name: "amount", + type: "ekubo::types::i129::i129", + }, + { + name: "is_token1", + type: "core::bool", + }, + { + name: "sqrt_ratio_limit", + type: "core::integer::u256", + }, + { + name: "skip_ahead", + type: "core::integer::u128", + }, + ], + }, + { + name: "ekubo::types::keys::PoolKey", + type: "struct", + members: [ + { + name: "token0", + type: "core::starknet::contract_address::ContractAddress", + }, + { + name: "token1", + type: "core::starknet::contract_address::ContractAddress", + }, + { + name: "fee", + type: "core::integer::u128", + }, + { + name: "tick_spacing", + type: "core::integer::u128", + }, + { + name: "extension", + type: "core::starknet::contract_address::ContractAddress", + }, + ], + }, + { + name: "auto_swappr::base::types::SwapData", + type: "struct", + members: [ + { + name: "params", + type: "ekubo::interfaces::core::SwapParameters", + }, + { + name: "pool_key", + type: "ekubo::types::keys::PoolKey", + }, + { + name: "caller", + type: "core::starknet::contract_address::ContractAddress", + }, + ], + }, + { + name: "ekubo::types::delta::Delta", + type: "struct", + members: [ + { + name: "amount0", + type: "ekubo::types::i129::i129", + }, + { + name: "amount1", + type: "ekubo::types::i129::i129", + }, + ], + }, + { + name: "auto_swappr::base::types::SwapResult", + type: "struct", + members: [ + { + name: "delta", + type: "ekubo::types::delta::Delta", + }, + ], + }, + { name: "auto_swappr::interfaces::iautoswappr::IAutoSwappr", + type: "interface", items: [ { - type: "function", name: "avnu_swap", + type: "function", inputs: [ + { + name: "protocol_swapper", + type: "core::starknet::contract_address::ContractAddress", + }, { name: "token_from_address", type: "core::starknet::contract_address::ContractAddress", @@ -189,10 +315,6 @@ export const SWAPPR_ABI = [ name: "token_to_address", type: "core::starknet::contract_address::ContractAddress", }, - { - name: "token_to_amount", - type: "core::integer::u256", - }, { name: "token_to_min_amount", type: "core::integer::u256", @@ -218,8 +340,8 @@ export const SWAPPR_ABI = [ state_mutability: "external", }, { - type: "function", name: "fibrous_swap", + type: "function", inputs: [ { name: "routeParams", @@ -229,13 +351,21 @@ export const SWAPPR_ABI = [ name: "swapParams", type: "core::array::Array::", }, + { + name: "protocol_swapper", + type: "core::starknet::contract_address::ContractAddress", + }, + { + name: "beneficiary", + type: "core::starknet::contract_address::ContractAddress", + }, ], outputs: [], state_mutability: "external", }, { - type: "function", name: "contract_parameters", + type: "function", inputs: [], outputs: [ { @@ -245,23 +375,27 @@ export const SWAPPR_ABI = [ state_mutability: "view", }, { + name: "support_new_token_from", type: "function", - name: "set_operator", inputs: [ { - name: "address", + name: "token_from", type: "core::starknet::contract_address::ContractAddress", }, + { + name: "feed_id", + type: "core::felt252", + }, ], outputs: [], state_mutability: "external", }, { + name: "remove_token_from", type: "function", - name: "remove_operator", inputs: [ { - name: "address", + name: "token_from", type: "core::starknet::contract_address::ContractAddress", }, ], @@ -269,57 +403,144 @@ export const SWAPPR_ABI = [ state_mutability: "external", }, { + name: "get_token_amount_in_usd", type: "function", - name: "is_operator", inputs: [ { - name: "address", + name: "token", type: "core::starknet::contract_address::ContractAddress", }, + { + name: "token_amount", + type: "core::integer::u256", + }, ], outputs: [ { - type: "core::bool", + type: "core::integer::u256", }, ], state_mutability: "view", }, { + name: "get_token_from_status_and_value", type: "function", - name: "get_strk_usd_price", - inputs: [], + inputs: [ + { + name: "token_from", + type: "core::starknet::contract_address::ContractAddress", + }, + ], outputs: [ { - type: "(core::integer::u128, core::integer::u32)", + type: "(core::bool, core::felt252)", }, ], state_mutability: "view", }, { + name: "set_fee_type", type: "function", - name: "get_eth_usd_price", - inputs: [], + inputs: [ + { + name: "fee_type", + type: "auto_swappr::base::types::FeeType", + }, + { + name: "percentage_fee", + type: "core::integer::u16", + }, + ], + outputs: [], + state_mutability: "external", + }, + { + name: "ekubo_swap", + type: "function", + inputs: [ + { + name: "swap_data", + type: "auto_swappr::base::types::SwapData", + }, + ], outputs: [ { - type: "(core::integer::u128, core::integer::u32)", + type: "auto_swappr::base::types::SwapResult", }, ], - state_mutability: "view", + state_mutability: "external", + }, + { + name: "ekubo_manual_swap", + type: "function", + inputs: [ + { + name: "swap_data", + type: "auto_swappr::base::types::SwapData", + }, + ], + outputs: [ + { + type: "auto_swappr::base::types::SwapResult", + }, + ], + state_mutability: "external", }, ], }, { + name: "LockerImpl", type: "impl", + interface_name: "ekubo::interfaces::core::ILocker", + }, + { + name: "core::array::Span::", + type: "struct", + members: [ + { + name: "snapshot", + type: "@core::array::Array::", + }, + ], + }, + { + name: "ekubo::interfaces::core::ILocker", + type: "interface", + items: [ + { + name: "locked", + type: "function", + inputs: [ + { + name: "id", + type: "core::integer::u32", + }, + { + name: "data", + type: "core::array::Span::", + }, + ], + outputs: [ + { + type: "core::array::Span::", + }, + ], + state_mutability: "external", + }, + ], + }, + { name: "OwnableImpl", + type: "impl", interface_name: "openzeppelin_access::ownable::interface::IOwnable", }, { - type: "interface", name: "openzeppelin_access::ownable::interface::IOwnable", + type: "interface", items: [ { - type: "function", name: "owner", + type: "function", inputs: [], outputs: [ { @@ -329,8 +550,8 @@ export const SWAPPR_ABI = [ state_mutability: "view", }, { - type: "function", name: "transfer_ownership", + type: "function", inputs: [ { name: "new_owner", @@ -341,8 +562,8 @@ export const SWAPPR_ABI = [ state_mutability: "external", }, { - type: "function", name: "renounce_ownership", + type: "function", inputs: [], outputs: [], state_mutability: "external", @@ -350,13 +571,68 @@ export const SWAPPR_ABI = [ ], }, { - type: "constructor", + name: "OperatorImpl", + type: "impl", + interface_name: "auto_swappr::interfaces::ioperator::IOperator", + }, + { + name: "auto_swappr::interfaces::ioperator::IOperator", + type: "interface", + items: [ + { + name: "set_operator", + type: "function", + inputs: [ + { + name: "address", + type: "core::starknet::contract_address::ContractAddress", + }, + ], + outputs: [], + state_mutability: "external", + }, + { + name: "remove_operator", + type: "function", + inputs: [ + { + name: "address", + type: "core::starknet::contract_address::ContractAddress", + }, + ], + outputs: [], + state_mutability: "external", + }, + { + name: "is_operator", + type: "function", + inputs: [ + { + name: "address", + type: "core::starknet::contract_address::ContractAddress", + }, + ], + outputs: [ + { + type: "core::bool", + }, + ], + state_mutability: "view", + }, + ], + }, + { name: "constructor", + type: "constructor", inputs: [ { name: "fees_collector", type: "core::starknet::contract_address::ContractAddress", }, + { + name: "fee_amount_bps", + type: "core::integer::u8", + }, { name: "avnu_exchange_address", type: "core::starknet::contract_address::ContractAddress", @@ -366,256 +642,307 @@ export const SWAPPR_ABI = [ type: "core::starknet::contract_address::ContractAddress", }, { - name: "oracle_address", + name: "ekubo_core_address", type: "core::starknet::contract_address::ContractAddress", }, { - name: "_strk_token", + name: "oracle_address", type: "core::starknet::contract_address::ContractAddress", }, { - name: "_eth_token", - type: "core::starknet::contract_address::ContractAddress", + name: "supported_assets", + type: "core::array::Array::", + }, + { + name: "supported_assets_priceFeeds_ids", + type: "core::array::Array::", }, { name: "owner", type: "core::starknet::contract_address::ContractAddress", }, + { + name: "initial_fee_type", + type: "auto_swappr::base::types::FeeType", + }, + { + name: "initial_percentage_fee", + type: "core::integer::u16", + }, ], }, { - type: "event", - name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred", kind: "struct", + name: "auto_swappr::autoswappr::AutoSwappr::SwapSuccessful", + type: "event", members: [ { - name: "previous_owner", + kind: "data", + name: "token_from_address", type: "core::starknet::contract_address::ContractAddress", - kind: "key", }, { - name: "new_owner", + kind: "data", + name: "token_from_amount", + type: "core::integer::u256", + }, + { + kind: "data", + name: "token_to_address", type: "core::starknet::contract_address::ContractAddress", - kind: "key", }, - ], - }, - { - type: "event", - name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted", - kind: "struct", - members: [ { - name: "previous_owner", + kind: "data", + name: "token_to_amount", + type: "core::integer::u256", + }, + { + kind: "data", + name: "beneficiary", type: "core::starknet::contract_address::ContractAddress", - kind: "key", }, { - name: "new_owner", + kind: "data", + name: "provider", type: "core::starknet::contract_address::ContractAddress", - kind: "key", }, ], }, { - type: "event", - name: "openzeppelin_access::ownable::ownable::OwnableComponent::Event", - kind: "enum", - variants: [ + name: "auto_swappr::base::types::Assets", + type: "struct", + members: [ { - name: "OwnershipTransferred", - type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred", - kind: "nested", + name: "strk", + type: "core::bool", }, { - name: "OwnershipTransferStarted", - type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted", - kind: "nested", + name: "eth", + type: "core::bool", }, ], }, { - type: "event", - name: "openzeppelin_upgrades::upgradeable::UpgradeableComponent::Upgraded", kind: "struct", + name: "auto_swappr::autoswappr::AutoSwappr::Subscribed", + type: "event", members: [ { - name: "class_hash", - type: "core::starknet::class_hash::ClassHash", kind: "data", + name: "user", + type: "core::starknet::contract_address::ContractAddress", }, - ], - }, - { - type: "event", - name: "openzeppelin_upgrades::upgradeable::UpgradeableComponent::Event", - kind: "enum", - variants: [ { - name: "Upgraded", - type: "openzeppelin_upgrades::upgradeable::UpgradeableComponent::Upgraded", - kind: "nested", + kind: "data", + name: "assets", + type: "auto_swappr::base::types::Assets", }, ], }, { - type: "event", - name: "auto_swappr::autoswappr::AutoSwappr::SwapSuccessful", kind: "struct", + name: "auto_swappr::autoswappr::AutoSwappr::Unsubscribed", + type: "event", members: [ { - name: "token_from_address", - type: "core::starknet::contract_address::ContractAddress", kind: "data", + name: "user", + type: "core::starknet::contract_address::ContractAddress", }, { - name: "token_from_amount", - type: "core::integer::u256", kind: "data", + name: "assets", + type: "auto_swappr::base::types::Assets", }, { - name: "token_to_address", - type: "core::starknet::contract_address::ContractAddress", kind: "data", + name: "block_timestamp", + type: "core::integer::u64", }, + ], + }, + { + kind: "struct", + name: "auto_swappr::autoswappr::AutoSwappr::FeeTypeChanged", + type: "event", + members: [ { - name: "token_to_amount", - type: "core::integer::u256", kind: "data", + name: "new_fee_type", + type: "auto_swappr::base::types::FeeType", }, { - name: "beneficiary", - type: "core::starknet::contract_address::ContractAddress", kind: "data", + name: "new_percentage_fee", + type: "core::integer::u16", }, ], }, { - type: "struct", - name: "auto_swappr::base::types::Assets", + kind: "struct", + name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred", + type: "event", members: [ { - name: "strk", - type: "core::bool", + kind: "key", + name: "previous_owner", + type: "core::starknet::contract_address::ContractAddress", }, { - name: "eth", - type: "core::bool", + kind: "key", + name: "new_owner", + type: "core::starknet::contract_address::ContractAddress", }, ], }, { - type: "event", - name: "auto_swappr::autoswappr::AutoSwappr::Subscribed", kind: "struct", + name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted", + type: "event", members: [ { - name: "user", + kind: "key", + name: "previous_owner", type: "core::starknet::contract_address::ContractAddress", - kind: "data", }, { - name: "assets", - type: "auto_swappr::base::types::Assets", - kind: "data", + kind: "key", + name: "new_owner", + type: "core::starknet::contract_address::ContractAddress", }, ], }, { + kind: "enum", + name: "openzeppelin_access::ownable::ownable::OwnableComponent::Event", type: "event", - name: "auto_swappr::autoswappr::AutoSwappr::Unsubscribed", - kind: "struct", - members: [ + variants: [ { - name: "user", - type: "core::starknet::contract_address::ContractAddress", - kind: "data", + kind: "nested", + name: "OwnershipTransferred", + type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred", }, { - name: "assets", - type: "auto_swappr::base::types::Assets", - kind: "data", + kind: "nested", + name: "OwnershipTransferStarted", + type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted", }, + ], + }, + { + kind: "struct", + name: "openzeppelin_upgrades::upgradeable::UpgradeableComponent::Upgraded", + type: "event", + members: [ { - name: "block_timestamp", - type: "core::integer::u64", kind: "data", + name: "class_hash", + type: "core::starknet::class_hash::ClassHash", }, ], }, { + kind: "enum", + name: "openzeppelin_upgrades::upgradeable::UpgradeableComponent::Event", type: "event", - name: "auto_swappr::autoswappr::AutoSwappr::OperatorAdded", + variants: [ + { + kind: "nested", + name: "Upgraded", + type: "openzeppelin_upgrades::upgradeable::UpgradeableComponent::Upgraded", + }, + ], + }, + { kind: "struct", + name: "auto_swappr::components::operator::OperatorComponent::OperatorAdded", + type: "event", members: [ { + kind: "data", name: "operator", type: "core::starknet::contract_address::ContractAddress", - kind: "data", }, { + kind: "data", name: "time_added", type: "core::integer::u64", - kind: "data", }, ], }, { - type: "event", - name: "auto_swappr::autoswappr::AutoSwappr::OperatorRemoved", kind: "struct", + name: "auto_swappr::components::operator::OperatorComponent::OperatorRemoved", + type: "event", members: [ { + kind: "data", name: "operator", type: "core::starknet::contract_address::ContractAddress", - kind: "data", }, { + kind: "data", name: "time_removed", type: "core::integer::u64", - kind: "data", }, ], }, { - type: "event", - name: "auto_swappr::autoswappr::AutoSwappr::Event", kind: "enum", + name: "auto_swappr::components::operator::OperatorComponent::Event", + type: "event", variants: [ { - name: "OwnableEvent", - type: "openzeppelin_access::ownable::ownable::OwnableComponent::Event", - kind: "flat", + kind: "nested", + name: "OperatorAdded", + type: "auto_swappr::components::operator::OperatorComponent::OperatorAdded", }, { - name: "UpgradeableEvent", - type: "openzeppelin_upgrades::upgradeable::UpgradeableComponent::Event", - kind: "flat", + kind: "nested", + name: "OperatorRemoved", + type: "auto_swappr::components::operator::OperatorComponent::OperatorRemoved", }, + ], + }, + { + kind: "enum", + name: "auto_swappr::autoswappr::AutoSwappr::Event", + type: "event", + variants: [ { + kind: "nested", name: "SwapSuccessful", type: "auto_swappr::autoswappr::AutoSwappr::SwapSuccessful", - kind: "nested", }, { + kind: "nested", name: "Subscribed", type: "auto_swappr::autoswappr::AutoSwappr::Subscribed", - kind: "nested", }, { + kind: "nested", name: "Unsubscribed", type: "auto_swappr::autoswappr::AutoSwappr::Unsubscribed", - kind: "nested", }, { - name: "OperatorAdded", - type: "auto_swappr::autoswappr::AutoSwappr::OperatorAdded", kind: "nested", + name: "FeeTypeChanged", + type: "auto_swappr::autoswappr::AutoSwappr::FeeTypeChanged", }, { - name: "OperatorRemoved", - type: "auto_swappr::autoswappr::AutoSwappr::OperatorRemoved", - kind: "nested", + kind: "flat", + name: "OwnableEvent", + type: "openzeppelin_access::ownable::ownable::OwnableComponent::Event", + }, + { + kind: "flat", + name: "UpgradeableEvent", + type: "openzeppelin_upgrades::upgradeable::UpgradeableComponent::Event", + }, + { + kind: "flat", + name: "OperatorEvent", + type: "auto_swappr::components::operator::OperatorComponent::Event", }, ], }, diff --git a/app/components/address.tsx b/app/components/address.tsx index 313f6b5..df97656 100644 --- a/app/components/address.tsx +++ b/app/components/address.tsx @@ -1,40 +1,45 @@ "use client"; +import { useState, useEffect } from "react"; import { useAccount } from "@starknet-react/core"; -import { MoreVertical } from "lucide-react"; -import { useState } from "react"; import { shortenAddress } from "../utils/helper"; import DisconnectModal from "./ui/modals/disconnect-wallet-modal"; +import { getUserStrkBalance } from "@/services/getUserStrkBalance"; export default function Address() { const [isModalOpen, setIsModalOpen] = useState(false); - const { address } = useAccount(); + const { address, account } = useAccount(); + const [balance, setBalance] = useState(0); + useEffect(() => { + const fetchBalance = async () => { + if (!address || !account) { + setBalance(0); + return; + } + + const balanceValue = await getUserStrkBalance(address, account); + setBalance(Number(balanceValue.toFixed(2))); + }; + fetchBalance(); + }, [address, account]); return (
- {/* {isModalOpen && - createPortal( - setIsModalOpen(false)} />, - document.body - )} */} setIsModalOpen((prev) => !prev)} /> -
+
USDT icon - USDT: $114.00 + STRK: {balance}
-
+
setIsModalOpen(true)}> {address ? shortenAddress(address) : ""} -
); diff --git a/app/components/layout/sections/landing-hero-section.tsx b/app/components/layout/sections/landing-hero-section.tsx index b6c9dcf..9716d4d 100644 --- a/app/components/layout/sections/landing-hero-section.tsx +++ b/app/components/layout/sections/landing-hero-section.tsx @@ -37,7 +37,7 @@ function LandingHeroSection() {

- +
+
+ +
+ + +
+
+ + ); } diff --git a/app/components/starknet-provider.tsx b/app/components/starknet-provider.tsx index 817fddd..d1c77d1 100644 --- a/app/components/starknet-provider.tsx +++ b/app/components/starknet-provider.tsx @@ -1,7 +1,7 @@ "use client"; import React from "react"; -import { sepolia } from "@starknet-react/chains"; +import { mainnet } from "@starknet-react/chains"; import { StarknetConfig, argent, @@ -23,7 +23,7 @@ export function StarknetProvider({ children }: { children: React.ReactNode }) { return ( ({ nodeUrl: process.env.NEXT_PUBLIC_RPC_URL }), diff --git a/app/components/ui/modals/change-autoswap-settings.tsx b/app/components/ui/modals/change-autoswap-settings.tsx index 2ac2182..7e5c5d0 100644 --- a/app/components/ui/modals/change-autoswap-settings.tsx +++ b/app/components/ui/modals/change-autoswap-settings.tsx @@ -1,27 +1,71 @@ -import { useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import { EditIcon } from "lucide-react"; import GrantPermission from "./grant-permission-modal"; import { useSubscription } from "../../../hooks/useSubscription"; import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../dialog"; +interface ChangeAutoswapSettingsProps { + open: boolean; + onOpenChange: () => void; + currentAllowance: number; + isLoadingAllowance: boolean; + allowanceError?: Error | null; + onAllowanceRefresh: () => void; +} + export default function ChangeAutoswapSettings({ open, onOpenChange, -}: { - onOpenChange: () => void; - open: boolean; -}) { + currentAllowance, + isLoadingAllowance, + allowanceError, + onAllowanceRefresh, +}: ChangeAutoswapSettingsProps) { const [newSwapAmount, setNewSwapAmount] = useState(""); + const [isGrantPermissionLoading, setIsGrantPermissionLoading] = + useState(false); + + const { + isPermissionModalOpen, + setIsPermissionModalOpen, + handleSubscribe, + } = useSubscription(newSwapAmount, { + onSuccess: () => { + onAllowanceRefresh(); + onOpenChange(); + setNewSwapAmount(""); + }, + }); + + useEffect(() => { + if (!open) return; + if (currentAllowance && currentAllowance > 0) { + setNewSwapAmount(Math.floor(currentAllowance).toString()); + } else { + setNewSwapAmount(""); + } + }, [open, currentAllowance]); - const { isPermissionModalOpen, setIsPermissionModalOpen, handleSubscribe } = - useSubscription(newSwapAmount); + const isApplyDisabled = useMemo(() => { + if (!newSwapAmount) return true; + const parsedValue = Number(newSwapAmount); + return Number.isNaN(parsedValue) || parsedValue <= 0; + }, [newSwapAmount]); return ( <> setIsPermissionModalOpen((prev) => !prev)} open={isPermissionModalOpen} - handleSubmit={handleSubscribe} + handleSubmit={async () => { + setIsGrantPermissionLoading(true); + try { + await handleSubscribe(); + } finally { + setIsGrantPermissionLoading(false); + } + }} + isSubmitting={isGrantPermissionLoading} /> @@ -40,13 +84,29 @@ export default function ChangeAutoswapSettings({

Current threshold amount:

-
+
- 3000 STRK + {isLoadingAllowance ? ( + + Fetching allowance... + + ) : allowanceError ? ( + + Unable to load allowance + + ) : ( + + {currentAllowance.toLocaleString(undefined, { + maximumFractionDigits: 2, + minimumFractionDigits: 0, + })}{" "} + STRK + + )}
@@ -61,7 +121,11 @@ export default function ChangeAutoswapSettings({ className="bg-transparent w-full text-sm p-1 placeholder:text-grey-900 text-white border-none focus:outline-none" placeholder="e.g.: 294839 STRK" value={newSwapAmount} - onChange={(e) => setNewSwapAmount(e.target.value)} + onChange={(e) => { + const rawValue = e.target.value; + const sanitizedValue = rawValue.replace(/[^\d]/g, ""); + setNewSwapAmount(sanitizedValue); + }} required /> @@ -71,11 +135,11 @@ export default function ChangeAutoswapSettings({ - ); - })} + > + {details.name} +
+ + {details.name} + + + {details.subtext} + +
+ + ); + }) + )} - -
+ {isSubmitting ? ( +
+ + + + + Waiting for wallet confirmation... +
+ ) : ( +
+ + +
+ )} diff --git a/app/hooks/useSubscription.ts b/app/hooks/useSubscription.ts index 80bf97f..c091c91 100644 --- a/app/hooks/useSubscription.ts +++ b/app/hooks/useSubscription.ts @@ -4,13 +4,21 @@ import { useRouter } from "next/navigation"; import { useAccount } from "@starknet-react/core"; import { STRK_TOKEN, USDT_TOKEN } from "../utils/data"; import { swappr_contract_address } from "../utils/addresses"; -import { ERC20_ABI } from "../abis/erc20-abi"; +import { STRK_TOKEN_ABI } from "../abis/strk-abi"; import { createSubscription, useContractWriteUtility } from "../utils/helper"; -export function useSubscription(swapAmount: string) { +interface UseSubscriptionOptions { + onSuccess?: () => void; +} + +export function useSubscription( + swapAmount: string, + options?: UseSubscriptionOptions +) { const { address } = useAccount(); const router = useRouter(); const [isPermissionModalOpen, setIsPermissionModalOpen] = useState(false); + const onSuccess = options?.onSuccess; const { writeAsync, waitData } = useContractWriteUtility( "approve", @@ -20,8 +28,8 @@ export function useSubscription(swapAmount: string) { ? BigInt(swapAmount) * BigInt(10 ** STRK_TOKEN.decimals) : BigInt(0), ], - ERC20_ABI, - STRK_TOKEN.contractAddress, + STRK_TOKEN_ABI, + STRK_TOKEN.contractAddress ); useEffect(() => { @@ -36,14 +44,18 @@ export function useSubscription(swapAmount: string) { swap_amount: Number(swapAmount), }); setIsPermissionModalOpen(false); - router.push("/overview"); + if (onSuccess) { + onSuccess(); + } else { + router.push("/overview"); + } } catch (error) { console.error("Subscription error:", error); } }; subscribe(); - }, [waitData, address, router, swapAmount]); + }, [waitData, address, router, swapAmount, onSuccess]); const handleSubscribe = useCallback(async () => { try { diff --git a/app/layout.tsx b/app/layout.tsx index 5e6e62d..37ff6f5 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,10 +1,34 @@ import type { Metadata } from "next"; +import localFont from "next/font/local"; +import NextTopLoader from "nextjs-toploader"; import "./globals.css"; import Navbar from "./components/navbar"; import { StarknetProvider } from "./components/starknet-provider"; import Footer from "./components/footer"; import { siteConfig } from "@/config/site"; +const creatoDisplay = localFont({ + src: [ + { + path: "../public/fonts/CreatoDisplay-Regular.otf", + weight: "400", + style: "normal", + }, + { + path: "../public/fonts/CreatoDisplay-Medium.otf", + weight: "500", + style: "normal", + }, + { + path: "../public/fonts/CreatoDisplay-Bold.otf", + weight: "700", + style: "normal", + }, + ], + variable: "--font-creato-display", + display: "swap", +}); + export const metadata: Metadata = { metadataBase: new URL(siteConfig.url.base), title: { default: siteConfig.name, template: `%s | ${siteConfig.name}` }, @@ -45,9 +69,17 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - + - + +
{children}