@oddmaki-protocol/sdk 0.1.3 → 0.2.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
@@ -6004,6 +6004,30 @@ var WhitelistAccessControl_default = [
6004
6004
 
6005
6005
  // src/contracts/abis/ConditionalTokens.json
6006
6006
  var ConditionalTokens_default = [
6007
+ {
6008
+ type: "function",
6009
+ name: "balanceOf",
6010
+ inputs: [
6011
+ {
6012
+ name: "account",
6013
+ type: "address",
6014
+ internalType: "address"
6015
+ },
6016
+ {
6017
+ name: "id",
6018
+ type: "uint256",
6019
+ internalType: "uint256"
6020
+ }
6021
+ ],
6022
+ outputs: [
6023
+ {
6024
+ name: "",
6025
+ type: "uint256",
6026
+ internalType: "uint256"
6027
+ }
6028
+ ],
6029
+ stateMutability: "view"
6030
+ },
6007
6031
  {
6008
6032
  type: "function",
6009
6033
  name: "getCollectionId",
@@ -6026,7 +6050,7 @@ var ConditionalTokens_default = [
6026
6050
  ],
6027
6051
  outputs: [
6028
6052
  {
6029
- name: "",
6053
+ name: "collectionId",
6030
6054
  type: "bytes32",
6031
6055
  internalType: "bytes32"
6032
6056
  }
@@ -6055,7 +6079,7 @@ var ConditionalTokens_default = [
6055
6079
  ],
6056
6080
  outputs: [
6057
6081
  {
6058
- name: "",
6082
+ name: "conditionId",
6059
6083
  type: "bytes32",
6060
6084
  internalType: "bytes32"
6061
6085
  }
@@ -6074,13 +6098,37 @@ var ConditionalTokens_default = [
6074
6098
  ],
6075
6099
  outputs: [
6076
6100
  {
6077
- name: "",
6101
+ name: "outcomeSlotCount",
6078
6102
  type: "uint256",
6079
6103
  internalType: "uint256"
6080
6104
  }
6081
6105
  ],
6082
6106
  stateMutability: "view"
6083
6107
  },
6108
+ {
6109
+ type: "function",
6110
+ name: "getPositionId",
6111
+ inputs: [
6112
+ {
6113
+ name: "collateralToken",
6114
+ type: "address",
6115
+ internalType: "contract IERC20"
6116
+ },
6117
+ {
6118
+ name: "collectionId",
6119
+ type: "bytes32",
6120
+ internalType: "bytes32"
6121
+ }
6122
+ ],
6123
+ outputs: [
6124
+ {
6125
+ name: "positionId",
6126
+ type: "uint256",
6127
+ internalType: "uint256"
6128
+ }
6129
+ ],
6130
+ stateMutability: "pure"
6131
+ },
6084
6132
  {
6085
6133
  type: "function",
6086
6134
  name: "mergePositions",
@@ -6114,6 +6162,49 @@ var ConditionalTokens_default = [
6114
6162
  outputs: [],
6115
6163
  stateMutability: "nonpayable"
6116
6164
  },
6165
+ {
6166
+ type: "function",
6167
+ name: "payoutDenominator",
6168
+ inputs: [
6169
+ {
6170
+ name: "conditionId",
6171
+ type: "bytes32",
6172
+ internalType: "bytes32"
6173
+ }
6174
+ ],
6175
+ outputs: [
6176
+ {
6177
+ name: "",
6178
+ type: "uint256",
6179
+ internalType: "uint256"
6180
+ }
6181
+ ],
6182
+ stateMutability: "view"
6183
+ },
6184
+ {
6185
+ type: "function",
6186
+ name: "payoutNumerators",
6187
+ inputs: [
6188
+ {
6189
+ name: "conditionId",
6190
+ type: "bytes32",
6191
+ internalType: "bytes32"
6192
+ },
6193
+ {
6194
+ name: "index",
6195
+ type: "uint256",
6196
+ internalType: "uint256"
6197
+ }
6198
+ ],
6199
+ outputs: [
6200
+ {
6201
+ name: "",
6202
+ type: "uint256",
6203
+ internalType: "uint256"
6204
+ }
6205
+ ],
6206
+ stateMutability: "view"
6207
+ },
6117
6208
  {
6118
6209
  type: "function",
6119
6210
  name: "prepareCondition",
@@ -6137,6 +6228,34 @@ var ConditionalTokens_default = [
6137
6228
  outputs: [],
6138
6229
  stateMutability: "nonpayable"
6139
6230
  },
6231
+ {
6232
+ type: "function",
6233
+ name: "redeemPositions",
6234
+ inputs: [
6235
+ {
6236
+ name: "collateralToken",
6237
+ type: "address",
6238
+ internalType: "contract IERC20"
6239
+ },
6240
+ {
6241
+ name: "parentCollectionId",
6242
+ type: "bytes32",
6243
+ internalType: "bytes32"
6244
+ },
6245
+ {
6246
+ name: "conditionId",
6247
+ type: "bytes32",
6248
+ internalType: "bytes32"
6249
+ },
6250
+ {
6251
+ name: "indexSets",
6252
+ type: "uint256[]",
6253
+ internalType: "uint256[]"
6254
+ }
6255
+ ],
6256
+ outputs: [],
6257
+ stateMutability: "nonpayable"
6258
+ },
6140
6259
  {
6141
6260
  type: "function",
6142
6261
  name: "reportPayouts",
@@ -6196,14 +6315,19 @@ var ERC20_default = [
6196
6315
  type: "constructor",
6197
6316
  inputs: [
6198
6317
  {
6199
- name: "name_",
6318
+ name: "_name",
6200
6319
  type: "string",
6201
6320
  internalType: "string"
6202
6321
  },
6203
6322
  {
6204
- name: "symbol_",
6323
+ name: "_symbol",
6205
6324
  type: "string",
6206
6325
  internalType: "string"
6326
+ },
6327
+ {
6328
+ name: "_decimals",
6329
+ type: "uint8",
6330
+ internalType: "uint8"
6207
6331
  }
6208
6332
  ],
6209
6333
  stateMutability: "nonpayable"
@@ -6213,12 +6337,12 @@ var ERC20_default = [
6213
6337
  name: "allowance",
6214
6338
  inputs: [
6215
6339
  {
6216
- name: "owner",
6340
+ name: "",
6217
6341
  type: "address",
6218
6342
  internalType: "address"
6219
6343
  },
6220
6344
  {
6221
- name: "spender",
6345
+ name: "",
6222
6346
  type: "address",
6223
6347
  internalType: "address"
6224
6348
  }
@@ -6261,7 +6385,7 @@ var ERC20_default = [
6261
6385
  name: "balanceOf",
6262
6386
  inputs: [
6263
6387
  {
6264
- name: "account",
6388
+ name: "",
6265
6389
  type: "address",
6266
6390
  internalType: "address"
6267
6391
  }
@@ -6290,50 +6414,20 @@ var ERC20_default = [
6290
6414
  },
6291
6415
  {
6292
6416
  type: "function",
6293
- name: "decreaseAllowance",
6417
+ name: "mint",
6294
6418
  inputs: [
6295
6419
  {
6296
- name: "spender",
6297
- type: "address",
6298
- internalType: "address"
6299
- },
6300
- {
6301
- name: "subtractedValue",
6302
- type: "uint256",
6303
- internalType: "uint256"
6304
- }
6305
- ],
6306
- outputs: [
6307
- {
6308
- name: "",
6309
- type: "bool",
6310
- internalType: "bool"
6311
- }
6312
- ],
6313
- stateMutability: "nonpayable"
6314
- },
6315
- {
6316
- type: "function",
6317
- name: "increaseAllowance",
6318
- inputs: [
6319
- {
6320
- name: "spender",
6420
+ name: "to",
6321
6421
  type: "address",
6322
6422
  internalType: "address"
6323
6423
  },
6324
6424
  {
6325
- name: "addedValue",
6425
+ name: "amount",
6326
6426
  type: "uint256",
6327
6427
  internalType: "uint256"
6328
6428
  }
6329
6429
  ],
6330
- outputs: [
6331
- {
6332
- name: "",
6333
- type: "bool",
6334
- internalType: "bool"
6335
- }
6336
- ],
6430
+ outputs: [],
6337
6431
  stateMutability: "nonpayable"
6338
6432
  },
6339
6433
  {
@@ -7633,6 +7727,80 @@ var TradeModule = class extends BaseModule {
7633
7727
  });
7634
7728
  return result;
7635
7729
  }
7730
+ /**
7731
+ * Execute a market sell order (FOK or FAK)
7732
+ *
7733
+ * @param params.marketId - The market to sell on
7734
+ * @param params.outcomeId - Which outcome to sell (0=YES, 1=NO)
7735
+ * @param params.tokenAmount - Amount of outcome tokens to sell
7736
+ * @param params.minPriceTick - Minimum price tick willing to accept (slippage protection)
7737
+ * @param params.orderType - 0=FOK (Fill-Or-Kill), 1=FAK (Fill-And-Kill)
7738
+ */
7739
+ async placeMarketSell(params) {
7740
+ const wallet = this.walletClient;
7741
+ const [account] = await wallet.getAddresses();
7742
+ const { request } = await this.publicClient.simulateContract({
7743
+ address: this.config.diamondAddress,
7744
+ abi: MarketOrdersFacet_default,
7745
+ functionName: "placeMarketSell",
7746
+ args: [
7747
+ params.marketId,
7748
+ params.outcomeId,
7749
+ params.tokenAmount,
7750
+ params.minPriceTick,
7751
+ params.orderType
7752
+ ],
7753
+ account
7754
+ });
7755
+ return wallet.writeContract(request);
7756
+ }
7757
+ /**
7758
+ * Execute a market sell order with simple string inputs (recommended for frontends)
7759
+ * @param params.amount - Token amount as decimal string (e.g., "100.5")
7760
+ * @param params.minPrice - Minimum price as decimal string (e.g., "0.70")
7761
+ * @param params.orderType - 'FOK' or 'FAK' (default: 'FAK')
7762
+ */
7763
+ async placeMarketSellSimple(params) {
7764
+ const tradingData = await this.publicClient.readContract({
7765
+ address: this.config.diamondAddress,
7766
+ abi: MarketsFacet_default,
7767
+ functionName: "getMarketTradingData",
7768
+ args: [params.marketId]
7769
+ });
7770
+ const collateralToken = tradingData.collateralToken;
7771
+ const decimals = await getCachedTokenDecimals(this.publicClient, collateralToken);
7772
+ const tokenAmount = parseTokenAmount(params.amount, decimals);
7773
+ const minPriceTick = priceToTick(params.minPrice);
7774
+ const orderType = params.orderType === "FOK" ? 0 : 1;
7775
+ return this.placeMarketSell({
7776
+ marketId: params.marketId,
7777
+ outcomeId: params.outcomeId,
7778
+ tokenAmount,
7779
+ minPriceTick,
7780
+ orderType
7781
+ });
7782
+ }
7783
+ /**
7784
+ * Preview a market sell order (simulate transaction)
7785
+ */
7786
+ async previewMarketSell(params) {
7787
+ const wallet = this.walletClient;
7788
+ const [account] = await wallet.getAddresses();
7789
+ const { result } = await this.publicClient.simulateContract({
7790
+ address: this.config.diamondAddress,
7791
+ abi: MarketOrdersFacet_default,
7792
+ functionName: "placeMarketSell",
7793
+ args: [
7794
+ params.marketId,
7795
+ params.outcomeId,
7796
+ params.tokenAmount,
7797
+ params.minPriceTick,
7798
+ params.orderType
7799
+ ],
7800
+ account
7801
+ });
7802
+ return result;
7803
+ }
7636
7804
  /**
7637
7805
  * Watch for MarketOrderExecuted events
7638
7806
  */
@@ -7645,6 +7813,18 @@ var TradeModule = class extends BaseModule {
7645
7813
  onLogs
7646
7814
  });
7647
7815
  }
7816
+ /**
7817
+ * Watch for MarketSellExecuted events
7818
+ */
7819
+ watchMarketSell(marketId, onLogs) {
7820
+ return this.publicClient.watchContractEvent({
7821
+ address: this.config.diamondAddress,
7822
+ abi: MarketOrdersFacet_default,
7823
+ eventName: "MarketSellExecuted",
7824
+ args: { marketId },
7825
+ onLogs
7826
+ });
7827
+ }
7648
7828
  /**
7649
7829
  * Check whether any orders are matchable in the given market.
7650
7830
  * Returns a preview of which fill paths have crossing conditions,
@@ -8006,6 +8186,7 @@ var GET_MARKET = gql`
8006
8186
  question
8007
8187
  outcomes
8008
8188
  status
8189
+ resolvedOutcome
8009
8190
  collateralToken
8010
8191
  conditionId
8011
8192
  tickSize
@@ -8310,6 +8491,7 @@ var GET_GROUP_MARKETS = gql`
8310
8491
  question
8311
8492
  outcomes
8312
8493
  status
8494
+ resolvedOutcome
8313
8495
  collateralToken
8314
8496
  conditionId
8315
8497
  tickSize