@fepvenancio/stela-sdk 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +119 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +119 -7
- package/dist/index.js.map +1 -1
- package/package.json +13 -3
- package/src/abi/stela.json +115 -5
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var STATUS_LABELS = {
|
|
|
22
22
|
|
|
23
23
|
// src/constants/addresses.ts
|
|
24
24
|
var STELA_ADDRESS = {
|
|
25
|
-
sepolia: "
|
|
25
|
+
sepolia: "0x006885f85de0e79efc7826e2ca19ef8a13e5e4516897ad52dc505723f8ce6b90",
|
|
26
26
|
mainnet: "0x0"
|
|
27
27
|
};
|
|
28
28
|
var VALID_NETWORKS = ["sepolia", "mainnet"];
|
|
@@ -261,13 +261,15 @@ function findTokenByAddress(address) {
|
|
|
261
261
|
|
|
262
262
|
// src/math/shares.ts
|
|
263
263
|
function convertToShares(percentage, totalSupply, currentIssuedPercentage) {
|
|
264
|
-
|
|
264
|
+
const denominator = currentIssuedPercentage === 0n ? 1n : currentIssuedPercentage;
|
|
265
|
+
return percentage * (totalSupply + VIRTUAL_SHARE_OFFSET) / denominator;
|
|
265
266
|
}
|
|
266
267
|
function scaleByPercentage(value, percentage) {
|
|
267
268
|
return value * percentage / MAX_BPS;
|
|
268
269
|
}
|
|
269
270
|
function sharesToPercentage(shares, totalSupply, currentIssuedPercentage) {
|
|
270
|
-
|
|
271
|
+
const effectivePct = currentIssuedPercentage === 0n ? 1n : currentIssuedPercentage;
|
|
272
|
+
return shares * effectivePct / (totalSupply + VIRTUAL_SHARE_OFFSET);
|
|
271
273
|
}
|
|
272
274
|
function calculateFeeShares(shares, feeBps) {
|
|
273
275
|
return shares * feeBps / MAX_BPS;
|
|
@@ -932,6 +934,28 @@ var stela_default = [
|
|
|
932
934
|
],
|
|
933
935
|
state_mutability: "view"
|
|
934
936
|
},
|
|
937
|
+
{
|
|
938
|
+
type: "function",
|
|
939
|
+
name: "get_treasury",
|
|
940
|
+
inputs: [],
|
|
941
|
+
outputs: [
|
|
942
|
+
{
|
|
943
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
944
|
+
}
|
|
945
|
+
],
|
|
946
|
+
state_mutability: "view"
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
type: "function",
|
|
950
|
+
name: "is_paused",
|
|
951
|
+
inputs: [],
|
|
952
|
+
outputs: [
|
|
953
|
+
{
|
|
954
|
+
type: "core::bool"
|
|
955
|
+
}
|
|
956
|
+
],
|
|
957
|
+
state_mutability: "view"
|
|
958
|
+
},
|
|
935
959
|
{
|
|
936
960
|
type: "function",
|
|
937
961
|
name: "set_inscription_fee",
|
|
@@ -991,6 +1015,52 @@ var stela_default = [
|
|
|
991
1015
|
],
|
|
992
1016
|
outputs: [],
|
|
993
1017
|
state_mutability: "external"
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
type: "function",
|
|
1021
|
+
name: "set_implementation_hash",
|
|
1022
|
+
inputs: [
|
|
1023
|
+
{
|
|
1024
|
+
name: "implementation_hash",
|
|
1025
|
+
type: "core::felt252"
|
|
1026
|
+
}
|
|
1027
|
+
],
|
|
1028
|
+
outputs: [],
|
|
1029
|
+
state_mutability: "external"
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
type: "function",
|
|
1033
|
+
name: "pause",
|
|
1034
|
+
inputs: [],
|
|
1035
|
+
outputs: [],
|
|
1036
|
+
state_mutability: "external"
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
type: "function",
|
|
1040
|
+
name: "unpause",
|
|
1041
|
+
inputs: [],
|
|
1042
|
+
outputs: [],
|
|
1043
|
+
state_mutability: "external"
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
type: "function",
|
|
1047
|
+
name: "set_locker_allowed_selector",
|
|
1048
|
+
inputs: [
|
|
1049
|
+
{
|
|
1050
|
+
name: "locker",
|
|
1051
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
name: "selector",
|
|
1055
|
+
type: "core::felt252"
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
name: "allowed",
|
|
1059
|
+
type: "core::bool"
|
|
1060
|
+
}
|
|
1061
|
+
],
|
|
1062
|
+
outputs: [],
|
|
1063
|
+
state_mutability: "external"
|
|
994
1064
|
}
|
|
995
1065
|
]
|
|
996
1066
|
},
|
|
@@ -1417,10 +1487,6 @@ var stela_default = [
|
|
|
1417
1487
|
name: "owner",
|
|
1418
1488
|
type: "core::starknet::contract_address::ContractAddress"
|
|
1419
1489
|
},
|
|
1420
|
-
{
|
|
1421
|
-
name: "treasury",
|
|
1422
|
-
type: "core::starknet::contract_address::ContractAddress"
|
|
1423
|
-
},
|
|
1424
1490
|
{
|
|
1425
1491
|
name: "inscriptions_nft",
|
|
1426
1492
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -1628,6 +1694,47 @@ var stela_default = [
|
|
|
1628
1694
|
kind: "enum",
|
|
1629
1695
|
variants: []
|
|
1630
1696
|
},
|
|
1697
|
+
{
|
|
1698
|
+
type: "event",
|
|
1699
|
+
name: "openzeppelin_security::pausable::PausableComponent::Paused",
|
|
1700
|
+
kind: "struct",
|
|
1701
|
+
members: [
|
|
1702
|
+
{
|
|
1703
|
+
name: "account",
|
|
1704
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
1705
|
+
kind: "data"
|
|
1706
|
+
}
|
|
1707
|
+
]
|
|
1708
|
+
},
|
|
1709
|
+
{
|
|
1710
|
+
type: "event",
|
|
1711
|
+
name: "openzeppelin_security::pausable::PausableComponent::Unpaused",
|
|
1712
|
+
kind: "struct",
|
|
1713
|
+
members: [
|
|
1714
|
+
{
|
|
1715
|
+
name: "account",
|
|
1716
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
1717
|
+
kind: "data"
|
|
1718
|
+
}
|
|
1719
|
+
]
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
type: "event",
|
|
1723
|
+
name: "openzeppelin_security::pausable::PausableComponent::Event",
|
|
1724
|
+
kind: "enum",
|
|
1725
|
+
variants: [
|
|
1726
|
+
{
|
|
1727
|
+
name: "Paused",
|
|
1728
|
+
type: "openzeppelin_security::pausable::PausableComponent::Paused",
|
|
1729
|
+
kind: "nested"
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
name: "Unpaused",
|
|
1733
|
+
type: "openzeppelin_security::pausable::PausableComponent::Unpaused",
|
|
1734
|
+
kind: "nested"
|
|
1735
|
+
}
|
|
1736
|
+
]
|
|
1737
|
+
},
|
|
1631
1738
|
{
|
|
1632
1739
|
type: "event",
|
|
1633
1740
|
name: "openzeppelin_utils::cryptography::nonces::NoncesComponent::Event",
|
|
@@ -1818,6 +1925,11 @@ var stela_default = [
|
|
|
1818
1925
|
type: "openzeppelin_security::reentrancyguard::ReentrancyGuardComponent::Event",
|
|
1819
1926
|
kind: "flat"
|
|
1820
1927
|
},
|
|
1928
|
+
{
|
|
1929
|
+
name: "PausableEvent",
|
|
1930
|
+
type: "openzeppelin_security::pausable::PausableComponent::Event",
|
|
1931
|
+
kind: "flat"
|
|
1932
|
+
},
|
|
1821
1933
|
{
|
|
1822
1934
|
name: "NoncesEvent",
|
|
1823
1935
|
type: "openzeppelin_utils::cryptography::nonces::NoncesComponent::Event",
|