@oddmaki-protocol/sdk 0.5.1 → 1.0.0

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.mjs CHANGED
@@ -1,17 +1,23 @@
1
1
  import { parseEther, formatEther, stringToHex, erc20Abi, custom, http, createPublicClient, createWalletClient } from 'viem';
2
- import { baseSepolia } from 'viem/chains';
2
+ import { base, baseSepolia } from 'viem/chains';
3
3
  import { gql, GraphQLClient } from 'graphql-request';
4
4
 
5
5
  // src/client.ts
6
6
  var CONTRACT_ADDRESSES = {
7
7
  [baseSepolia.id]: {
8
- diamond: "0xd6b87a68de56ddef64b270feb74fd3c684e91b20",
8
+ diamond: "0x31a4126aec35b36d46dd371eb0f0d5b71e1c2292",
9
9
  conditionalTokens: "0x7364747372Ac4a175B5326f5B2C9CB1C271d32e8",
10
- usdc: "0x9a537902b0456ce532ee58859a0e9db47c647668",
10
+ usdc: "0x1d3caa0156e8e573814b78766ba7958d7e11488b",
11
11
  subgraph: "https://api.studio.thegraph.com/query/1716020/oddmaki/version/latest"
12
+ },
13
+ [base.id]: {
14
+ diamond: "0x025d086a62d93e24f3cb3f161612ca8e9530127d",
15
+ conditionalTokens: "0x3e2ae408ca03f27849edff32d107c7b8ea5c87b4",
16
+ usdc: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
17
+ subgraph: "https://api.studio.thegraph.com/query/1716020/oddmaki-base/version/latest"
12
18
  }
13
19
  };
