@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.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import { gql, GraphQLClient } from 'graphql-request';
|
|
|
5
5
|
// src/client.ts
|
|
6
6
|
var CONTRACT_ADDRESSES = {
|
|
7
7
|
[baseSepolia.id]: {
|
|
8
|
-
diamond: "
|
|
8
|
+
diamond: "0xd6b87a68de56ddef64b270feb74fd3c684e91b20",
|
|
9
9
|
conditionalTokens: "0x7364747372Ac4a175B5326f5B2C9CB1C271d32e8",
|
|
10
|
-
usdc: "
|
|
10
|
+
usdc: "0x9a537902b0456ce532ee58859a0e9db47c647668",
|
|
11
11
|
subgraph: "https://api.studio.thegraph.com/query/1716020/oddmaki/version/latest"
|
|
12
12
|
}
|
|
13
13
|
};
|
|
@@ -38,6 +38,19 @@ var BaseModule = class {
|
|
|
38
38
|
}
|
|
39
39
|
return this.config.walletClient;
|
|
40
40
|
}
|
|
41
|
+
// Returns the hoisted LocalAccount when the wallet was created with a private
|
|
42
|
+
// key, so viem signs locally (eth_sendRawTransaction). Falls back to the
|
|
43
|
+
// address string for injected/JSON-RPC providers (wagmi, RainbowKit, etc).
|
|
44
|
+
async getSignerAccount() {
|
|
45
|
+
const wallet = this.walletClient;
|
|
46
|
+
if (wallet.account) return wallet.account;
|
|
47
|
+
const [address] = await wallet.getAddresses();
|
|
48
|
+
return address;
|
|
49
|
+
}
|
|
50
|
+
async getSignerAddress() {
|
|
51
|
+
const signer = await this.getSignerAccount();
|
|
52
|
+
return typeof signer === "string" ? signer : signer.address;
|
|
53
|
+
}
|
|
41
54
|
};
|
|
42
55
|
|
|
43
56
|
// src/contracts/abis/VenueFacet.json
|
|
@@ -917,6 +930,16 @@ var MarketsFacet_default = [
|
|
|
917
930
|
name: "protocolFeeBps",
|
|
918
931
|
type: "uint256",
|
|
919
932
|
internalType: "uint256"
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
name: "protocolFeeRecipient",
|
|
936
|
+
type: "address",
|
|
937
|
+
internalType: "address"
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
name: "venueFeeRecipient",
|
|
941
|
+
type: "address",
|
|
942
|
+
internalType: "address"
|
|
920
943
|
}
|
|
921
944
|
]
|
|
922
945
|
}
|
|
@@ -1784,6 +1807,16 @@ var LimitOrdersFacet_default = [
|
|
|
1784
1807
|
name: "InvalidTick",
|
|
1785
1808
|
inputs: []
|
|
1786
1809
|
},
|
|
1810
|
+
{
|
|
1811
|
+
type: "error",
|
|
1812
|
+
name: "MakerErc165CallFailed",
|
|
1813
|
+
inputs: []
|
|
1814
|
+
},
|
|
1815
|
+
{
|
|
1816
|
+
type: "error",
|
|
1817
|
+
name: "MakerNotErc1155Receiver",
|
|
1818
|
+
inputs: []
|
|
1819
|
+
},
|
|
1787
1820
|
{
|
|
1788
1821
|
type: "error",
|
|
1789
1822
|
name: "MarketNotActive",
|
|
@@ -3371,6 +3404,16 @@ var MarketOrdersFacet_default = [
|
|
|
3371
3404
|
name: "InvalidOutcome",
|
|
3372
3405
|
inputs: []
|
|
3373
3406
|
},
|
|
3407
|
+
{
|
|
3408
|
+
type: "error",
|
|
3409
|
+
name: "MakerErc165CallFailed",
|
|
3410
|
+
inputs: []
|
|
3411
|
+
},
|
|
3412
|
+
{
|
|
3413
|
+
type: "error",
|
|
3414
|
+
name: "MakerNotErc1155Receiver",
|
|
3415
|
+
inputs: []
|
|
3416
|
+
},
|
|
3374
3417
|
{
|
|
3375
3418
|
type: "error",
|
|
3376
3419
|
name: "MarketNotActive",
|
|
@@ -4091,6 +4134,33 @@ var NegRiskFacet_default = [
|
|
|
4091
4134
|
type: "error",
|
|
4092
4135
|
name: "ApproveFailed",
|
|
4093
4136
|
inputs: []
|
|
4137
|
+
},
|
|
4138
|
+
{
|
|
4139
|
+
type: "error",
|
|
4140
|
+
name: "DuplicateConditionId",
|
|
4141
|
+
inputs: [
|
|
4142
|
+
{
|
|
4143
|
+
name: "conditionId",
|
|
4144
|
+
type: "bytes32",
|
|
4145
|
+
internalType: "bytes32"
|
|
4146
|
+
}
|
|
4147
|
+
]
|
|
4148
|
+
},
|
|
4149
|
+
{
|
|
4150
|
+
type: "error",
|
|
4151
|
+
name: "InvalidIndexSet",
|
|
4152
|
+
inputs: []
|
|
4153
|
+
},
|
|
4154
|
+
{
|
|
4155
|
+
type: "error",
|
|
4156
|
+
name: "UnregisteredConditionId",
|
|
4157
|
+
inputs: [
|
|
4158
|
+
{
|
|
4159
|
+
name: "conditionId",
|
|
4160
|
+
type: "bytes32",
|
|
4161
|
+
internalType: "bytes32"
|
|
4162
|
+
}
|
|
4163
|
+
]
|
|
4094
4164
|
}
|
|
4095
4165
|
];
|
|
4096
4166
|
|
|
@@ -5151,6 +5221,19 @@ var PythResolutionFacet_default = [
|
|
|
5151
5221
|
],
|
|
5152
5222
|
stateMutability: "payable"
|
|
5153
5223
|
},
|
|
5224
|
+
{
|
|
5225
|
+
type: "function",
|
|
5226
|
+
name: "getOpenMaxStaleness",
|
|
5227
|
+
inputs: [],
|
|
5228
|
+
outputs: [
|
|
5229
|
+
{
|
|
5230
|
+
name: "",
|
|
5231
|
+
type: "uint256",
|
|
5232
|
+
internalType: "uint256"
|
|
5233
|
+
}
|
|
5234
|
+
],
|
|
5235
|
+
stateMutability: "view"
|
|
5236
|
+
},
|
|
5154
5237
|
{
|
|
5155
5238
|
type: "function",
|
|
5156
5239
|
name: "getPythContract",
|
|
@@ -5182,19 +5265,6 @@ var PythResolutionFacet_default = [
|
|
|
5182
5265
|
outputs: [],
|
|
5183
5266
|
stateMutability: "payable"
|
|
5184
5267
|
},
|
|
5185
|
-
{
|
|
5186
|
-
type: "function",
|
|
5187
|
-
name: "setPythContract",
|
|
5188
|
-
inputs: [
|
|
5189
|
-
{
|
|
5190
|
-
name: "pythContract",
|
|
5191
|
-
type: "address",
|
|
5192
|
-
internalType: "address"
|
|
5193
|
-
}
|
|
5194
|
-
],
|
|
5195
|
-
outputs: [],
|
|
5196
|
-
stateMutability: "nonpayable"
|
|
5197
|
-
},
|
|
5198
5268
|
{
|
|
5199
5269
|
type: "function",
|
|
5200
5270
|
name: "setOpenMaxStaleness",
|
|
@@ -5210,16 +5280,16 @@ var PythResolutionFacet_default = [
|
|
|
5210
5280
|
},
|
|
5211
5281
|
{
|
|
5212
5282
|
type: "function",
|
|
5213
|
-
name: "
|
|
5214
|
-
inputs: [
|
|
5215
|
-
outputs: [
|
|
5283
|
+
name: "setPythContract",
|
|
5284
|
+
inputs: [
|
|
5216
5285
|
{
|
|
5217
|
-
name: "",
|
|
5218
|
-
type: "
|
|
5219
|
-
internalType: "
|
|
5286
|
+
name: "pythContract",
|
|
5287
|
+
type: "address",
|
|
5288
|
+
internalType: "address"
|
|
5220
5289
|
}
|
|
5221
5290
|
],
|
|
5222
|
-
|
|
5291
|
+
outputs: [],
|
|
5292
|
+
stateMutability: "nonpayable"
|
|
5223
5293
|
},
|
|
5224
5294
|
{
|
|
5225
5295
|
type: "event",
|
|
@@ -5344,6 +5414,19 @@ var PythResolutionFacet_default = [
|
|
|
5344
5414
|
],
|
|
5345
5415
|
anonymous: false
|
|
5346
5416
|
},
|
|
5417
|
+
{
|
|
5418
|
+
type: "event",
|
|
5419
|
+
name: "OpenMaxStalenessUpdated",
|
|
5420
|
+
inputs: [
|
|
5421
|
+
{
|
|
5422
|
+
name: "openMaxStaleness",
|
|
5423
|
+
type: "uint256",
|
|
5424
|
+
indexed: false,
|
|
5425
|
+
internalType: "uint256"
|
|
5426
|
+
}
|
|
5427
|
+
],
|
|
5428
|
+
anonymous: false
|
|
5429
|
+
},
|
|
5347
5430
|
{
|
|
5348
5431
|
type: "event",
|
|
5349
5432
|
name: "PriceMarketCreatedPyth",
|
|
@@ -5443,19 +5526,6 @@ var PythResolutionFacet_default = [
|
|
|
5443
5526
|
],
|
|
5444
5527
|
anonymous: false
|
|
5445
5528
|
},
|
|
5446
|
-
{
|
|
5447
|
-
type: "event",
|
|
5448
|
-
name: "OpenMaxStalenessUpdated",
|
|
5449
|
-
inputs: [
|
|
5450
|
-
{
|
|
5451
|
-
name: "openMaxStaleness",
|
|
5452
|
-
type: "uint256",
|
|
5453
|
-
indexed: false,
|
|
5454
|
-
internalType: "uint256"
|
|
5455
|
-
}
|
|
5456
|
-
],
|
|
5457
|
-
anonymous: false
|
|
5458
|
-
},
|
|
5459
5529
|
{
|
|
5460
5530
|
type: "event",
|
|
5461
5531
|
name: "WrappedCollateralRegistered",
|
|
@@ -5561,6 +5631,11 @@ var PythResolutionFacet_default = [
|
|
|
5561
5631
|
name: "MarketNotActive",
|
|
5562
5632
|
inputs: []
|
|
5563
5633
|
},
|
|
5634
|
+
{
|
|
5635
|
+
type: "error",
|
|
5636
|
+
name: "NoValidPriceUpdate",
|
|
5637
|
+
inputs: []
|
|
5638
|
+
},
|
|
5564
5639
|
{
|
|
5565
5640
|
type: "error",
|
|
5566
5641
|
name: "NotContractOwner",
|
|
@@ -5612,6 +5687,11 @@ var PythResolutionFacet_default = [
|
|
|
5612
5687
|
name: "RegistryAlreadyExists",
|
|
5613
5688
|
inputs: []
|
|
5614
5689
|
},
|
|
5690
|
+
{
|
|
5691
|
+
type: "error",
|
|
5692
|
+
name: "ResolutionWindowTooLarge",
|
|
5693
|
+
inputs: []
|
|
5694
|
+
},
|
|
5615
5695
|
{
|
|
5616
5696
|
type: "error",
|
|
5617
5697
|
name: "TooManyTags",
|
|
@@ -5943,6 +6023,16 @@ var BatchOrdersFacet_default = [
|
|
|
5943
6023
|
name: "InvalidTick",
|
|
5944
6024
|
inputs: []
|
|
5945
6025
|
},
|
|
6026
|
+
{
|
|
6027
|
+
type: "error",
|
|
6028
|
+
name: "MakerErc165CallFailed",
|
|
6029
|
+
inputs: []
|
|
6030
|
+
},
|
|
6031
|
+
{
|
|
6032
|
+
type: "error",
|
|
6033
|
+
name: "MakerNotErc1155Receiver",
|
|
6034
|
+
inputs: []
|
|
6035
|
+
},
|
|
5946
6036
|
{
|
|
5947
6037
|
type: "error",
|
|
5948
6038
|
name: "MarketNotActive",
|
|
@@ -6753,7 +6843,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6753
6843
|
*/
|
|
6754
6844
|
async createVenue(params) {
|
|
6755
6845
|
const wallet = this.walletClient;
|
|
6756
|
-
const
|
|
6846
|
+
const account = await this.getSignerAccount();
|
|
6757
6847
|
const { request } = await this.publicClient.simulateContract({
|
|
6758
6848
|
address: this.config.diamondAddress,
|
|
6759
6849
|
abi: VenueFacet_default,
|
|
@@ -6780,7 +6870,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6780
6870
|
*/
|
|
6781
6871
|
async updateFees(params) {
|
|
6782
6872
|
const wallet = this.walletClient;
|
|
6783
|
-
const
|
|
6873
|
+
const account = await this.getSignerAccount();
|
|
6784
6874
|
const { request } = await this.publicClient.simulateContract({
|
|
6785
6875
|
address: this.config.diamondAddress,
|
|
6786
6876
|
abi: VenueFacet_default,
|
|
@@ -6795,7 +6885,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6795
6885
|
*/
|
|
6796
6886
|
async setPaused(venueId, paused) {
|
|
6797
6887
|
const wallet = this.walletClient;
|
|
6798
|
-
const
|
|
6888
|
+
const account = await this.getSignerAccount();
|
|
6799
6889
|
const functionName = paused ? "pauseVenue" : "unpauseVenue";
|
|
6800
6890
|
const { request } = await this.publicClient.simulateContract({
|
|
6801
6891
|
address: this.config.diamondAddress,
|
|
@@ -6822,7 +6912,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6822
6912
|
*/
|
|
6823
6913
|
async updateVenue(params) {
|
|
6824
6914
|
const wallet = this.walletClient;
|
|
6825
|
-
const
|
|
6915
|
+
const account = await this.getSignerAccount();
|
|
6826
6916
|
const { request } = await this.publicClient.simulateContract({
|
|
6827
6917
|
address: this.config.diamondAddress,
|
|
6828
6918
|
abi: VenueFacet_default,
|
|
@@ -6844,7 +6934,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6844
6934
|
*/
|
|
6845
6935
|
async updateOracleParams(params) {
|
|
6846
6936
|
const wallet = this.walletClient;
|
|
6847
|
-
const
|
|
6937
|
+
const account = await this.getSignerAccount();
|
|
6848
6938
|
const { request } = await this.publicClient.simulateContract({
|
|
6849
6939
|
address: this.config.diamondAddress,
|
|
6850
6940
|
abi: VenueFacet_default,
|
|
@@ -6893,7 +6983,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6893
6983
|
*/
|
|
6894
6984
|
async setProtocolFeeBps(bps) {
|
|
6895
6985
|
const wallet = this.walletClient;
|
|
6896
|
-
const
|
|
6986
|
+
const account = await this.getSignerAccount();
|
|
6897
6987
|
const { request } = await this.publicClient.simulateContract({
|
|
6898
6988
|
address: this.config.diamondAddress,
|
|
6899
6989
|
abi: ProtocolFacet_default,
|
|
@@ -7154,7 +7244,8 @@ var MarketModule = class extends BaseModule {
|
|
|
7154
7244
|
*/
|
|
7155
7245
|
async createMarket(params) {
|
|
7156
7246
|
const wallet = this.walletClient;
|
|
7157
|
-
const
|
|
7247
|
+
const account = await this.getSignerAccount();
|
|
7248
|
+
const accountAddress = await this.getSignerAddress();
|
|
7158
7249
|
const venue = await this.publicClient.readContract({
|
|
7159
7250
|
address: this.config.diamondAddress,
|
|
7160
7251
|
abi: VenueFacet_default,
|
|
@@ -7169,7 +7260,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7169
7260
|
address: params.collateralToken,
|
|
7170
7261
|
abi: erc20Abi,
|
|
7171
7262
|
functionName: "allowance",
|
|
7172
|
-
args: [
|
|
7263
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
7173
7264
|
});
|
|
7174
7265
|
if (allowance < totalRequired) {
|
|
7175
7266
|
throw new Error(
|
|
@@ -7180,7 +7271,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7180
7271
|
address: params.collateralToken,
|
|
7181
7272
|
abi: erc20Abi,
|
|
7182
7273
|
functionName: "balanceOf",
|
|
7183
|
-
args: [
|
|
7274
|
+
args: [accountAddress]
|
|
7184
7275
|
});
|
|
7185
7276
|
if (balance < totalRequired) {
|
|
7186
7277
|
throw new Error(
|
|
@@ -7423,7 +7514,8 @@ var MarketModule = class extends BaseModule {
|
|
|
7423
7514
|
*/
|
|
7424
7515
|
async createMarketGroup(params) {
|
|
7425
7516
|
const wallet = this.walletClient;
|
|
7426
|
-
const
|
|
7517
|
+
const account = await this.getSignerAccount();
|
|
7518
|
+
const accountAddress = await this.getSignerAddress();
|
|
7427
7519
|
const venue = await this.publicClient.readContract({
|
|
7428
7520
|
address: this.config.diamondAddress,
|
|
7429
7521
|
abi: VenueFacet_default,
|
|
@@ -7438,7 +7530,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7438
7530
|
address: params.collateralToken,
|
|
7439
7531
|
abi: erc20Abi,
|
|
7440
7532
|
functionName: "allowance",
|
|
7441
|
-
args: [
|
|
7533
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
7442
7534
|
});
|
|
7443
7535
|
if (allowance < totalRequired) {
|
|
7444
7536
|
throw new Error(
|
|
@@ -7449,7 +7541,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7449
7541
|
address: params.collateralToken,
|
|
7450
7542
|
abi: erc20Abi,
|
|
7451
7543
|
functionName: "balanceOf",
|
|
7452
|
-
args: [
|
|
7544
|
+
args: [accountAddress]
|
|
7453
7545
|
});
|
|
7454
7546
|
if (balance < totalRequired) {
|
|
7455
7547
|
throw new Error(
|
|
@@ -7486,7 +7578,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7486
7578
|
*/
|
|
7487
7579
|
async addMarketToGroup(params) {
|
|
7488
7580
|
const wallet = this.walletClient;
|
|
7489
|
-
const
|
|
7581
|
+
const account = await this.getSignerAccount();
|
|
7490
7582
|
const { request } = await this.publicClient.simulateContract({
|
|
7491
7583
|
address: this.config.diamondAddress,
|
|
7492
7584
|
abi: MarketsFacet_default,
|
|
@@ -7501,7 +7593,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7501
7593
|
*/
|
|
7502
7594
|
async addPlaceholderMarkets(params) {
|
|
7503
7595
|
const wallet = this.walletClient;
|
|
7504
|
-
const
|
|
7596
|
+
const account = await this.getSignerAccount();
|
|
7505
7597
|
if (params.count < 1n || params.count > 50n) {
|
|
7506
7598
|
throw new Error("Count must be between 1 and 50");
|
|
7507
7599
|
}
|
|
@@ -7519,7 +7611,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7519
7611
|
*/
|
|
7520
7612
|
async activatePlaceholder(params) {
|
|
7521
7613
|
const wallet = this.walletClient;
|
|
7522
|
-
const
|
|
7614
|
+
const account = await this.getSignerAccount();
|
|
7523
7615
|
const { request } = await this.publicClient.simulateContract({
|
|
7524
7616
|
address: this.config.diamondAddress,
|
|
7525
7617
|
abi: MarketsFacet_default,
|
|
@@ -7539,7 +7631,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7539
7631
|
*/
|
|
7540
7632
|
async activateMarketGroup(params) {
|
|
7541
7633
|
const wallet = this.walletClient;
|
|
7542
|
-
const
|
|
7634
|
+
const account = await this.getSignerAccount();
|
|
7543
7635
|
const { request } = await this.publicClient.simulateContract({
|
|
7544
7636
|
address: this.config.diamondAddress,
|
|
7545
7637
|
abi: MarketGroupFacet_default,
|
|
@@ -7556,7 +7648,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7556
7648
|
*/
|
|
7557
7649
|
async convertPositions(params) {
|
|
7558
7650
|
const wallet = this.walletClient;
|
|
7559
|
-
const
|
|
7651
|
+
const account = await this.getSignerAccount();
|
|
7560
7652
|
const isApproved = await this.publicClient.readContract({
|
|
7561
7653
|
address: this.config.conditionalTokensAddress,
|
|
7562
7654
|
abi: ConditionalTokens_default,
|
|
@@ -7712,7 +7804,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7712
7804
|
*/
|
|
7713
7805
|
async pauseMarket(marketId) {
|
|
7714
7806
|
const wallet = this.walletClient;
|
|
7715
|
-
const
|
|
7807
|
+
const account = await this.getSignerAccount();
|
|
7716
7808
|
const { request } = await this.publicClient.simulateContract({
|
|
7717
7809
|
address: this.config.diamondAddress,
|
|
7718
7810
|
abi: MarketsFacet_default,
|
|
@@ -7728,7 +7820,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7728
7820
|
*/
|
|
7729
7821
|
async unpauseMarket(marketId) {
|
|
7730
7822
|
const wallet = this.walletClient;
|
|
7731
|
-
const
|
|
7823
|
+
const account = await this.getSignerAccount();
|
|
7732
7824
|
const { request } = await this.publicClient.simulateContract({
|
|
7733
7825
|
address: this.config.diamondAddress,
|
|
7734
7826
|
abi: MarketsFacet_default,
|
|
@@ -7747,7 +7839,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7747
7839
|
*/
|
|
7748
7840
|
async updateMarketTags(params) {
|
|
7749
7841
|
const wallet = this.walletClient;
|
|
7750
|
-
const
|
|
7842
|
+
const account = await this.getSignerAccount();
|
|
7751
7843
|
const encodedTags = params.tags.map(
|
|
7752
7844
|
(t) => stringToHex(t, { size: 32 })
|
|
7753
7845
|
);
|
|
@@ -7766,7 +7858,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7766
7858
|
*/
|
|
7767
7859
|
async updateMarketGroupTags(params) {
|
|
7768
7860
|
const wallet = this.walletClient;
|
|
7769
|
-
const
|
|
7861
|
+
const account = await this.getSignerAccount();
|
|
7770
7862
|
const encodedTags = params.tags.map(
|
|
7771
7863
|
(t) => stringToHex(t, { size: 32 })
|
|
7772
7864
|
);
|
|
@@ -7788,7 +7880,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7788
7880
|
*/
|
|
7789
7881
|
async updateMarketMetadata(params) {
|
|
7790
7882
|
const wallet = this.walletClient;
|
|
7791
|
-
const
|
|
7883
|
+
const account = await this.getSignerAccount();
|
|
7792
7884
|
const { request } = await this.publicClient.simulateContract({
|
|
7793
7885
|
address: this.config.diamondAddress,
|
|
7794
7886
|
abi: MetadataFacet_default,
|
|
@@ -7804,7 +7896,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7804
7896
|
*/
|
|
7805
7897
|
async updateMarketGroupMetadata(params) {
|
|
7806
7898
|
const wallet = this.walletClient;
|
|
7807
|
-
const
|
|
7899
|
+
const account = await this.getSignerAccount();
|
|
7808
7900
|
const { request } = await this.publicClient.simulateContract({
|
|
7809
7901
|
address: this.config.diamondAddress,
|
|
7810
7902
|
abi: MetadataFacet_default,
|
|
@@ -7824,7 +7916,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7824
7916
|
*/
|
|
7825
7917
|
async placeOrder(params) {
|
|
7826
7918
|
const wallet = this.walletClient;
|
|
7827
|
-
const
|
|
7919
|
+
const account = await this.getSignerAccount();
|
|
7828
7920
|
const { request } = await this.publicClient.simulateContract({
|
|
7829
7921
|
address: this.config.diamondAddress,
|
|
7830
7922
|
abi: LimitOrdersFacet_default,
|
|
@@ -7876,7 +7968,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7876
7968
|
*/
|
|
7877
7969
|
async cancelOrder(orderId) {
|
|
7878
7970
|
const wallet = this.walletClient;
|
|
7879
|
-
const
|
|
7971
|
+
const account = await this.getSignerAccount();
|
|
7880
7972
|
const { request } = await this.publicClient.simulateContract({
|
|
7881
7973
|
address: this.config.diamondAddress,
|
|
7882
7974
|
abi: LimitOrdersFacet_default,
|
|
@@ -7895,7 +7987,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7895
7987
|
*/
|
|
7896
7988
|
async cancelOrdersOnResolvedMarket(marketId, orderIds) {
|
|
7897
7989
|
const wallet = this.walletClient;
|
|
7898
|
-
const
|
|
7990
|
+
const account = await this.getSignerAccount();
|
|
7899
7991
|
const { request } = await this.publicClient.simulateContract({
|
|
7900
7992
|
address: this.config.diamondAddress,
|
|
7901
7993
|
abi: LimitOrdersFacet_default,
|
|
@@ -7916,7 +8008,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7916
8008
|
*/
|
|
7917
8009
|
async placeMarketOrder(params) {
|
|
7918
8010
|
const wallet = this.walletClient;
|
|
7919
|
-
const
|
|
8011
|
+
const account = await this.getSignerAccount();
|
|
7920
8012
|
const { request } = await this.publicClient.simulateContract({
|
|
7921
8013
|
address: this.config.diamondAddress,
|
|
7922
8014
|
abi: MarketOrdersFacet_default,
|
|
@@ -7962,8 +8054,8 @@ var TradeModule = class extends BaseModule {
|
|
|
7962
8054
|
* Preview a market order (simulate transaction)
|
|
7963
8055
|
*/
|
|
7964
8056
|
async previewMarketOrder(params) {
|
|
7965
|
-
|
|
7966
|
-
const
|
|
8057
|
+
this.walletClient;
|
|
8058
|
+
const account = await this.getSignerAccount();
|
|
7967
8059
|
const { result } = await this.publicClient.simulateContract({
|
|
7968
8060
|
address: this.config.diamondAddress,
|
|
7969
8061
|
abi: MarketOrdersFacet_default,
|
|
@@ -7983,8 +8075,8 @@ var TradeModule = class extends BaseModule {
|
|
|
7983
8075
|
* Preview placing an order (simulate transaction to check for reverts)
|
|
7984
8076
|
*/
|
|
7985
8077
|
async previewPlaceOrder(params) {
|
|
7986
|
-
|
|
7987
|
-
const
|
|
8078
|
+
this.walletClient;
|
|
8079
|
+
const account = await this.getSignerAccount();
|
|
7988
8080
|
const { result } = await this.publicClient.simulateContract({
|
|
7989
8081
|
address: this.config.diamondAddress,
|
|
7990
8082
|
abi: LimitOrdersFacet_default,
|
|
@@ -8012,7 +8104,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8012
8104
|
*/
|
|
8013
8105
|
async placeMarketSell(params) {
|
|
8014
8106
|
const wallet = this.walletClient;
|
|
8015
|
-
const
|
|
8107
|
+
const account = await this.getSignerAccount();
|
|
8016
8108
|
const { request } = await this.publicClient.simulateContract({
|
|
8017
8109
|
address: this.config.diamondAddress,
|
|
8018
8110
|
abi: MarketOrdersFacet_default,
|
|
@@ -8058,8 +8150,8 @@ var TradeModule = class extends BaseModule {
|
|
|
8058
8150
|
* Preview a market sell order (simulate transaction)
|
|
8059
8151
|
*/
|
|
8060
8152
|
async previewMarketSell(params) {
|
|
8061
|
-
|
|
8062
|
-
const
|
|
8153
|
+
this.walletClient;
|
|
8154
|
+
const account = await this.getSignerAccount();
|
|
8063
8155
|
const { result } = await this.publicClient.simulateContract({
|
|
8064
8156
|
address: this.config.diamondAddress,
|
|
8065
8157
|
abi: MarketOrdersFacet_default,
|
|
@@ -8118,7 +8210,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8118
8210
|
*/
|
|
8119
8211
|
async matchOrders(params) {
|
|
8120
8212
|
const wallet = this.walletClient;
|
|
8121
|
-
const
|
|
8213
|
+
const account = await this.getSignerAccount();
|
|
8122
8214
|
const maxSteps = params.maxSteps || 10n;
|
|
8123
8215
|
const { request } = await this.publicClient.simulateContract({
|
|
8124
8216
|
address: this.config.diamondAddress,
|
|
@@ -8218,7 +8310,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8218
8310
|
*/
|
|
8219
8311
|
async splitPosition(marketId, amount) {
|
|
8220
8312
|
const wallet = this.walletClient;
|
|
8221
|
-
const
|
|
8313
|
+
const account = await this.getSignerAccount();
|
|
8222
8314
|
const { request } = await this.publicClient.simulateContract({
|
|
8223
8315
|
address: this.config.diamondAddress,
|
|
8224
8316
|
abi: VaultFacet_default,
|
|
@@ -8236,7 +8328,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8236
8328
|
*/
|
|
8237
8329
|
async mergePositions(marketId, amount) {
|
|
8238
8330
|
const wallet = this.walletClient;
|
|
8239
|
-
const
|
|
8331
|
+
const account = await this.getSignerAccount();
|
|
8240
8332
|
const { request } = await this.publicClient.simulateContract({
|
|
8241
8333
|
address: this.config.diamondAddress,
|
|
8242
8334
|
abi: VaultFacet_default,
|
|
@@ -8257,7 +8349,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8257
8349
|
*/
|
|
8258
8350
|
async batchPlaceOrders(params) {
|
|
8259
8351
|
const wallet = this.walletClient;
|
|
8260
|
-
const
|
|
8352
|
+
const account = await this.getSignerAccount();
|
|
8261
8353
|
const { request } = await this.publicClient.simulateContract({
|
|
8262
8354
|
address: this.config.diamondAddress,
|
|
8263
8355
|
abi: BatchOrdersFacet_default,
|
|
@@ -8298,7 +8390,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8298
8390
|
*/
|
|
8299
8391
|
async batchCancelOrders(orderIds) {
|
|
8300
8392
|
const wallet = this.walletClient;
|
|
8301
|
-
const
|
|
8393
|
+
const account = await this.getSignerAccount();
|
|
8302
8394
|
const { request } = await this.publicClient.simulateContract({
|
|
8303
8395
|
address: this.config.diamondAddress,
|
|
8304
8396
|
abi: BatchOrdersFacet_default,
|
|
@@ -8317,7 +8409,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8317
8409
|
*/
|
|
8318
8410
|
async cancelAndReplace(params) {
|
|
8319
8411
|
const wallet = this.walletClient;
|
|
8320
|
-
const
|
|
8412
|
+
const account = await this.getSignerAccount();
|
|
8321
8413
|
const { request } = await this.publicClient.simulateContract({
|
|
8322
8414
|
address: this.config.diamondAddress,
|
|
8323
8415
|
abi: BatchOrdersFacet_default,
|
|
@@ -9842,7 +9934,7 @@ var TokenModule = class extends BaseModule {
|
|
|
9842
9934
|
*/
|
|
9843
9935
|
async mint(token, to, amount) {
|
|
9844
9936
|
const wallet = this.walletClient;
|
|
9845
|
-
const
|
|
9937
|
+
const account = await this.getSignerAccount();
|
|
9846
9938
|
const { request } = await this.publicClient.simulateContract({
|
|
9847
9939
|
address: token,
|
|
9848
9940
|
abi: ERC20_default,
|
|
@@ -9857,7 +9949,7 @@ var TokenModule = class extends BaseModule {
|
|
|
9857
9949
|
*/
|
|
9858
9950
|
async approve(token, spender, amount) {
|
|
9859
9951
|
const wallet = this.walletClient;
|
|
9860
|
-
const
|
|
9952
|
+
const account = await this.getSignerAccount();
|
|
9861
9953
|
const { request } = await this.publicClient.simulateContract({
|
|
9862
9954
|
address: token,
|
|
9863
9955
|
abi: ERC20_default,
|
|
@@ -9941,7 +10033,8 @@ var UmaModule = class extends BaseModule {
|
|
|
9941
10033
|
*/
|
|
9942
10034
|
async assertMarketOutcome(params) {
|
|
9943
10035
|
const wallet = this.walletClient;
|
|
9944
|
-
const
|
|
10036
|
+
const account = await this.getSignerAccount();
|
|
10037
|
+
const accountAddress = await this.getSignerAddress();
|
|
9945
10038
|
const autoApprove = params.autoApprove ?? true;
|
|
9946
10039
|
const registryData = await this.publicClient.readContract({
|
|
9947
10040
|
address: this.config.diamondAddress,
|
|
@@ -9956,7 +10049,7 @@ var UmaModule = class extends BaseModule {
|
|
|
9956
10049
|
address: currency,
|
|
9957
10050
|
abi: erc20Abi,
|
|
9958
10051
|
functionName: "allowance",
|
|
9959
|
-
args: [
|
|
10052
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
9960
10053
|
});
|
|
9961
10054
|
if (currentAllowance < bondAmount && autoApprove) {
|
|
9962
10055
|
const approveHash = await wallet.writeContract({
|
|
@@ -9976,7 +10069,7 @@ var UmaModule = class extends BaseModule {
|
|
|
9976
10069
|
address: currency,
|
|
9977
10070
|
abi: erc20Abi,
|
|
9978
10071
|
functionName: "allowance",
|
|
9979
|
-
args: [
|
|
10072
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
9980
10073
|
});
|
|
9981
10074
|
if (newAllowance < bondAmount) {
|
|
9982
10075
|
throw new Error(
|
|
@@ -9992,7 +10085,7 @@ var UmaModule = class extends BaseModule {
|
|
|
9992
10085
|
address: currency,
|
|
9993
10086
|
abi: erc20Abi,
|
|
9994
10087
|
functionName: "balanceOf",
|
|
9995
|
-
args: [
|
|
10088
|
+
args: [accountAddress]
|
|
9996
10089
|
});
|
|
9997
10090
|
if (balance < bondAmount) {
|
|
9998
10091
|
throw new Error(
|
|
@@ -10040,7 +10133,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10040
10133
|
*/
|
|
10041
10134
|
async settleAssertion(assertionId) {
|
|
10042
10135
|
const wallet = this.walletClient;
|
|
10043
|
-
const
|
|
10136
|
+
const account = await this.getSignerAccount();
|
|
10044
10137
|
const { request } = await this.publicClient.simulateContract({
|
|
10045
10138
|
address: this.config.diamondAddress,
|
|
10046
10139
|
abi: ResolutionFacet_default,
|
|
@@ -10055,7 +10148,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10055
10148
|
*/
|
|
10056
10149
|
async reportResolution(params) {
|
|
10057
10150
|
const wallet = this.walletClient;
|
|
10058
|
-
const
|
|
10151
|
+
const account = await this.getSignerAccount();
|
|
10059
10152
|
const { request } = await this.publicClient.simulateContract({
|
|
10060
10153
|
address: this.config.diamondAddress,
|
|
10061
10154
|
abi: ResolutionFacet_default,
|
|
@@ -10122,7 +10215,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10122
10215
|
*/
|
|
10123
10216
|
async redeemWinnings(marketId) {
|
|
10124
10217
|
const wallet = this.walletClient;
|
|
10125
|
-
const
|
|
10218
|
+
const account = await this.getSignerAccount();
|
|
10126
10219
|
const oracleData = await this.publicClient.readContract({
|
|
10127
10220
|
address: this.config.diamondAddress,
|
|
10128
10221
|
abi: MarketsFacet_default,
|
|
@@ -10369,7 +10462,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10369
10462
|
*/
|
|
10370
10463
|
async deployWhitelist() {
|
|
10371
10464
|
const wallet = this.walletClient;
|
|
10372
|
-
const
|
|
10465
|
+
const account = await this.getSignerAccount();
|
|
10373
10466
|
const { request } = await this.publicClient.simulateContract({
|
|
10374
10467
|
address: this.config.diamondAddress,
|
|
10375
10468
|
abi: AccessControlFacet_default,
|
|
@@ -10387,7 +10480,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10387
10480
|
*/
|
|
10388
10481
|
async deployNFTGated(params) {
|
|
10389
10482
|
const wallet = this.walletClient;
|
|
10390
|
-
const
|
|
10483
|
+
const account = await this.getSignerAccount();
|
|
10391
10484
|
const { request } = await this.publicClient.simulateContract({
|
|
10392
10485
|
address: this.config.diamondAddress,
|
|
10393
10486
|
abi: AccessControlFacet_default,
|
|
@@ -10404,7 +10497,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10404
10497
|
*/
|
|
10405
10498
|
async deployTokenGated(params) {
|
|
10406
10499
|
const wallet = this.walletClient;
|
|
10407
|
-
const
|
|
10500
|
+
const account = await this.getSignerAccount();
|
|
10408
10501
|
const { request } = await this.publicClient.simulateContract({
|
|
10409
10502
|
address: this.config.diamondAddress,
|
|
10410
10503
|
abi: AccessControlFacet_default,
|
|
@@ -10420,7 +10513,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10420
10513
|
*/
|
|
10421
10514
|
async setMarketTradingAC(params) {
|
|
10422
10515
|
const wallet = this.walletClient;
|
|
10423
|
-
const
|
|
10516
|
+
const account = await this.getSignerAccount();
|
|
10424
10517
|
const { request } = await this.publicClient.simulateContract({
|
|
10425
10518
|
address: this.config.diamondAddress,
|
|
10426
10519
|
abi: AccessControlFacet_default,
|
|
@@ -10435,7 +10528,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10435
10528
|
*/
|
|
10436
10529
|
async removeMarketTradingAC(params) {
|
|
10437
10530
|
const wallet = this.walletClient;
|
|
10438
|
-
const
|
|
10531
|
+
const account = await this.getSignerAccount();
|
|
10439
10532
|
const { request } = await this.publicClient.simulateContract({
|
|
10440
10533
|
address: this.config.diamondAddress,
|
|
10441
10534
|
abi: AccessControlFacet_default,
|
|
@@ -10474,7 +10567,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10474
10567
|
*/
|
|
10475
10568
|
async addToWhitelist(params) {
|
|
10476
10569
|
const wallet = this.walletClient;
|
|
10477
|
-
const
|
|
10570
|
+
const account = await this.getSignerAccount();
|
|
10478
10571
|
const { request } = await this.publicClient.simulateContract({
|
|
10479
10572
|
address: params.acContract,
|
|
10480
10573
|
abi: WhitelistAccessControl_default,
|
|
@@ -10489,7 +10582,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10489
10582
|
*/
|
|
10490
10583
|
async removeFromWhitelist(params) {
|
|
10491
10584
|
const wallet = this.walletClient;
|
|
10492
|
-
const
|
|
10585
|
+
const account = await this.getSignerAccount();
|
|
10493
10586
|
const { request } = await this.publicClient.simulateContract({
|
|
10494
10587
|
address: params.acContract,
|
|
10495
10588
|
abi: WhitelistAccessControl_default,
|
|
@@ -10551,10 +10644,10 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10551
10644
|
*/
|
|
10552
10645
|
async createPyth(params) {
|
|
10553
10646
|
const wallet = this.walletClient;
|
|
10554
|
-
const
|
|
10647
|
+
const account = await this.getSignerAccount();
|
|
10555
10648
|
const outcomes = params.outcomes ?? ["Up", "Down"];
|
|
10556
10649
|
const isStrikeMarket = params.strikePrice && params.strikePrice > BigInt(0);
|
|
10557
|
-
const { encodedTags, ancillaryData } = await this._prepareCreationCommon(params,
|
|
10650
|
+
const { encodedTags, ancillaryData } = await this._prepareCreationCommon(params, await this.getSignerAddress());
|
|
10558
10651
|
if (!isValidTickSize(params.tickSize)) {
|
|
10559
10652
|
throw new Error("Invalid tickSize: must be 1e15 (0.1%) or 1e16 (1%)");
|
|
10560
10653
|
}
|
|
@@ -10597,7 +10690,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10597
10690
|
*/
|
|
10598
10691
|
async resolvePyth(marketId) {
|
|
10599
10692
|
const wallet = this.walletClient;
|
|
10600
|
-
const
|
|
10693
|
+
const account = await this.getSignerAccount();
|
|
10601
10694
|
const pm = await this.get(marketId);
|
|
10602
10695
|
if (pm.resolved) {
|
|
10603
10696
|
throw new Error("Price market already resolved");
|
|
@@ -10690,7 +10783,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10690
10783
|
*/
|
|
10691
10784
|
async setPythContract(pythContract) {
|
|
10692
10785
|
const wallet = this.walletClient;
|
|
10693
|
-
const
|
|
10786
|
+
const account = await this.getSignerAccount();
|
|
10694
10787
|
const { request } = await this.publicClient.simulateContract({
|
|
10695
10788
|
address: this.config.diamondAddress,
|
|
10696
10789
|
abi: PythResolutionFacet_default,
|
|
@@ -10720,7 +10813,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10720
10813
|
*/
|
|
10721
10814
|
async setOpenMaxStaleness(openMaxStaleness) {
|
|
10722
10815
|
const wallet = this.walletClient;
|
|
10723
|
-
const
|
|
10816
|
+
const account = await this.getSignerAccount();
|
|
10724
10817
|
const { request } = await this.publicClient.simulateContract({
|
|
10725
10818
|
address: this.config.diamondAddress,
|
|
10726
10819
|
abi: PythResolutionFacet_default,
|