@oddmaki-protocol/sdk 1.4.1 → 1.6.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.d.mts CHANGED
@@ -9196,10 +9196,6 @@ declare class PublicModule extends BaseModule {
9196
9196
  }
9197
9197
 
9198
9198
  declare class TokenModule extends BaseModule {
9199
- /**
9200
- * Mint tokens (for testnet/mock tokens only)
9201
- */
9202
- mint(token: Address, to: Address, amount: bigint): Promise<`0x${string}`>;
9203
9199
  /**
9204
9200
  * Approve a spender to spend tokens
9205
9201
  */
@@ -9264,6 +9260,27 @@ declare class UmaModule extends BaseModule {
9264
9260
  * Settle an assertion after the liveness period
9265
9261
  */
9266
9262
  settleAssertion(assertionId: `0x${string}`): Promise<`0x${string}`>;
9263
+ /**
9264
+ * Get the UMA Optimistic Oracle V3 address for the active Diamond.
9265
+ */
9266
+ getUmaOracleAddress(): Promise<Address>;
9267
+ /**
9268
+ * Dispute an active assertion directly on the UMA Optimistic Oracle V3.
9269
+ *
9270
+ * The dispute escalates the assertion to UMA's DVM, which arbitrates the
9271
+ * outcome via tokenholder vote. The disputer must post a bond equal to the
9272
+ * asserter's bond — the winner is reimbursed and receives a share of the
9273
+ * loser's bond.
9274
+ *
9275
+ * @param params.assertionId - The active assertionId to dispute
9276
+ * @param params.autoApprove - Approve the bond currency to the oracle if needed (default: true)
9277
+ *
9278
+ * @returns Transaction hash
9279
+ */
9280
+ disputeAssertion(params: {
9281
+ assertionId: `0x${string}`;
9282
+ autoApprove?: boolean;
9283
+ }): Promise<`0x${string}`>;
9267
9284
  /**
9268
9285
  * Report resolution after UMA settlement
9269
9286
  */
@@ -9328,6 +9345,8 @@ declare class UmaModule extends BaseModule {
9328
9345
  canSettle: boolean;
9329
9346
  disputer: `0x${string}`;
9330
9347
  isDisputed: boolean;
9348
+ currency: Address;
9349
+ bond: bigint;
9331
9350
  }>;
9332
9351
  /**
9333
9352
  * Get comprehensive market status for UMA resolution
@@ -16832,25 +16851,6 @@ var ERC20 = [
16832
16851
  ],
16833
16852
  stateMutability: "view"
16834
16853
  },
16835
- {
16836
- type: "function",
16837
- name: "mint",
16838
- inputs: [
16839
- {
16840
- name: "to",
16841
- type: "address",
16842
- internalType: "address"
16843
- },
16844
- {
16845
- name: "amount",
16846
- type: "uint256",
16847
- internalType: "uint256"
16848
- }
16849
- ],
16850
- outputs: [
16851
- ],
16852
- stateMutability: "nonpayable"
16853
- },
16854
16854
  {
16855
16855
  type: "function",
16856
16856
  name: "name",
@@ -17250,6 +17250,25 @@ var UmaOracle = [
17250
17250
  outputs: [
17251
17251
  ],
17252
17252
  stateMutability: "nonpayable"
17253
+ },
17254
+ {
17255
+ type: "function",
17256
+ name: "disputeAssertion",
17257
+ inputs: [
17258
+ {
17259
+ name: "assertionId",
17260
+ type: "bytes32",
17261
+ internalType: "bytes32"
17262
+ },
17263
+ {
17264
+ name: "disputer",
17265
+ type: "address",
17266
+ internalType: "address"
17267
+ }
17268
+ ],
17269
+ outputs: [
17270
+ ],
17271
+ stateMutability: "nonpayable"
17253
17272
  }
17254
17273
  ];
17255
17274
 
package/dist/index.d.ts CHANGED
@@ -9196,10 +9196,6 @@ declare class PublicModule extends BaseModule {
9196
9196
  }
9197
9197
 
9198
9198
  declare class TokenModule extends BaseModule {
9199
- /**
9200
- * Mint tokens (for testnet/mock tokens only)
9201
- */
9202
- mint(token: Address, to: Address, amount: bigint): Promise<`0x${string}`>;
9203
9199
  /**
9204
9200
  * Approve a spender to spend tokens
9205
9201
  */
@@ -9264,6 +9260,27 @@ declare class UmaModule extends BaseModule {
9264
9260
  * Settle an assertion after the liveness period
9265
9261
  */
9266
9262
  settleAssertion(assertionId: `0x${string}`): Promise<`0x${string}`>;
9263
+ /**
9264
+ * Get the UMA Optimistic Oracle V3 address for the active Diamond.
9265
+ */
9266
+ getUmaOracleAddress(): Promise<Address>;
9267
+ /**
9268
+ * Dispute an active assertion directly on the UMA Optimistic Oracle V3.
9269
+ *
9270
+ * The dispute escalates the assertion to UMA's DVM, which arbitrates the
9271
+ * outcome via tokenholder vote. The disputer must post a bond equal to the
9272
+ * asserter's bond — the winner is reimbursed and receives a share of the
9273
+ * loser's bond.
9274
+ *
9275
+ * @param params.assertionId - The active assertionId to dispute
9276
+ * @param params.autoApprove - Approve the bond currency to the oracle if needed (default: true)
9277
+ *
9278
+ * @returns Transaction hash
9279
+ */
9280
+ disputeAssertion(params: {
9281
+ assertionId: `0x${string}`;
9282
+ autoApprove?: boolean;
9283
+ }): Promise<`0x${string}`>;
9267
9284
  /**
9268
9285
  * Report resolution after UMA settlement
9269
9286
  */
@@ -9328,6 +9345,8 @@ declare class UmaModule extends BaseModule {
9328
9345
  canSettle: boolean;
9329
9346
  disputer: `0x${string}`;
9330
9347
  isDisputed: boolean;
9348
+ currency: Address;
9349
+ bond: bigint;
9331
9350
  }>;
9332
9351
  /**
9333
9352
  * Get comprehensive market status for UMA resolution
@@ -16832,25 +16851,6 @@ var ERC20 = [
16832
16851
  ],
16833
16852
  stateMutability: "view"
16834
16853
  },
16835
- {
16836
- type: "function",
16837
- name: "mint",
16838
- inputs: [
16839
- {
16840
- name: "to",
16841
- type: "address",
16842
- internalType: "address"
16843
- },
16844
- {
16845
- name: "amount",
16846
- type: "uint256",
16847
- internalType: "uint256"
16848
- }
16849
- ],
16850
- outputs: [
16851
- ],
16852
- stateMutability: "nonpayable"
16853
- },
16854
16854
  {
16855
16855
  type: "function",
16856
16856
  name: "name",
@@ -17250,6 +17250,25 @@ var UmaOracle = [
17250
17250
  outputs: [
17251
17251
  ],
17252
17252
  stateMutability: "nonpayable"
17253
+ },
17254
+ {
17255
+ type: "function",
17256
+ name: "disputeAssertion",
17257
+ inputs: [
17258
+ {
17259
+ name: "assertionId",
17260
+ type: "bytes32",
17261
+ internalType: "bytes32"
17262
+ },
17263
+ {
17264
+ name: "disputer",
17265
+ type: "address",
17266
+ internalType: "address"
17267
+ }
17268
+ ],
17269
+ outputs: [
17270
+ ],
17271
+ stateMutability: "nonpayable"
17253
17272
  }
17254
17273
  ];
17255
17274
 
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var CONTRACT_ADDRESSES = {
9
9
  [chains.baseSepolia.id]: {
10
10
  diamond: "0x31a4126aec35b36d46dd371eb0f0d5b71e1c2292",
11
11
  conditionalTokens: "0x7364747372Ac4a175B5326f5B2C9CB1C271d32e8",
12
- usdc: "0x1d3caa0156e8e573814b78766ba7958d7e11488b",
12
+ usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
13
13
  subgraph: "https://api.studio.thegraph.com/query/1716020/oddmaki-base-sepolia/version/latest"
14
14
  },
15
15
  [chains.base.id]: {
@@ -6708,24 +6708,6 @@ var ERC20_default = [
6708
6708
  ],
6709
6709
  stateMutability: "view"
6710
6710
  },
6711
- {
6712
- type: "function",
6713
- name: "mint",
6714
- inputs: [
6715
- {
6716
- name: "to",
6717
- type: "address",
6718
- internalType: "address"
6719
- },
6720
- {
6721
- name: "amount",
6722
- type: "uint256",
6723
- internalType: "uint256"
6724
- }
6725
- ],
6726
- outputs: [],
6727
- stateMutability: "nonpayable"
6728
- },
6729
6711
  {
6730
6712
  type: "function",
6731
6713
  name: "name",
@@ -7121,6 +7103,24 @@ var UmaOracle_default = [
7121
7103
  ],
7122
7104
  outputs: [],
7123
7105
  stateMutability: "nonpayable"
7106
+ },
7107
+ {
7108
+ type: "function",
7109
+ name: "disputeAssertion",
7110
+ inputs: [
7111
+ {
7112
+ name: "assertionId",
7113
+ type: "bytes32",
7114
+ internalType: "bytes32"
7115
+ },
7116
+ {
7117
+ name: "disputer",
7118
+ type: "address",
7119
+ internalType: "address"
7120
+ }
7121
+ ],
7122
+ outputs: [],
7123
+ stateMutability: "nonpayable"
7124
7124
  }
7125
7125
  ];
7126
7126
 
@@ -10294,21 +10294,6 @@ var PublicModule = class extends BaseModule {
10294
10294
 
10295
10295
  // src/modules/token.ts
10296
10296
  var TokenModule = class extends BaseModule {
10297
- /**
10298
- * Mint tokens (for testnet/mock tokens only)
10299
- */
10300
- async mint(token, to, amount) {
10301
- const wallet = this.walletClient;
10302
- const account = await this.getSignerAccount();
10303
- const { request } = await this.publicClient.simulateContract({
10304
- address: token,
10305
- abi: ERC20_default,
10306
- functionName: "mint",
10307
- args: [to, amount],
10308
- account
10309
- });
10310
- return wallet.writeContract(request);
10311
- }
10312
10297
  /**
10313
10298
  * Approve a spender to spend tokens
10314
10299
  */
@@ -10499,6 +10484,97 @@ var UmaModule = class extends BaseModule {
10499
10484
  });
10500
10485
  return wallet.writeContract(request);
10501
10486
  }
10487
+ /**
10488
+ * Get the UMA Optimistic Oracle V3 address for the active Diamond.
10489
+ */
10490
+ async getUmaOracleAddress() {
10491
+ return await this.publicClient.readContract({
10492
+ address: this.config.diamondAddress,
10493
+ abi: ProtocolFacet_default,
10494
+ functionName: "getUmaOracle"
10495
+ });
10496
+ }
10497
+ /**
10498
+ * Dispute an active assertion directly on the UMA Optimistic Oracle V3.
10499
+ *
10500
+ * The dispute escalates the assertion to UMA's DVM, which arbitrates the
10501
+ * outcome via tokenholder vote. The disputer must post a bond equal to the
10502
+ * asserter's bond — the winner is reimbursed and receives a share of the
10503
+ * loser's bond.
10504
+ *
10505
+ * @param params.assertionId - The active assertionId to dispute
10506
+ * @param params.autoApprove - Approve the bond currency to the oracle if needed (default: true)
10507
+ *
10508
+ * @returns Transaction hash
10509
+ */
10510
+ async disputeAssertion(params) {
10511
+ const wallet = this.walletClient;
10512
+ const account = await this.getSignerAccount();
10513
+ const accountAddress = await this.getSignerAddress();
10514
+ const autoApprove = params.autoApprove ?? true;
10515
+ const oracleAddress = await this.getUmaOracleAddress();
10516
+ const assertion = await this.publicClient.readContract({
10517
+ address: oracleAddress,
10518
+ abi: UmaOracle_default,
10519
+ functionName: "getAssertion",
10520
+ args: [params.assertionId]
10521
+ });
10522
+ const currency = assertion.currency;
10523
+ const bondAmount = BigInt(assertion.bond);
10524
+ if (assertion.disputer !== "0x0000000000000000000000000000000000000000") {
10525
+ throw new Error("Assertion has already been disputed");
10526
+ }
10527
+ if (assertion.settled) {
10528
+ throw new Error("Assertion is already settled");
10529
+ }
10530
+ const currentTime = Math.floor(Date.now() / 1e3);
10531
+ if (currentTime >= Number(assertion.expirationTime)) {
10532
+ throw new Error("Liveness period has expired \u2014 assertion can no longer be disputed");
10533
+ }
10534
+ const currentAllowance = await this.publicClient.readContract({
10535
+ address: currency,
10536
+ abi: viem.erc20Abi,
10537
+ functionName: "allowance",
10538
+ args: [accountAddress, oracleAddress]
10539
+ });
10540
+ if (currentAllowance < bondAmount && autoApprove) {
10541
+ const approveHash = await wallet.writeContract({
10542
+ address: currency,
10543
+ abi: viem.erc20Abi,
10544
+ functionName: "approve",
10545
+ args: [oracleAddress, bondAmount],
10546
+ account,
10547
+ chain: this.config.chain
10548
+ });
10549
+ await this.publicClient.waitForTransactionReceipt({
10550
+ hash: approveHash,
10551
+ confirmations: 2
10552
+ });
10553
+ } else if (currentAllowance < bondAmount) {
10554
+ throw new Error(
10555
+ `Insufficient bond currency allowance for oracle. Required: ${bondAmount.toString()}, Current: ${currentAllowance.toString()}.`
10556
+ );
10557
+ }
10558
+ const balance = await this.publicClient.readContract({
10559
+ address: currency,
10560
+ abi: viem.erc20Abi,
10561
+ functionName: "balanceOf",
10562
+ args: [accountAddress]
10563
+ });
10564
+ if (balance < bondAmount) {
10565
+ throw new Error(
10566
+ `Insufficient bond currency balance. Required: ${bondAmount.toString()}, Have: ${balance.toString()}`
10567
+ );
10568
+ }
10569
+ const { request } = await this.publicClient.simulateContract({
10570
+ address: oracleAddress,
10571
+ abi: UmaOracle_default,
10572
+ functionName: "disputeAssertion",
10573
+ args: [params.assertionId, accountAddress],
10574
+ account
10575
+ });
10576
+ return wallet.writeContract(request);
10577
+ }
10502
10578
  /**
10503
10579
  * Report resolution after UMA settlement
10504
10580
  */
@@ -10714,7 +10790,9 @@ var UmaModule = class extends BaseModule {
10714
10790
  expirationTime,
10715
10791
  canSettle: currentTime >= expirationTime,
10716
10792
  disputer: assertion.disputer,
10717
- isDisputed: assertion.disputer !== "0x0000000000000000000000000000000000000000"
10793
+ isDisputed: assertion.disputer !== "0x0000000000000000000000000000000000000000",
10794
+ currency: assertion.currency,
10795
+ bond: BigInt(assertion.bond)
10718
10796
  };
10719
10797
  }
10720
10798
  /**