14
- var DEFAULT_CHAIN = baseSepolia;
20
+ var DEFAULT_CHAIN = base;
15
21
  var SubgraphClient = class {
16
22
  constructor(endpoint) {
17
23
  this.client = new GraphQLClient(endpoint);
@@ -6822,6 +6828,260 @@ var ERC20_default = [
6822
6828
  }
6823
6829
  ];
6824
6830
 
6831
+ // src/contracts/abis/UmaOracle.json
6832
+ var UmaOracle_default = [
6833
+ {
6834
+ type: "function",
6835
+ name: "assertTruth",
6836
+ inputs: [
6837
+ {
6838
+ name: "claim",
6839
+ type: "bytes",
6840
+ internalType: "bytes"
6841
+ },
6842
+ {
6843
+ name: "asserter",
6844
+ type: "address",
6845
+ internalType: "address"
6846
+ },
6847
+ {
6848
+ name: "callbackRecipient",
6849
+ type: "address",
6850
+ internalType: "address"
6851
+ },
6852
+ {
6853
+ name: "escalationManager",
6854
+ type: "address",
6855
+ internalType: "address"
6856
+ },
6857
+ {
6858
+ name: "liveness",
6859
+ type: "uint64",
6860
+ internalType: "uint64"
6861
+ },
6862
+ {
6863
+ name: "currency",
6864
+ type: "address",
6865
+ internalType: "contract IERC20"
6866
+ },
6867
+ {
6868
+ name: "bond",
6869
+ type: "uint256",
6870
+ internalType: "uint256"
6871
+ },
6872
+ {
6873
+ name: "identifier",
6874
+ type: "bytes32",
6875
+ internalType: "bytes32"
6876
+ },
6877
+ {
6878
+ name: "domainId",
6879
+ type: "bytes32",
6880
+ internalType: "bytes32"
6881
+ }
6882
+ ],
6883
+ outputs: [
6884
+ {
6885
+ name: "",
6886
+ type: "bytes32",
6887
+ internalType: "bytes32"
6888
+ }
6889
+ ],
6890
+ stateMutability: "nonpayable"
6891
+ },
6892
+ {
6893
+ type: "function",
6894
+ name: "defaultIdentifier",
6895
+ inputs: [],
6896
+ outputs: [
6897
+ {
6898
+ name: "",
6899
+ type: "bytes32",
6900
+ internalType: "bytes32"
6901
+ }
6902
+ ],
6903
+ stateMutability: "view"
6904
+ },
6905
+ {
6906
+ type: "function",
6907
+ name: "getAssertion",
6908
+ inputs: [
6909
+ {
6910
+ name: "assertionId",
6911
+ type: "bytes32",
6912
+ internalType: "bytes32"
6913
+ }
6914
+ ],
6915
+ outputs: [
6916
+ {
6917
+ name: "",
6918
+ type: "tuple",
6919
+ internalType: "struct OptimisticOracleV3Interface.Assertion",
6920
+ components: [
6921
+ {
6922
+ name: "escalationManagerSettings",
6923
+ type: "tuple",
6924
+ internalType: "struct OptimisticOracleV3Interface.EscalationManagerSettings",
6925
+ components: [
6926
+ {
6927
+ name: "arbitrateViaEscalationManager",
6928
+ type: "bool",
6929
+ internalType: "bool"
6930
+ },
6931
+ {
6932
+ name: "discardOracle",
6933
+ type: "bool",
6934
+ internalType: "bool"
6935
+ },
6936
+ {
6937
+ name: "validateDisputers",
6938
+ type: "bool",
6939
+ internalType: "bool"
6940
+ },
6941
+ {
6942
+ name: "assertingCaller",
6943
+ type: "address",
6944
+ internalType: "address"
6945
+ },
6946
+ {
6947
+ name: "escalationManager",
6948
+ type: "address",
6949
+ internalType: "address"
6950
+ }
6951
+ ]
6952
+ },
6953
+ {
6954
+ name: "asserter",
6955
+ type: "address",
6956
+ internalType: "address"
6957
+ },
6958
+ {
6959
+ name: "assertionTime",
6960
+ type: "uint64",
6961
+ internalType: "uint64"
6962
+ },
6963
+ {
6964
+ name: "settled",
6965
+ type: "bool",
6966
+ internalType: "bool"
6967
+ },
6968
+ {
6969
+ name: "currency",
6970
+ type: "address",
6971
+ internalType: "contract IERC20"
6972
+ },
6973
+ {
6974
+ name: "expirationTime",
6975
+ type: "uint64",
6976
+ internalType: "uint64"
6977
+ },
6978
+ {
6979
+ name: "settlementResolution",
6980
+ type: "bool",
6981
+ internalType: "bool"
6982
+ },
6983
+ {
6984
+ name: "domainId",
6985
+ type: "bytes32",
6986
+ internalType: "bytes32"
6987
+ },
6988
+ {
6989
+ name: "identifier",
6990
+ type: "bytes32",
6991
+ internalType: "bytes32"
6992
+ },
6993
+ {
6994
+ name: "bond",
6995
+ type: "uint256",
6996
+ internalType: "uint256"
6997
+ },
6998
+ {
6999
+ name: "callbackRecipient",
7000
+ type: "address",
7001
+ internalType: "address"
7002
+ },
7003
+ {
7004
+ name: "disputer",
7005
+ type: "address",
7006
+ internalType: "address"
7007
+ }
7008
+ ]
7009
+ }
7010
+ ],
7011
+ stateMutability: "view"
7012
+ },
7013
+ {
7014
+ type: "function",
7015
+ name: "getAssertionResult",
7016
+ inputs: [
7017
+ {
7018
+ name: "assertionId",
7019
+ type: "bytes32",
7020
+ internalType: "bytes32"
7021
+ }
7022
+ ],
7023
+ outputs: [
7024
+ {
7025
+ name: "",
7026
+ type: "bool",
7027
+ internalType: "bool"
7028
+ }
7029
+ ],
7030
+ stateMutability: "view"
7031
+ },
7032
+ {
7033
+ type: "function",
7034
+ name: "getMinimumBond",
7035
+ inputs: [
7036
+ {
7037
+ name: "currency",
7038
+ type: "address",
7039
+ internalType: "address"
7040
+ }
7041
+ ],
7042
+ outputs: [
7043
+ {
7044
+ name: "",
7045
+ type: "uint256",
7046
+ internalType: "uint256"
7047
+ }
7048
+ ],
7049
+ stateMutability: "view"
7050
+ },
7051
+ {
7052
+ type: "function",
7053
+ name: "isSettled",
7054
+ inputs: [
7055
+ {
7056
+ name: "assertionId",
7057
+ type: "bytes32",
7058
+ internalType: "bytes32"
7059
+ }
7060
+ ],
7061
+ outputs: [
7062
+ {
7063
+ name: "settled",
7064
+ type: "bool",
7065
+ internalType: "bool"
7066
+ }
7067
+ ],
7068
+ stateMutability: "view"
7069
+ },
7070
+ {
7071
+ type: "function",
7072
+ name: "settleAssertion",
7073
+ inputs: [
7074
+ {
7075
+ name: "assertionId",
7076
+ type: "bytes32",
7077
+ internalType: "bytes32"
7078
+ }
7079
+ ],
7080
+ outputs: [],
7081
+ stateMutability: "nonpayable"
7082
+ }
7083
+ ];
7084
+
6825
7085
  // src/modules/venue.ts
6826
7086
  var VenueModule = class extends BaseModule {
6827
7087
  /**
@@ -7219,6 +7479,18 @@ function clearDecimalsCache() {
7219
7479
  }
7220
7480
 
7221
7481
  // src/modules/market.ts
7482
+ var CTF_IS_APPROVED_FOR_ALL_ABI = [
7483
+ {
7484
+ name: "isApprovedForAll",
7485
+ type: "function",
7486
+ stateMutability: "view",
7487
+ inputs: [
7488
+ { name: "account", type: "address" },
7489
+ { name: "operator", type: "address" }
7490
+ ],
7491
+ outputs: [{ name: "", type: "bool" }]
7492
+ }
7493
+ ];
7222
7494
  var MarketModule = class extends BaseModule {
7223
7495
  /**
7224
7496
  * Format market question into UMA-compliant ancillary data
@@ -7649,11 +7921,12 @@ var MarketModule = class extends BaseModule {
7649
7921
  async convertPositions(params) {
7650
7922
  const wallet = this.walletClient;
7651
7923
  const account = await this.getSignerAccount();
7924
+ const accountAddress = await this.getSignerAddress();
7652
7925
  const isApproved = await this.publicClient.readContract({
7653
7926
  address: this.config.conditionalTokensAddress,
7654
- abi: ConditionalTokens_default,
7927
+ abi: CTF_IS_APPROVED_FOR_ALL_ABI,
7655
7928
  functionName: "isApprovedForAll",
7656
- args: [account, this.config.diamondAddress]
7929
+ args: [accountAddress, this.config.diamondAddress]
7657
7930
  });
7658
7931
  if (!isApproved) {
7659
7932
  throw new Error(
@@ -10012,15 +10285,6 @@ var TokenModule = class extends BaseModule {
10012
10285
  });
10013
10286
  }
10014
10287
  };
10015
- var optimisticOracleV3Abi = [
10016
- {
10017
- inputs: [{ name: "currency", type: "address" }],
10018
- name: "getMinimumBond",
10019
- outputs: [{ name: "", type: "uint256" }],
10020
- stateMutability: "view",
10021
- type: "function"
10022
- }
10023
- ];
10024
10288
  var UmaModule = class extends BaseModule {
10025
10289
  /**
10026
10290
  * Assert an outcome for a market question
@@ -10121,7 +10385,7 @@ var UmaModule = class extends BaseModule {
10121
10385
  });
10122
10386
  const minimumBond = await this.publicClient.readContract({
10123
10387
  address: umaOracle,
10124
- abi: optimisticOracleV3Abi,
10388
+ abi: UmaOracle_default,
10125
10389
  functionName: "getMinimumBond",
10126
10390
  args: [currency]
10127
10391
  });
@@ -11036,8 +11300,8 @@ function resolveIPFSUri(uri, gateway) {
11036
11300
  if (!uri) return "";
11037
11301
  const gw = gateway || DEFAULT_IPFS_GATEWAY;
11038
11302
  if (uri.startsWith("ipfs://")) {
11039
- const base = gw.endsWith("/") ? gw : `${gw}/`;
11040
- const gateway2 = base.includes("/ipfs/") ? base : `${base}ipfs/`;
11303
+ const base2 = gw.endsWith("/") ? gw : `${gw}/`;
11304
+ const gateway2 = base2.includes("/ipfs/") ? base2 : `${base2}ipfs/`;
11041
11305
  return `${gateway2}${uri.slice(7)}`;
11042
11306
  }
11043
11307
  return uri;
@@ -11056,6 +11320,6 @@ function parseMetadata(json) {
11056
11320
  // src/index.ts
11057
11321
  var version = "0.1.0";
11058
11322
 
11059
- export { AccessControlFacet_default as AccessControlFacetABI, AccessControlModule, BatchOrdersFacet_default as BatchOrdersFacetABI, CONTRACT_ADDRESSES, ConditionalTokens_default as ConditionalTokensABI, DEFAULT_CHAIN, ERC20_default as ERC20ABI, FeedProvider, GET_ALL_MARKETS_FEED, GET_ALL_MARKETS_FEED_BY_VOLUME, GET_CHART_TRADES, GET_CHART_TRADES_ALL, GET_GROUP_MARKETS, GET_LEADERBOARD, GET_MARKET, GET_MARKETS, GET_MARKETS_WITH_PRICING, GET_MARKET_GROUP, GET_MARKET_GROUPS, GET_MARKET_GROUP_ITEM, GET_MARKET_TOP_HOLDERS, GET_ORDERS, GET_PROTOCOL_STATS, GET_QUESTION, GET_QUESTIONS, GET_RECENT_MARKETS, GET_RECENT_TRADES, GET_TOP_OF_BOOK, GET_TRADER_CLOSED_POSITIONS, GET_TRADER_FILLS, GET_TRADER_POSITIONS, GET_TRADER_PROFILE, GET_TRADES, GET_UNIFIED_MARKET_FEED, GET_UNIFIED_MARKET_FEED_BY_VOLUME, GET_USER, GET_VENUES, LimitOrdersFacet_default as LimitOrdersFacetABI, MarketGroupFacet_default as MarketGroupFacetABI, MarketModule, MarketOrdersFacet_default as MarketOrdersFacetABI, MarketsFacet_default as MarketsFacetABI, MatchingFacet_default as MatchingFacetABI, MetadataFacet_default as MetadataFacetABI, NegRiskFacet_default as NegRiskFacetABI, OddMakiClient, OrderBookFacet_default as OrderBookFacetABI, PROTOCOL_FEES, PriceMarketFacet_default as PriceMarketFacetABI, PriceMarketModule, ProtocolFacet_default as ProtocolFacetABI, PublicModule, PythResolutionFacet_default as PythResolutionFacetABI, ResolutionFacet_default as ResolutionFacetABI, SubgraphClient, TICK_SIZE_FINE, TICK_SIZE_STANDARD, TagsFacet_default as TagsFacetABI, TokenModule, TradeModule, UMA_DEFAULTS, UmaModule, VALID_TICK_SIZES, VaultFacet_default as VaultFacetABI, VenueFacet_default as VenueFacetABI, VenueModule, WhitelistAccessControl_default as WhitelistAccessControlABI, calculateChancePercent, clearDecimalsCache, createExpiry, createOddMakiClient, formatAmount, formatAncillaryData, formatTimestamp, getCachedTokenDecimals, getOutcomePrice, getTokenDecimals, isValidTickSize, parseAmount, parseAncillaryData, parseMetadata, parseTokenAmount, priceToTick, resolveIPFSUri, tickToPercentage, tickToPrice, version };
11323
+ export { AccessControlFacet_default as AccessControlFacetABI, AccessControlModule, BatchOrdersFacet_default as BatchOrdersFacetABI, CONTRACT_ADDRESSES, ConditionalTokens_default as ConditionalTokensABI, DEFAULT_CHAIN, ERC20_default as ERC20ABI, FeedProvider, GET_ALL_MARKETS_FEED, GET_ALL_MARKETS_FEED_BY_VOLUME, GET_CHART_TRADES, GET_CHART_TRADES_ALL, GET_GROUP_MARKETS, GET_LEADERBOARD, GET_MARKET, GET_MARKETS, GET_MARKETS_WITH_PRICING, GET_MARKET_GROUP, GET_MARKET_GROUPS, GET_MARKET_GROUP_ITEM, GET_MARKET_TOP_HOLDERS, GET_ORDERS, GET_PROTOCOL_STATS, GET_QUESTION, GET_QUESTIONS, GET_RECENT_MARKETS, GET_RECENT_TRADES, GET_TOP_OF_BOOK, GET_TRADER_CLOSED_POSITIONS, GET_TRADER_FILLS, GET_TRADER_POSITIONS, GET_TRADER_PROFILE, GET_TRADES, GET_UNIFIED_MARKET_FEED, GET_UNIFIED_MARKET_FEED_BY_VOLUME, GET_USER, GET_VENUES, LimitOrdersFacet_default as LimitOrdersFacetABI, MarketGroupFacet_default as MarketGroupFacetABI, MarketModule, MarketOrdersFacet_default as MarketOrdersFacetABI, MarketsFacet_default as MarketsFacetABI, MatchingFacet_default as MatchingFacetABI, MetadataFacet_default as MetadataFacetABI, NegRiskFacet_default as NegRiskFacetABI, OddMakiClient, OrderBookFacet_default as OrderBookFacetABI, PROTOCOL_FEES, PriceMarketFacet_default as PriceMarketFacetABI, PriceMarketModule, ProtocolFacet_default as ProtocolFacetABI, PublicModule, PythResolutionFacet_default as PythResolutionFacetABI, ResolutionFacet_default as ResolutionFacetABI, SubgraphClient, TICK_SIZE_FINE, TICK_SIZE_STANDARD, TagsFacet_default as TagsFacetABI, TokenModule, TradeModule, UMA_DEFAULTS, UmaModule, UmaOracle_default as UmaOracleABI, VALID_TICK_SIZES, VaultFacet_default as VaultFacetABI, VenueFacet_default as VenueFacetABI, VenueModule, WhitelistAccessControl_default as WhitelistAccessControlABI, calculateChancePercent, clearDecimalsCache, createExpiry, createOddMakiClient, formatAmount, formatAncillaryData, formatTimestamp, getCachedTokenDecimals, getOutcomePrice, getTokenDecimals, isValidTickSize, parseAmount, parseAncillaryData, parseMetadata, parseTokenAmount, priceToTick, resolveIPFSUri, tickToPercentage, tickToPrice, version };
11060
11324
  //# sourceMappingURL=index.mjs.map
11061
11325
  //# sourceMappingURL=index.mjs.map