@oddmaki-protocol/sdk 0.4.1 → 0.5.1
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 +164 -76
- package/dist/index.d.ts +164 -76
- package/dist/index.js +189 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +189 -96
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,9 +7,9 @@ var graphqlRequest = require('graphql-request');
|
|
|
7
7
|
// src/client.ts
|
|
8
8
|
var CONTRACT_ADDRESSES = {
|
|
9
9
|
[chains.baseSepolia.id]: {
|
|
10
|
-
diamond: "
|
|
10
|
+
diamond: "0xd6b87a68de56ddef64b270feb74fd3c684e91b20",
|
|
11
11
|
conditionalTokens: "0x7364747372Ac4a175B5326f5B2C9CB1C271d32e8",
|
|
12
|
-
usdc: "
|
|
12
|
+
usdc: "0x9a537902b0456ce532ee58859a0e9db47c647668",
|
|
13
13
|
subgraph: "https://api.studio.thegraph.com/query/1716020/oddmaki/version/latest"
|
|
14
14
|
}
|
|
15
15
|
};
|
|
@@ -40,6 +40,19 @@ var BaseModule = class {
|
|
|
40
40
|
}
|
|
41
41
|
return this.config.walletClient;
|
|
42
42
|
}
|
|
43
|
+
// Returns the hoisted LocalAccount when the wallet was created with a private
|
|
44
|
+
// key, so viem signs locally (eth_sendRawTransaction). Falls back to the
|
|
45
|
+
// address string for injected/JSON-RPC providers (wagmi, RainbowKit, etc).
|
|
46
|
+
async getSignerAccount() {
|
|
47
|
+
const wallet = this.walletClient;
|
|
48
|
+
if (wallet.account) return wallet.account;
|
|
49
|
+
const [address] = await wallet.getAddresses();
|
|
50
|
+
return address;
|
|
51
|
+
}
|
|
52
|
+
async getSignerAddress() {
|
|
53
|
+
const signer = await this.getSignerAccount();
|
|
54
|
+
return typeof signer === "string" ? signer : signer.address;
|
|
55
|
+
}
|
|
43
56
|
};
|
|
44
57
|
|
|
45
58
|
// src/contracts/abis/VenueFacet.json
|
|
@@ -919,6 +932,16 @@ var MarketsFacet_default = [
|
|
|
919
932
|
name: "protocolFeeBps",
|
|
920
933
|
type: "uint256",
|
|
921
934
|
internalType: "uint256"
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
name: "protocolFeeRecipient",
|
|
938
|
+
type: "address",
|
|
939
|
+
internalType: "address"
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
name: "venueFeeRecipient",
|
|
943
|
+
type: "address",
|
|
944
|
+
internalType: "address"
|
|
922
945
|
}
|
|
923
946
|
]
|
|
924
947
|
}
|
|
@@ -1786,6 +1809,16 @@ var LimitOrdersFacet_default = [
|
|
|
1786
1809
|
name: "InvalidTick",
|
|
1787
1810
|
inputs: []
|
|
1788
1811
|
},
|
|
1812
|
+
{
|
|
1813
|
+
type: "error",
|
|
1814
|
+
name: "MakerErc165CallFailed",
|
|
1815
|
+
inputs: []
|
|
1816
|
+
},
|
|
1817
|
+
{
|
|
1818
|
+
type: "error",
|
|
1819
|
+
name: "MakerNotErc1155Receiver",
|
|
1820
|
+
inputs: []
|
|
1821
|
+
},
|
|
1789
1822
|
{
|
|
1790
1823
|
type: "error",
|
|
1791
1824
|
name: "MarketNotActive",
|
|
@@ -3373,6 +3406,16 @@ var MarketOrdersFacet_default = [
|
|
|
3373
3406
|
name: "InvalidOutcome",
|
|
3374
3407
|
inputs: []
|
|
3375
3408
|
},
|
|
3409
|
+
{
|
|
3410
|
+
type: "error",
|
|
3411
|
+
name: "MakerErc165CallFailed",
|
|
3412
|
+
inputs: []
|
|
3413
|
+
},
|
|
3414
|
+
{
|
|
3415
|
+
type: "error",
|
|
3416
|
+
name: "MakerNotErc1155Receiver",
|
|
3417
|
+
inputs: []
|
|
3418
|
+
},
|
|
3376
3419
|
{
|
|
3377
3420
|
type: "error",
|
|
3378
3421
|
name: "MarketNotActive",
|
|
@@ -4093,6 +4136,33 @@ var NegRiskFacet_default = [
|
|
|
4093
4136
|
type: "error",
|
|
4094
4137
|
name: "ApproveFailed",
|
|
4095
4138
|
inputs: []
|
|
4139
|
+
},
|
|
4140
|
+
{
|
|
4141
|
+
type: "error",
|
|
4142
|
+
name: "DuplicateConditionId",
|
|
4143
|
+
inputs: [
|
|
4144
|
+
{
|
|
4145
|
+
name: "conditionId",
|
|
4146
|
+
type: "bytes32",
|
|
4147
|
+
internalType: "bytes32"
|
|
4148
|
+
}
|
|
4149
|
+
]
|
|
4150
|
+
},
|
|
4151
|
+
{
|
|
4152
|
+
type: "error",
|
|
4153
|
+
name: "InvalidIndexSet",
|
|
4154
|
+
inputs: []
|
|
4155
|
+
},
|
|
4156
|
+
{
|
|
4157
|
+
type: "error",
|
|
4158
|
+
name: "UnregisteredConditionId",
|
|
4159
|
+
inputs: [
|
|
4160
|
+
{
|
|
4161
|
+
name: "conditionId",
|
|
4162
|
+
type: "bytes32",
|
|
4163
|
+
internalType: "bytes32"
|
|
4164
|
+
}
|
|
4165
|
+
]
|
|
4096
4166
|
}
|
|
4097
4167
|
];
|
|
4098
4168
|
|
|
@@ -5153,6 +5223,19 @@ var PythResolutionFacet_default = [
|
|
|
5153
5223
|
],
|
|
5154
5224
|
stateMutability: "payable"
|
|
5155
5225
|
},
|
|
5226
|
+
{
|
|
5227
|
+
type: "function",
|
|
5228
|
+
name: "getOpenMaxStaleness",
|
|
5229
|
+
inputs: [],
|
|
5230
|
+
outputs: [
|
|
5231
|
+
{
|
|
5232
|
+
name: "",
|
|
5233
|
+
type: "uint256",
|
|
5234
|
+
internalType: "uint256"
|
|
5235
|
+
}
|
|
5236
|
+
],
|
|
5237
|
+
stateMutability: "view"
|
|
5238
|
+
},
|
|
5156
5239
|
{
|
|
5157
5240
|
type: "function",
|
|
5158
5241
|
name: "getPythContract",
|
|
@@ -5184,19 +5267,6 @@ var PythResolutionFacet_default = [
|
|
|
5184
5267
|
outputs: [],
|
|
5185
5268
|
stateMutability: "payable"
|
|
5186
5269
|
},
|
|
5187
|
-
{
|
|
5188
|
-
type: "function",
|
|
5189
|
-
name: "setPythContract",
|
|
5190
|
-
inputs: [
|
|
5191
|
-
{
|
|
5192
|
-
name: "pythContract",
|
|
5193
|
-
type: "address",
|
|
5194
|
-
internalType: "address"
|
|
5195
|
-
}
|
|
5196
|
-
],
|
|
5197
|
-
outputs: [],
|
|
5198
|
-
stateMutability: "nonpayable"
|
|
5199
|
-
},
|
|
5200
5270
|
{
|
|
5201
5271
|
type: "function",
|
|
5202
5272
|
name: "setOpenMaxStaleness",
|
|
@@ -5212,16 +5282,16 @@ var PythResolutionFacet_default = [
|
|
|
5212
5282
|
},
|
|
5213
5283
|
{
|
|
5214
5284
|
type: "function",
|
|
5215
|
-
name: "
|
|
5216
|
-
inputs: [
|
|
5217
|
-
outputs: [
|
|
5285
|
+
name: "setPythContract",
|
|
5286
|
+
inputs: [
|
|
5218
5287
|
{
|
|
5219
|
-
name: "",
|
|
5220
|
-
type: "
|
|
5221
|
-
internalType: "
|
|
5288
|
+
name: "pythContract",
|
|
5289
|
+
type: "address",
|
|
5290
|
+
internalType: "address"
|
|
5222
5291
|
}
|
|
5223
5292
|
],
|
|
5224
|
-
|
|
5293
|
+
outputs: [],
|
|
5294
|
+
stateMutability: "nonpayable"
|
|
5225
5295
|
},
|
|
5226
5296
|
{
|
|
5227
5297
|
type: "event",
|
|
@@ -5346,6 +5416,19 @@ var PythResolutionFacet_default = [
|
|
|
5346
5416
|
],
|
|
5347
5417
|
anonymous: false
|
|
5348
5418
|
},
|
|
5419
|
+
{
|
|
5420
|
+
type: "event",
|
|
5421
|
+
name: "OpenMaxStalenessUpdated",
|
|
5422
|
+
inputs: [
|
|
5423
|
+
{
|
|
5424
|
+
name: "openMaxStaleness",
|
|
5425
|
+
type: "uint256",
|
|
5426
|
+
indexed: false,
|
|
5427
|
+
internalType: "uint256"
|
|
5428
|
+
}
|
|
5429
|
+
],
|
|
5430
|
+
anonymous: false
|
|
5431
|
+
},
|
|
5349
5432
|
{
|
|
5350
5433
|
type: "event",
|
|
5351
5434
|
name: "PriceMarketCreatedPyth",
|
|
@@ -5445,19 +5528,6 @@ var PythResolutionFacet_default = [
|
|
|
5445
5528
|
],
|
|
5446
5529
|
anonymous: false
|
|
5447
5530
|
},
|
|
5448
|
-
{
|
|
5449
|
-
type: "event",
|
|
5450
|
-
name: "OpenMaxStalenessUpdated",
|
|
5451
|
-
inputs: [
|
|
5452
|
-
{
|
|
5453
|
-
name: "openMaxStaleness",
|
|
5454
|
-
type: "uint256",
|
|
5455
|
-
indexed: false,
|
|
5456
|
-
internalType: "uint256"
|
|
5457
|
-
}
|
|
5458
|
-
],
|
|
5459
|
-
anonymous: false
|
|
5460
|
-
},
|
|
5461
5531
|
{
|
|
5462
5532
|
type: "event",
|
|
5463
5533
|
name: "WrappedCollateralRegistered",
|
|
@@ -5563,6 +5633,11 @@ var PythResolutionFacet_default = [
|
|
|
5563
5633
|
name: "MarketNotActive",
|
|
5564
5634
|
inputs: []
|
|
5565
5635
|
},
|
|
5636
|
+
{
|
|
5637
|
+
type: "error",
|
|
5638
|
+
name: "NoValidPriceUpdate",
|
|
5639
|
+
inputs: []
|
|
5640
|
+
},
|
|
5566
5641
|
{
|
|
5567
5642
|
type: "error",
|
|
5568
5643
|
name: "NotContractOwner",
|
|
@@ -5614,6 +5689,11 @@ var PythResolutionFacet_default = [
|
|
|
5614
5689
|
name: "RegistryAlreadyExists",
|
|
5615
5690
|
inputs: []
|
|
5616
5691
|
},
|
|
5692
|
+
{
|
|
5693
|
+
type: "error",
|
|
5694
|
+
name: "ResolutionWindowTooLarge",
|
|
5695
|
+
inputs: []
|
|
5696
|
+
},
|
|
5617
5697
|
{
|
|
5618
5698
|
type: "error",
|
|
5619
5699
|
name: "TooManyTags",
|
|
@@ -5945,6 +6025,16 @@ var BatchOrdersFacet_default = [
|
|
|
5945
6025
|
name: "InvalidTick",
|
|
5946
6026
|
inputs: []
|
|
5947
6027
|
},
|
|
6028
|
+
{
|
|
6029
|
+
type: "error",
|
|
6030
|
+
name: "MakerErc165CallFailed",
|
|
6031
|
+
inputs: []
|
|
6032
|
+
},
|
|
6033
|
+
{
|
|
6034
|
+
type: "error",
|
|
6035
|
+
name: "MakerNotErc1155Receiver",
|
|
6036
|
+
inputs: []
|
|
6037
|
+
},
|
|
5948
6038
|
{
|
|
5949
6039
|
type: "error",
|
|
5950
6040
|
name: "MarketNotActive",
|
|
@@ -6755,7 +6845,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6755
6845
|
*/
|
|
6756
6846
|
async createVenue(params) {
|
|
6757
6847
|
const wallet = this.walletClient;
|
|
6758
|
-
const
|
|
6848
|
+
const account = await this.getSignerAccount();
|
|
6759
6849
|
const { request } = await this.publicClient.simulateContract({
|
|
6760
6850
|
address: this.config.diamondAddress,
|
|
6761
6851
|
abi: VenueFacet_default,
|
|
@@ -6782,7 +6872,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6782
6872
|
*/
|
|
6783
6873
|
async updateFees(params) {
|
|
6784
6874
|
const wallet = this.walletClient;
|
|
6785
|
-
const
|
|
6875
|
+
const account = await this.getSignerAccount();
|
|
6786
6876
|
const { request } = await this.publicClient.simulateContract({
|
|
6787
6877
|
address: this.config.diamondAddress,
|
|
6788
6878
|
abi: VenueFacet_default,
|
|
@@ -6797,7 +6887,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6797
6887
|
*/
|
|
6798
6888
|
async setPaused(venueId, paused) {
|
|
6799
6889
|
const wallet = this.walletClient;
|
|
6800
|
-
const
|
|
6890
|
+
const account = await this.getSignerAccount();
|
|
6801
6891
|
const functionName = paused ? "pauseVenue" : "unpauseVenue";
|
|
6802
6892
|
const { request } = await this.publicClient.simulateContract({
|
|
6803
6893
|
address: this.config.diamondAddress,
|
|
@@ -6824,7 +6914,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6824
6914
|
*/
|
|
6825
6915
|
async updateVenue(params) {
|
|
6826
6916
|
const wallet = this.walletClient;
|
|
6827
|
-
const
|
|
6917
|
+
const account = await this.getSignerAccount();
|
|
6828
6918
|
const { request } = await this.publicClient.simulateContract({
|
|
6829
6919
|
address: this.config.diamondAddress,
|
|
6830
6920
|
abi: VenueFacet_default,
|
|
@@ -6846,7 +6936,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6846
6936
|
*/
|
|
6847
6937
|
async updateOracleParams(params) {
|
|
6848
6938
|
const wallet = this.walletClient;
|
|
6849
|
-
const
|
|
6939
|
+
const account = await this.getSignerAccount();
|
|
6850
6940
|
const { request } = await this.publicClient.simulateContract({
|
|
6851
6941
|
address: this.config.diamondAddress,
|
|
6852
6942
|
abi: VenueFacet_default,
|
|
@@ -6895,7 +6985,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6895
6985
|
*/
|
|
6896
6986
|
async setProtocolFeeBps(bps) {
|
|
6897
6987
|
const wallet = this.walletClient;
|
|
6898
|
-
const
|
|
6988
|
+
const account = await this.getSignerAccount();
|
|
6899
6989
|
const { request } = await this.publicClient.simulateContract({
|
|
6900
6990
|
address: this.config.diamondAddress,
|
|
6901
6991
|
abi: ProtocolFacet_default,
|
|
@@ -7156,7 +7246,8 @@ var MarketModule = class extends BaseModule {
|
|
|
7156
7246
|
*/
|
|
7157
7247
|
async createMarket(params) {
|
|
7158
7248
|
const wallet = this.walletClient;
|
|
7159
|
-
const
|
|
7249
|
+
const account = await this.getSignerAccount();
|
|
7250
|
+
const accountAddress = await this.getSignerAddress();
|
|
7160
7251
|
const venue = await this.publicClient.readContract({
|
|
7161
7252
|
address: this.config.diamondAddress,
|
|
7162
7253
|
abi: VenueFacet_default,
|
|
@@ -7171,7 +7262,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7171
7262
|
address: params.collateralToken,
|
|
7172
7263
|
abi: viem.erc20Abi,
|
|
7173
7264
|
functionName: "allowance",
|
|
7174
|
-
args: [
|
|
7265
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
7175
7266
|
});
|
|
7176
7267
|
if (allowance < totalRequired) {
|
|
7177
7268
|
throw new Error(
|
|
@@ -7182,7 +7273,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7182
7273
|
address: params.collateralToken,
|
|
7183
7274
|
abi: viem.erc20Abi,
|
|
7184
7275
|
functionName: "balanceOf",
|
|
7185
|
-
args: [
|
|
7276
|
+
args: [accountAddress]
|
|
7186
7277
|
});
|
|
7187
7278
|
if (balance < totalRequired) {
|
|
7188
7279
|
throw new Error(
|
|
@@ -7425,7 +7516,8 @@ var MarketModule = class extends BaseModule {
|
|
|
7425
7516
|
*/
|
|
7426
7517
|
async createMarketGroup(params) {
|
|
7427
7518
|
const wallet = this.walletClient;
|
|
7428
|
-
const
|
|
7519
|
+
const account = await this.getSignerAccount();
|
|
7520
|
+
const accountAddress = await this.getSignerAddress();
|
|
7429
7521
|
const venue = await this.publicClient.readContract({
|
|
7430
7522
|
address: this.config.diamondAddress,
|
|
7431
7523
|
abi: VenueFacet_default,
|
|
@@ -7440,7 +7532,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7440
7532
|
address: params.collateralToken,
|
|
7441
7533
|
abi: viem.erc20Abi,
|
|
7442
7534
|
functionName: "allowance",
|
|
7443
|
-
args: [
|
|
7535
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
7444
7536
|
});
|
|
7445
7537
|
if (allowance < totalRequired) {
|
|
7446
7538
|
throw new Error(
|
|
@@ -7451,7 +7543,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7451
7543
|
address: params.collateralToken,
|
|
7452
7544
|
abi: viem.erc20Abi,
|
|
7453
7545
|
functionName: "balanceOf",
|
|
7454
|
-
args: [
|
|
7546
|
+
args: [accountAddress]
|
|
7455
7547
|
});
|
|
7456
7548
|
if (balance < totalRequired) {
|
|
7457
7549
|
throw new Error(
|
|
@@ -7488,7 +7580,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7488
7580
|
*/
|
|
7489
7581
|
async addMarketToGroup(params) {
|
|
7490
7582
|
const wallet = this.walletClient;
|
|
7491
|
-
const
|
|
7583
|
+
const account = await this.getSignerAccount();
|
|
7492
7584
|
const { request } = await this.publicClient.simulateContract({
|
|
7493
7585
|
address: this.config.diamondAddress,
|
|
7494
7586
|
abi: MarketsFacet_default,
|
|
@@ -7503,7 +7595,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7503
7595
|
*/
|
|
7504
7596
|
async addPlaceholderMarkets(params) {
|
|
7505
7597
|
const wallet = this.walletClient;
|
|
7506
|
-
const
|
|
7598
|
+
const account = await this.getSignerAccount();
|
|
7507
7599
|
if (params.count < 1n || params.count > 50n) {
|
|
7508
7600
|
throw new Error("Count must be between 1 and 50");
|
|
7509
7601
|
}
|
|
@@ -7521,7 +7613,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7521
7613
|
*/
|
|
7522
7614
|
async activatePlaceholder(params) {
|
|
7523
7615
|
const wallet = this.walletClient;
|
|
7524
|
-
const
|
|
7616
|
+
const account = await this.getSignerAccount();
|
|
7525
7617
|
const { request } = await this.publicClient.simulateContract({
|
|
7526
7618
|
address: this.config.diamondAddress,
|
|
7527
7619
|
abi: MarketsFacet_default,
|
|
@@ -7541,7 +7633,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7541
7633
|
*/
|
|
7542
7634
|
async activateMarketGroup(params) {
|
|
7543
7635
|
const wallet = this.walletClient;
|
|
7544
|
-
const
|
|
7636
|
+
const account = await this.getSignerAccount();
|
|
7545
7637
|
const { request } = await this.publicClient.simulateContract({
|
|
7546
7638
|
address: this.config.diamondAddress,
|
|
7547
7639
|
abi: MarketGroupFacet_default,
|
|
@@ -7558,7 +7650,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7558
7650
|
*/
|
|
7559
7651
|
async convertPositions(params) {
|
|
7560
7652
|
const wallet = this.walletClient;
|
|
7561
|
-
const
|
|
7653
|
+
const account = await this.getSignerAccount();
|
|
7562
7654
|
const isApproved = await this.publicClient.readContract({
|
|
7563
7655
|
address: this.config.conditionalTokensAddress,
|
|
7564
7656
|
abi: ConditionalTokens_default,
|
|
@@ -7714,7 +7806,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7714
7806
|
*/
|
|
7715
7807
|
async pauseMarket(marketId) {
|
|
7716
7808
|
const wallet = this.walletClient;
|
|
7717
|
-
const
|
|
7809
|
+
const account = await this.getSignerAccount();
|
|
7718
7810
|
const { request } = await this.publicClient.simulateContract({
|
|
7719
7811
|
address: this.config.diamondAddress,
|
|
7720
7812
|
abi: MarketsFacet_default,
|
|
@@ -7730,7 +7822,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7730
7822
|
*/
|
|
7731
7823
|
async unpauseMarket(marketId) {
|
|
7732
7824
|
const wallet = this.walletClient;
|
|
7733
|
-
const
|
|
7825
|
+
const account = await this.getSignerAccount();
|
|
7734
7826
|
const { request } = await this.publicClient.simulateContract({
|
|
7735
7827
|
address: this.config.diamondAddress,
|
|
7736
7828
|
abi: MarketsFacet_default,
|
|
@@ -7749,7 +7841,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7749
7841
|
*/
|
|
7750
7842
|
async updateMarketTags(params) {
|
|
7751
7843
|
const wallet = this.walletClient;
|
|
7752
|
-
const
|
|
7844
|
+
const account = await this.getSignerAccount();
|
|
7753
7845
|
const encodedTags = params.tags.map(
|
|
7754
7846
|
(t) => viem.stringToHex(t, { size: 32 })
|
|
7755
7847
|
);
|
|
@@ -7768,7 +7860,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7768
7860
|
*/
|
|
7769
7861
|
async updateMarketGroupTags(params) {
|
|
7770
7862
|
const wallet = this.walletClient;
|
|
7771
|
-
const
|
|
7863
|
+
const account = await this.getSignerAccount();
|
|
7772
7864
|
const encodedTags = params.tags.map(
|
|
7773
7865
|
(t) => viem.stringToHex(t, { size: 32 })
|
|
7774
7866
|
);
|
|
@@ -7790,7 +7882,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7790
7882
|
*/
|
|
7791
7883
|
async updateMarketMetadata(params) {
|
|
7792
7884
|
const wallet = this.walletClient;
|
|
7793
|
-
const
|
|
7885
|
+
const account = await this.getSignerAccount();
|
|
7794
7886
|
const { request } = await this.publicClient.simulateContract({
|
|
7795
7887
|
address: this.config.diamondAddress,
|
|
7796
7888
|
abi: MetadataFacet_default,
|
|
@@ -7806,7 +7898,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7806
7898
|
*/
|
|
7807
7899
|
async updateMarketGroupMetadata(params) {
|
|
7808
7900
|
const wallet = this.walletClient;
|
|
7809
|
-
const
|
|
7901
|
+
const account = await this.getSignerAccount();
|
|
7810
7902
|
const { request } = await this.publicClient.simulateContract({
|
|
7811
7903
|
address: this.config.diamondAddress,
|
|
7812
7904
|
abi: MetadataFacet_default,
|
|
@@ -7826,7 +7918,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7826
7918
|
*/
|
|
7827
7919
|
async placeOrder(params) {
|
|
7828
7920
|
const wallet = this.walletClient;
|
|
7829
|
-
const
|
|
7921
|
+
const account = await this.getSignerAccount();
|
|
7830
7922
|
const { request } = await this.publicClient.simulateContract({
|
|
7831
7923
|
address: this.config.diamondAddress,
|
|
7832
7924
|
abi: LimitOrdersFacet_default,
|
|
@@ -7878,7 +7970,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7878
7970
|
*/
|
|
7879
7971
|
async cancelOrder(orderId) {
|
|
7880
7972
|
const wallet = this.walletClient;
|
|
7881
|
-
const
|
|
7973
|
+
const account = await this.getSignerAccount();
|
|
7882
7974
|
const { request } = await this.publicClient.simulateContract({
|
|
7883
7975
|
address: this.config.diamondAddress,
|
|
7884
7976
|
abi: LimitOrdersFacet_default,
|
|
@@ -7897,7 +7989,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7897
7989
|
*/
|
|
7898
7990
|
async cancelOrdersOnResolvedMarket(marketId, orderIds) {
|
|
7899
7991
|
const wallet = this.walletClient;
|
|
7900
|
-
const
|
|
7992
|
+
const account = await this.getSignerAccount();
|
|
7901
7993
|
const { request } = await this.publicClient.simulateContract({
|
|
7902
7994
|
address: this.config.diamondAddress,
|
|
7903
7995
|
abi: LimitOrdersFacet_default,
|
|
@@ -7918,7 +8010,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7918
8010
|
*/
|
|
7919
8011
|
async placeMarketOrder(params) {
|
|
7920
8012
|
const wallet = this.walletClient;
|
|
7921
|
-
const
|
|
8013
|
+
const account = await this.getSignerAccount();
|
|
7922
8014
|
const { request } = await this.publicClient.simulateContract({
|
|
7923
8015
|
address: this.config.diamondAddress,
|
|
7924
8016
|
abi: MarketOrdersFacet_default,
|
|
@@ -7964,8 +8056,8 @@ var TradeModule = class extends BaseModule {
|
|
|
7964
8056
|
* Preview a market order (simulate transaction)
|
|
7965
8057
|
*/
|
|
7966
8058
|
async previewMarketOrder(params) {
|
|
7967
|
-
|
|
7968
|
-
const
|
|
8059
|
+
this.walletClient;
|
|
8060
|
+
const account = await this.getSignerAccount();
|
|
7969
8061
|
const { result } = await this.publicClient.simulateContract({
|
|
7970
8062
|
address: this.config.diamondAddress,
|
|
7971
8063
|
abi: MarketOrdersFacet_default,
|
|
@@ -7985,8 +8077,8 @@ var TradeModule = class extends BaseModule {
|
|
|
7985
8077
|
* Preview placing an order (simulate transaction to check for reverts)
|
|
7986
8078
|
*/
|
|
7987
8079
|
async previewPlaceOrder(params) {
|
|
7988
|
-
|
|
7989
|
-
const
|
|
8080
|
+
this.walletClient;
|
|
8081
|
+
const account = await this.getSignerAccount();
|
|
7990
8082
|
const { result } = await this.publicClient.simulateContract({
|
|
7991
8083
|
address: this.config.diamondAddress,
|
|
7992
8084
|
abi: LimitOrdersFacet_default,
|
|
@@ -8014,7 +8106,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8014
8106
|
*/
|
|
8015
8107
|
async placeMarketSell(params) {
|
|
8016
8108
|
const wallet = this.walletClient;
|
|
8017
|
-
const
|
|
8109
|
+
const account = await this.getSignerAccount();
|
|
8018
8110
|
const { request } = await this.publicClient.simulateContract({
|
|
8019
8111
|
address: this.config.diamondAddress,
|
|
8020
8112
|
abi: MarketOrdersFacet_default,
|
|
@@ -8060,8 +8152,8 @@ var TradeModule = class extends BaseModule {
|
|
|
8060
8152
|
* Preview a market sell order (simulate transaction)
|
|
8061
8153
|
*/
|
|
8062
8154
|
async previewMarketSell(params) {
|
|
8063
|
-
|
|
8064
|
-
const
|
|
8155
|
+
this.walletClient;
|
|
8156
|
+
const account = await this.getSignerAccount();
|
|
8065
8157
|
const { result } = await this.publicClient.simulateContract({
|
|
8066
8158
|
address: this.config.diamondAddress,
|
|
8067
8159
|
abi: MarketOrdersFacet_default,
|
|
@@ -8120,7 +8212,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8120
8212
|
*/
|
|
8121
8213
|
async matchOrders(params) {
|
|
8122
8214
|
const wallet = this.walletClient;
|
|
8123
|
-
const
|
|
8215
|
+
const account = await this.getSignerAccount();
|
|
8124
8216
|
const maxSteps = params.maxSteps || 10n;
|
|
8125
8217
|
const { request } = await this.publicClient.simulateContract({
|
|
8126
8218
|
address: this.config.diamondAddress,
|
|
@@ -8220,7 +8312,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8220
8312
|
*/
|
|
8221
8313
|
async splitPosition(marketId, amount) {
|
|
8222
8314
|
const wallet = this.walletClient;
|
|
8223
|
-
const
|
|
8315
|
+
const account = await this.getSignerAccount();
|
|
8224
8316
|
const { request } = await this.publicClient.simulateContract({
|
|
8225
8317
|
address: this.config.diamondAddress,
|
|
8226
8318
|
abi: VaultFacet_default,
|
|
@@ -8238,7 +8330,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8238
8330
|
*/
|
|
8239
8331
|
async mergePositions(marketId, amount) {
|
|
8240
8332
|
const wallet = this.walletClient;
|
|
8241
|
-
const
|
|
8333
|
+
const account = await this.getSignerAccount();
|
|
8242
8334
|
const { request } = await this.publicClient.simulateContract({
|
|
8243
8335
|
address: this.config.diamondAddress,
|
|
8244
8336
|
abi: VaultFacet_default,
|
|
@@ -8259,7 +8351,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8259
8351
|
*/
|
|
8260
8352
|
async batchPlaceOrders(params) {
|
|
8261
8353
|
const wallet = this.walletClient;
|
|
8262
|
-
const
|
|
8354
|
+
const account = await this.getSignerAccount();
|
|
8263
8355
|
const { request } = await this.publicClient.simulateContract({
|
|
8264
8356
|
address: this.config.diamondAddress,
|
|
8265
8357
|
abi: BatchOrdersFacet_default,
|
|
@@ -8300,7 +8392,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8300
8392
|
*/
|
|
8301
8393
|
async batchCancelOrders(orderIds) {
|
|
8302
8394
|
const wallet = this.walletClient;
|
|
8303
|
-
const
|
|
8395
|
+
const account = await this.getSignerAccount();
|
|
8304
8396
|
const { request } = await this.publicClient.simulateContract({
|
|
8305
8397
|
address: this.config.diamondAddress,
|
|
8306
8398
|
abi: BatchOrdersFacet_default,
|
|
@@ -8319,7 +8411,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8319
8411
|
*/
|
|
8320
8412
|
async cancelAndReplace(params) {
|
|
8321
8413
|
const wallet = this.walletClient;
|
|
8322
|
-
const
|
|
8414
|
+
const account = await this.getSignerAccount();
|
|
8323
8415
|
const { request } = await this.publicClient.simulateContract({
|
|
8324
8416
|
address: this.config.diamondAddress,
|
|
8325
8417
|
abi: BatchOrdersFacet_default,
|
|
@@ -9844,7 +9936,7 @@ var TokenModule = class extends BaseModule {
|
|
|
9844
9936
|
*/
|
|
9845
9937
|
async mint(token, to, amount) {
|
|
9846
9938
|
const wallet = this.walletClient;
|
|
9847
|
-
const
|
|
9939
|
+
const account = await this.getSignerAccount();
|
|
9848
9940
|
const { request } = await this.publicClient.simulateContract({
|
|
9849
9941
|
address: token,
|
|
9850
9942
|
abi: ERC20_default,
|
|
@@ -9859,7 +9951,7 @@ var TokenModule = class extends BaseModule {
|
|
|
9859
9951
|
*/
|
|
9860
9952
|
async approve(token, spender, amount) {
|
|
9861
9953
|
const wallet = this.walletClient;
|
|
9862
|
-
const
|
|
9954
|
+
const account = await this.getSignerAccount();
|
|
9863
9955
|
const { request } = await this.publicClient.simulateContract({
|
|
9864
9956
|
address: token,
|
|
9865
9957
|
abi: ERC20_default,
|
|
@@ -9943,7 +10035,8 @@ var UmaModule = class extends BaseModule {
|
|
|
9943
10035
|
*/
|
|
9944
10036
|
async assertMarketOutcome(params) {
|
|
9945
10037
|
const wallet = this.walletClient;
|
|
9946
|
-
const
|
|
10038
|
+
const account = await this.getSignerAccount();
|
|
10039
|
+
const accountAddress = await this.getSignerAddress();
|
|
9947
10040
|
const autoApprove = params.autoApprove ?? true;
|
|
9948
10041
|
const registryData = await this.publicClient.readContract({
|
|
9949
10042
|
address: this.config.diamondAddress,
|
|
@@ -9958,7 +10051,7 @@ var UmaModule = class extends BaseModule {
|
|
|
9958
10051
|
address: currency,
|
|
9959
10052
|
abi: viem.erc20Abi,
|
|
9960
10053
|
functionName: "allowance",
|
|
9961
|
-
args: [
|
|
10054
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
9962
10055
|
});
|
|
9963
10056
|
if (currentAllowance < bondAmount && autoApprove) {
|
|
9964
10057
|
const approveHash = await wallet.writeContract({
|
|
@@ -9978,7 +10071,7 @@ var UmaModule = class extends BaseModule {
|
|
|
9978
10071
|
address: currency,
|
|
9979
10072
|
abi: viem.erc20Abi,
|
|
9980
10073
|
functionName: "allowance",
|
|
9981
|
-
args: [
|
|
10074
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
9982
10075
|
});
|
|
9983
10076
|
if (newAllowance < bondAmount) {
|
|
9984
10077
|
throw new Error(
|
|
@@ -9994,7 +10087,7 @@ var UmaModule = class extends BaseModule {
|
|
|
9994
10087
|
address: currency,
|
|
9995
10088
|
abi: viem.erc20Abi,
|
|
9996
10089
|
functionName: "balanceOf",
|
|
9997
|
-
args: [
|
|
10090
|
+
args: [accountAddress]
|
|
9998
10091
|
});
|
|
9999
10092
|
if (balance < bondAmount) {
|
|
10000
10093
|
throw new Error(
|
|
@@ -10042,7 +10135,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10042
10135
|
*/
|
|
10043
10136
|
async settleAssertion(assertionId) {
|
|
10044
10137
|
const wallet = this.walletClient;
|
|
10045
|
-
const
|
|
10138
|
+
const account = await this.getSignerAccount();
|
|
10046
10139
|
const { request } = await this.publicClient.simulateContract({
|
|
10047
10140
|
address: this.config.diamondAddress,
|
|
10048
10141
|
abi: ResolutionFacet_default,
|
|
@@ -10057,7 +10150,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10057
10150
|
*/
|
|
10058
10151
|
async reportResolution(params) {
|
|
10059
10152
|
const wallet = this.walletClient;
|
|
10060
|
-
const
|
|
10153
|
+
const account = await this.getSignerAccount();
|
|
10061
10154
|
const { request } = await this.publicClient.simulateContract({
|
|
10062
10155
|
address: this.config.diamondAddress,
|
|
10063
10156
|
abi: ResolutionFacet_default,
|
|
@@ -10124,7 +10217,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10124
10217
|
*/
|
|
10125
10218
|
async redeemWinnings(marketId) {
|
|
10126
10219
|
const wallet = this.walletClient;
|
|
10127
|
-
const
|
|
10220
|
+
const account = await this.getSignerAccount();
|
|
10128
10221
|
const oracleData = await this.publicClient.readContract({
|
|
10129
10222
|
address: this.config.diamondAddress,
|
|
10130
10223
|
abi: MarketsFacet_default,
|
|
@@ -10371,7 +10464,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10371
10464
|
*/
|
|
10372
10465
|
async deployWhitelist() {
|
|
10373
10466
|
const wallet = this.walletClient;
|
|
10374
|
-
const
|
|
10467
|
+
const account = await this.getSignerAccount();
|
|
10375
10468
|
const { request } = await this.publicClient.simulateContract({
|
|
10376
10469
|
address: this.config.diamondAddress,
|
|
10377
10470
|
abi: AccessControlFacet_default,
|
|
@@ -10389,7 +10482,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10389
10482
|
*/
|
|
10390
10483
|
async deployNFTGated(params) {
|
|
10391
10484
|
const wallet = this.walletClient;
|
|
10392
|
-
const
|
|
10485
|
+
const account = await this.getSignerAccount();
|
|
10393
10486
|
const { request } = await this.publicClient.simulateContract({
|
|
10394
10487
|
address: this.config.diamondAddress,
|
|
10395
10488
|
abi: AccessControlFacet_default,
|
|
@@ -10406,7 +10499,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10406
10499
|
*/
|
|
10407
10500
|
async deployTokenGated(params) {
|
|
10408
10501
|
const wallet = this.walletClient;
|
|
10409
|
-
const
|
|
10502
|
+
const account = await this.getSignerAccount();
|
|
10410
10503
|
const { request } = await this.publicClient.simulateContract({
|
|
10411
10504
|
address: this.config.diamondAddress,
|
|
10412
10505
|
abi: AccessControlFacet_default,
|
|
@@ -10422,7 +10515,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10422
10515
|
*/
|
|
10423
10516
|
async setMarketTradingAC(params) {
|
|
10424
10517
|
const wallet = this.walletClient;
|
|
10425
|
-
const
|
|
10518
|
+
const account = await this.getSignerAccount();
|
|
10426
10519
|
const { request } = await this.publicClient.simulateContract({
|
|
10427
10520
|
address: this.config.diamondAddress,
|
|
10428
10521
|
abi: AccessControlFacet_default,
|
|
@@ -10437,7 +10530,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10437
10530
|
*/
|
|
10438
10531
|
async removeMarketTradingAC(params) {
|
|
10439
10532
|
const wallet = this.walletClient;
|
|
10440
|
-
const
|
|
10533
|
+
const account = await this.getSignerAccount();
|
|
10441
10534
|
const { request } = await this.publicClient.simulateContract({
|
|
10442
10535
|
address: this.config.diamondAddress,
|
|
10443
10536
|
abi: AccessControlFacet_default,
|
|
@@ -10476,7 +10569,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10476
10569
|
*/
|
|
10477
10570
|
async addToWhitelist(params) {
|
|
10478
10571
|
const wallet = this.walletClient;
|
|
10479
|
-
const
|
|
10572
|
+
const account = await this.getSignerAccount();
|
|
10480
10573
|
const { request } = await this.publicClient.simulateContract({
|
|
10481
10574
|
address: params.acContract,
|
|
10482
10575
|
abi: WhitelistAccessControl_default,
|
|
@@ -10491,7 +10584,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10491
10584
|
*/
|
|
10492
10585
|
async removeFromWhitelist(params) {
|
|
10493
10586
|
const wallet = this.walletClient;
|
|
10494
|
-
const
|
|
10587
|
+
const account = await this.getSignerAccount();
|
|
10495
10588
|
const { request } = await this.publicClient.simulateContract({
|
|
10496
10589
|
address: params.acContract,
|
|
10497
10590
|
abi: WhitelistAccessControl_default,
|
|
@@ -10553,10 +10646,10 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10553
10646
|
*/
|
|
10554
10647
|
async createPyth(params) {
|
|
10555
10648
|
const wallet = this.walletClient;
|
|
10556
|
-
const
|
|
10649
|
+
const account = await this.getSignerAccount();
|
|
10557
10650
|
const outcomes = params.outcomes ?? ["Up", "Down"];
|
|
10558
10651
|
const isStrikeMarket = params.strikePrice && params.strikePrice > BigInt(0);
|
|
10559
|
-
const { encodedTags, ancillaryData } = await this._prepareCreationCommon(params,
|
|
10652
|
+
const { encodedTags, ancillaryData } = await this._prepareCreationCommon(params, await this.getSignerAddress());
|
|
10560
10653
|
if (!isValidTickSize(params.tickSize)) {
|
|
10561
10654
|
throw new Error("Invalid tickSize: must be 1e15 (0.1%) or 1e16 (1%)");
|
|
10562
10655
|
}
|
|
@@ -10599,7 +10692,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10599
10692
|
*/
|
|
10600
10693
|
async resolvePyth(marketId) {
|
|
10601
10694
|
const wallet = this.walletClient;
|
|
10602
|
-
const
|
|
10695
|
+
const account = await this.getSignerAccount();
|
|
10603
10696
|
const pm = await this.get(marketId);
|
|
10604
10697
|
if (pm.resolved) {
|
|
10605
10698
|
throw new Error("Price market already resolved");
|
|
@@ -10692,7 +10785,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10692
10785
|
*/
|
|
10693
10786
|
async setPythContract(pythContract) {
|
|
10694
10787
|
const wallet = this.walletClient;
|
|
10695
|
-
const
|
|
10788
|
+
const account = await this.getSignerAccount();
|
|
10696
10789
|
const { request } = await this.publicClient.simulateContract({
|
|
10697
10790
|
address: this.config.diamondAddress,
|
|
10698
10791
|
abi: PythResolutionFacet_default,
|
|
@@ -10722,7 +10815,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10722
10815
|
*/
|
|
10723
10816
|
async setOpenMaxStaleness(openMaxStaleness) {
|
|
10724
10817
|
const wallet = this.walletClient;
|
|
10725
|
-
const
|
|
10818
|
+
const account = await this.getSignerAccount();
|
|
10726
10819
|
const { request } = await this.publicClient.simulateContract({
|
|
10727
10820
|
address: this.config.diamondAddress,
|
|
10728
10821
|
abi: PythResolutionFacet_default,
|