From e6b0551a8d66a3891b3c51fe80514bab9495b50e Mon Sep 17 00:00:00 2001 From: Chris Lexmond Date: Wed, 13 Nov 2024 17:00:38 +0100 Subject: [PATCH] Updated for new abis and core sample permission --- src/contracts/starknet_abis.json | 324 ---------------------------- src/contracts/starknet_events.json | 44 ++++ src/contracts/starknet_systems.json | 68 ++++++ src/lib/permission.js | 7 +- 4 files changed, 118 insertions(+), 325 deletions(-) diff --git a/src/contracts/starknet_abis.json b/src/contracts/starknet_abis.json index 83e4dae..ea61abe 100644 --- a/src/contracts/starknet_abis.json +++ b/src/contracts/starknet_abis.json @@ -2973,330 +2973,6 @@ ] } ], - "Escrow": [ - { - "type": "constructor", - "name": "constructor", - "inputs": [ - { - "name": "admin", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "type": "function", - "name": "upgrade", - "inputs": [ - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "struct", - "name": "core::integer::u256", - "members": [ - { - "name": "low", - "type": "core::integer::u128" - }, - { - "name": "high", - "type": "core::integer::u128" - } - ] - }, - { - "type": "function", - "name": "balance_of", - "inputs": [ - { - "name": "order_id", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "struct", - "name": "influence::contracts::escrow::Hook", - "members": [ - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "entry_point_selector", - "type": "core::felt252" - }, - { - "name": "calldata", - "type": "core::array::Span::" - } - ] - }, - { - "type": "function", - "name": "deposit", - "inputs": [ - { - "name": "token", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "amount", - "type": "core::integer::u256" - }, - { - "name": "withdraw_hook", - "type": "influence::contracts::escrow::Hook" - }, - { - "name": "deposit_hook", - "type": "influence::contracts::escrow::Hook" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "external" - }, - { - "type": "struct", - "name": "influence::contracts::escrow::Withdrawal", - "members": [ - { - "name": "recipient", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "amount", - "type": "core::integer::u256" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "function", - "name": "withdraw", - "inputs": [ - { - "name": "original_caller", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "token", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "withdraw_hook", - "type": "influence::contracts::escrow::Hook" - }, - { - "name": "withdraw_calldata", - "type": "core::array::Array::" - }, - { - "name": "withdrawals", - "type": "core::array::Span::" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "start_force_withdraw", - "inputs": [ - { - "name": "token", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "withdraw_hook", - "type": "influence::contracts::escrow::Hook" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "finish_force_withdraw", - "inputs": [ - { - "name": "token", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "withdraw_hook", - "type": "influence::contracts::escrow::Hook" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "event", - "name": "influence::contracts::escrow::Escrow::Deposited", - "kind": "struct", - "members": [ - { - "name": "order_id", - "type": "core::felt252", - "kind": "data" - }, - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "token", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "amount", - "type": "core::integer::u256", - "kind": "data" - }, - { - "name": "deposit_hook", - "type": "influence::contracts::escrow::Hook", - "kind": "data" - }, - { - "name": "withdraw_hook", - "type": "influence::contracts::escrow::Hook", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "influence::contracts::escrow::Escrow::Withdrawn", - "kind": "struct", - "members": [ - { - "name": "order_id", - "type": "core::felt252", - "kind": "data" - }, - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "withdrawals", - "type": "core::array::Span::", - "kind": "data" - }, - { - "name": "withdraw_hook", - "type": "influence::contracts::escrow::Hook", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "influence::contracts::escrow::Escrow::ForcedWithdrawStarted", - "kind": "struct", - "members": [ - { - "name": "order_id", - "type": "core::felt252", - "kind": "data" - }, - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "finish_time", - "type": "core::integer::u64", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "influence::contracts::escrow::Escrow::ForcedWithdrawFinished", - "kind": "struct", - "members": [ - { - "name": "order_id", - "type": "core::felt252", - "kind": "data" - }, - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "influence::contracts::escrow::Escrow::Event", - "kind": "enum", - "variants": [ - { - "name": "Deposited", - "type": "influence::contracts::escrow::Escrow::Deposited", - "kind": "nested" - }, - { - "name": "Withdrawn", - "type": "influence::contracts::escrow::Escrow::Withdrawn", - "kind": "nested" - }, - { - "name": "ForcedWithdrawStarted", - "type": "influence::contracts::escrow::Escrow::ForcedWithdrawStarted", - "kind": "nested" - }, - { - "name": "ForcedWithdrawFinished", - "type": "influence::contracts::escrow::Escrow::ForcedWithdrawFinished", - "kind": "nested" - } - ] - } - ], "Ship": [ { "type": "constructor", diff --git a/src/contracts/starknet_events.json b/src/contracts/starknet_events.json index 0f1e39c..cc31c5a 100644 --- a/src/contracts/starknet_events.json +++ b/src/contracts/starknet_events.json @@ -3032,6 +3032,50 @@ } ] }, + "DirectMessageSent": { + "type": "event", + "name": "DirectMessageSent", + "kind": "struct", + "members": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "content_hash", + "type": "core::array::Span::", + "kind": "data" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + "RekeyedInbox": { + "type": "event", + "name": "RekeyedInbox", + "kind": "struct", + "members": [ + { + "name": "messaging_key_x", + "type": "core::integer::u256", + "kind": "data" + }, + { + "name": "messaging_key_y", + "type": "core::integer::u256", + "kind": "data" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, "EventAnnotated": { "type": "event", "name": "EventAnnotated", diff --git a/src/contracts/starknet_systems.json b/src/contracts/starknet_systems.json index 9b3cfe8..9768806 100644 --- a/src/contracts/starknet_systems.json +++ b/src/contracts/starknet_systems.json @@ -1583,6 +1583,42 @@ "outputs": [], "state_mutability": "external" }, + "GrantAdalians": { + "type": "function", + "name": "GrantAdalians", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "count", + "type": "core::integer::u64" + } + ], + "outputs": [], + "state_mutability": "external" + }, + "GrantStarterPack": { + "type": "function", + "name": "GrantStarterPack", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "crewmates", + "type": "core::integer::u64" + }, + { + "name": "tokens", + "type": "core::integer::u64" + } + ], + "outputs": [], + "state_mutability": "external" + }, "PurchaseAdalian": { "type": "function", "name": "PurchaseAdalian", @@ -1910,6 +1946,38 @@ "outputs": [], "state_mutability": "external" }, + "DirectMessage": { + "type": "function", + "name": "DirectMessage", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "content_hash", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + "RekeyInbox": { + "type": "function", + "name": "RekeyInbox", + "inputs": [ + { + "name": "messaging_key_x", + "type": "core::integer::u256" + }, + { + "name": "messaging_key_y", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, "AnnotateEvent": { "type": "function", "name": "AnnotateEvent", diff --git a/src/lib/permission.js b/src/lib/permission.js index 4e0e7d1..c98adc4 100644 --- a/src/lib/permission.js +++ b/src/lib/permission.js @@ -20,7 +20,8 @@ const IDS = { LIMIT_BUY: 10, LIMIT_SELL: 11, EXTRACT_RESOURCES: 12, - ASSEMBLE_SHIP: 13 + ASSEMBLE_SHIP: 13, + USE_DEPOSIT: 14 }; const TYPES = { @@ -76,6 +77,10 @@ const TYPES = { [IDS.ASSEMBLE_SHIP]: { name: 'Assemble Ships', isApplicable: (entity) => !!entity.DryDocks?.length + }, + [IDS.USE_DEPOSIT]: { + name: 'Use Deposit', + isApplicable: (entity) => !!entity.Deposit } };