@oddmaki-protocol/sdk 0.5.0 → 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 +44 -42
- package/dist/index.d.ts +44 -42
- package/dist/index.js +77 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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
|
|
@@ -6832,7 +6845,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6832
6845
|
*/
|
|
6833
6846
|
async createVenue(params) {
|
|
6834
6847
|
const wallet = this.walletClient;
|
|
6835
|
-
const
|
|
6848
|
+
const account = await this.getSignerAccount();
|
|
6836
6849
|
const { request } = await this.publicClient.simulateContract({
|
|
6837
6850
|
address: this.config.diamondAddress,
|
|
6838
6851
|
abi: VenueFacet_default,
|
|
@@ -6859,7 +6872,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6859
6872
|
*/
|
|
6860
6873
|
async updateFees(params) {
|
|
6861
6874
|
const wallet = this.walletClient;
|
|
6862
|
-
const
|
|
6875
|
+
const account = await this.getSignerAccount();
|
|
6863
6876
|
const { request } = await this.publicClient.simulateContract({
|
|
6864
6877
|
address: this.config.diamondAddress,
|
|
6865
6878
|
abi: VenueFacet_default,
|
|
@@ -6874,7 +6887,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6874
6887
|
*/
|
|
6875
6888
|
async setPaused(venueId, paused) {
|
|
6876
6889
|
const wallet = this.walletClient;
|
|
6877
|
-
const
|
|
6890
|
+
const account = await this.getSignerAccount();
|
|
6878
6891
|
const functionName = paused ? "pauseVenue" : "unpauseVenue";
|
|
6879
6892
|
const { request } = await this.publicClient.simulateContract({
|
|
6880
6893
|
address: this.config.diamondAddress,
|
|
@@ -6901,7 +6914,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6901
6914
|
*/
|
|
6902
6915
|
async updateVenue(params) {
|
|
6903
6916
|
const wallet = this.walletClient;
|
|
6904
|
-
const
|
|
6917
|
+
const account = await this.getSignerAccount();
|
|
6905
6918
|
const { request } = await this.publicClient.simulateContract({
|
|
6906
6919
|
address: this.config.diamondAddress,
|
|
6907
6920
|
abi: VenueFacet_default,
|
|
@@ -6923,7 +6936,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6923
6936
|
*/
|
|
6924
6937
|
async updateOracleParams(params) {
|
|
6925
6938
|
const wallet = this.walletClient;
|
|
6926
|
-
const
|
|
6939
|
+
const account = await this.getSignerAccount();
|
|
6927
6940
|
const { request } = await this.publicClient.simulateContract({
|
|
6928
6941
|
address: this.config.diamondAddress,
|
|
6929
6942
|
abi: VenueFacet_default,
|
|
@@ -6972,7 +6985,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6972
6985
|
*/
|
|
6973
6986
|
async setProtocolFeeBps(bps) {
|
|
6974
6987
|
const wallet = this.walletClient;
|
|
6975
|
-
const
|
|
6988
|
+
const account = await this.getSignerAccount();
|
|
6976
6989
|
const { request } = await this.publicClient.simulateContract({
|
|
6977
6990
|
address: this.config.diamondAddress,
|
|
6978
6991
|
abi: ProtocolFacet_default,
|
|
@@ -7233,7 +7246,8 @@ var MarketModule = class extends BaseModule {
|
|
|
7233
7246
|
*/
|
|
7234
7247
|
async createMarket(params) {
|
|
7235
7248
|
const wallet = this.walletClient;
|
|
7236
|
-
const
|
|
7249
|
+
const account = await this.getSignerAccount();
|
|
7250
|
+
const accountAddress = await this.getSignerAddress();
|
|
7237
7251
|
const venue = await this.publicClient.readContract({
|
|
7238
7252
|
address: this.config.diamondAddress,
|
|
7239
7253
|
abi: VenueFacet_default,
|
|
@@ -7248,7 +7262,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7248
7262
|
address: params.collateralToken,
|
|
7249
7263
|
abi: viem.erc20Abi,
|
|
7250
7264
|
functionName: "allowance",
|
|
7251
|
-
args: [
|
|
7265
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
7252
7266
|
});
|
|
7253
7267
|
if (allowance < totalRequired) {
|
|
7254
7268
|
throw new Error(
|
|
@@ -7259,7 +7273,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7259
7273
|
address: params.collateralToken,
|
|
7260
7274
|
abi: viem.erc20Abi,
|
|
7261
7275
|
functionName: "balanceOf",
|
|
7262
|
-
args: [
|
|
7276
|
+
args: [accountAddress]
|
|
7263
7277
|
});
|
|
7264
7278
|
if (balance < totalRequired) {
|
|
7265
7279
|
throw new Error(
|
|
@@ -7502,7 +7516,8 @@ var MarketModule = class extends BaseModule {
|
|
|
7502
7516
|
*/
|
|
7503
7517
|
async createMarketGroup(params) {
|
|
7504
7518
|
const wallet = this.walletClient;
|
|
7505
|
-
const
|
|
7519
|
+
const account = await this.getSignerAccount();
|
|
7520
|
+
const accountAddress = await this.getSignerAddress();
|
|
7506
7521
|
const venue = await this.publicClient.readContract({
|
|
7507
7522
|
address: this.config.diamondAddress,
|
|
7508
7523
|
abi: VenueFacet_default,
|
|
@@ -7517,7 +7532,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7517
7532
|
address: params.collateralToken,
|
|
7518
7533
|
abi: viem.erc20Abi,
|
|
7519
7534
|
functionName: "allowance",
|
|
7520
|
-
args: [
|
|
7535
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
7521
7536
|
});
|
|
7522
7537
|
if (allowance < totalRequired) {
|
|
7523
7538
|
throw new Error(
|
|
@@ -7528,7 +7543,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7528
7543
|
address: params.collateralToken,
|
|
7529
7544
|
abi: viem.erc20Abi,
|
|
7530
7545
|
functionName: "balanceOf",
|
|
7531
|
-
args: [
|
|
7546
|
+
args: [accountAddress]
|
|
7532
7547
|
});
|
|
7533
7548
|
if (balance < totalRequired) {
|
|
7534
7549
|
throw new Error(
|
|
@@ -7565,7 +7580,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7565
7580
|
*/
|
|
7566
7581
|
async addMarketToGroup(params) {
|
|
7567
7582
|
const wallet = this.walletClient;
|
|
7568
|
-
const
|
|
7583
|
+
const account = await this.getSignerAccount();
|
|
7569
7584
|
const { request } = await this.publicClient.simulateContract({
|
|
7570
7585
|
address: this.config.diamondAddress,
|
|
7571
7586
|
abi: MarketsFacet_default,
|
|
@@ -7580,7 +7595,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7580
7595
|
*/
|
|
7581
7596
|
async addPlaceholderMarkets(params) {
|
|
7582
7597
|
const wallet = this.walletClient;
|
|
7583
|
-
const
|
|
7598
|
+
const account = await this.getSignerAccount();
|
|
7584
7599
|
if (params.count < 1n || params.count > 50n) {
|
|
7585
7600
|
throw new Error("Count must be between 1 and 50");
|
|
7586
7601
|
}
|
|
@@ -7598,7 +7613,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7598
7613
|
*/
|
|
7599
7614
|
async activatePlaceholder(params) {
|
|
7600
7615
|
const wallet = this.walletClient;
|
|
7601
|
-
const
|
|
7616
|
+
const account = await this.getSignerAccount();
|
|
7602
7617
|
const { request } = await this.publicClient.simulateContract({
|
|
7603
7618
|
address: this.config.diamondAddress,
|
|
7604
7619
|
abi: MarketsFacet_default,
|
|
@@ -7618,7 +7633,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7618
7633
|
*/
|
|
7619
7634
|
async activateMarketGroup(params) {
|
|
7620
7635
|
const wallet = this.walletClient;
|
|
7621
|
-
const
|
|
7636
|
+
const account = await this.getSignerAccount();
|
|
7622
7637
|
const { request } = await this.publicClient.simulateContract({
|
|
7623
7638
|
address: this.config.diamondAddress,
|
|
7624
7639
|
abi: MarketGroupFacet_default,
|
|
@@ -7635,7 +7650,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7635
7650
|
*/
|
|
7636
7651
|
async convertPositions(params) {
|
|
7637
7652
|
const wallet = this.walletClient;
|
|
7638
|
-
const
|
|
7653
|
+
const account = await this.getSignerAccount();
|
|
7639
7654
|
const isApproved = await this.publicClient.readContract({
|
|
7640
7655
|
address: this.config.conditionalTokensAddress,
|
|
7641
7656
|
abi: ConditionalTokens_default,
|
|
@@ -7791,7 +7806,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7791
7806
|
*/
|
|
7792
7807
|
async pauseMarket(marketId) {
|
|
7793
7808
|
const wallet = this.walletClient;
|
|
7794
|
-
const
|
|
7809
|
+
const account = await this.getSignerAccount();
|
|
7795
7810
|
const { request } = await this.publicClient.simulateContract({
|
|
7796
7811
|
address: this.config.diamondAddress,
|
|
7797
7812
|
abi: MarketsFacet_default,
|
|
@@ -7807,7 +7822,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7807
7822
|
*/
|
|
7808
7823
|
async unpauseMarket(marketId) {
|
|
7809
7824
|
const wallet = this.walletClient;
|
|
7810
|
-
const
|
|
7825
|
+
const account = await this.getSignerAccount();
|
|
7811
7826
|
const { request } = await this.publicClient.simulateContract({
|
|
7812
7827
|
address: this.config.diamondAddress,
|
|
7813
7828
|
abi: MarketsFacet_default,
|
|
@@ -7826,7 +7841,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7826
7841
|
*/
|
|
7827
7842
|
async updateMarketTags(params) {
|
|
7828
7843
|
const wallet = this.walletClient;
|
|
7829
|
-
const
|
|
7844
|
+
const account = await this.getSignerAccount();
|
|
7830
7845
|
const encodedTags = params.tags.map(
|
|
7831
7846
|
(t) => viem.stringToHex(t, { size: 32 })
|
|
7832
7847
|
);
|
|
@@ -7845,7 +7860,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7845
7860
|
*/
|
|
7846
7861
|
async updateMarketGroupTags(params) {
|
|
7847
7862
|
const wallet = this.walletClient;
|
|
7848
|
-
const
|
|
7863
|
+
const account = await this.getSignerAccount();
|
|
7849
7864
|
const encodedTags = params.tags.map(
|
|
7850
7865
|
(t) => viem.stringToHex(t, { size: 32 })
|
|
7851
7866
|
);
|
|
@@ -7867,7 +7882,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7867
7882
|
*/
|
|
7868
7883
|
async updateMarketMetadata(params) {
|
|
7869
7884
|
const wallet = this.walletClient;
|
|
7870
|
-
const
|
|
7885
|
+
const account = await this.getSignerAccount();
|
|
7871
7886
|
const { request } = await this.publicClient.simulateContract({
|
|
7872
7887
|
address: this.config.diamondAddress,
|
|
7873
7888
|
abi: MetadataFacet_default,
|
|
@@ -7883,7 +7898,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7883
7898
|
*/
|
|
7884
7899
|
async updateMarketGroupMetadata(params) {
|
|
7885
7900
|
const wallet = this.walletClient;
|
|
7886
|
-
const
|
|
7901
|
+
const account = await this.getSignerAccount();
|
|
7887
7902
|
const { request } = await this.publicClient.simulateContract({
|
|
7888
7903
|
address: this.config.diamondAddress,
|
|
7889
7904
|
abi: MetadataFacet_default,
|
|
@@ -7903,7 +7918,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7903
7918
|
*/
|
|
7904
7919
|
async placeOrder(params) {
|
|
7905
7920
|
const wallet = this.walletClient;
|
|
7906
|
-
const
|
|
7921
|
+
const account = await this.getSignerAccount();
|
|
7907
7922
|
const { request } = await this.publicClient.simulateContract({
|
|
7908
7923
|
address: this.config.diamondAddress,
|
|
7909
7924
|
abi: LimitOrdersFacet_default,
|
|
@@ -7955,7 +7970,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7955
7970
|
*/
|
|
7956
7971
|
async cancelOrder(orderId) {
|
|
7957
7972
|
const wallet = this.walletClient;
|
|
7958
|
-
const
|
|
7973
|
+
const account = await this.getSignerAccount();
|
|
7959
7974
|
const { request } = await this.publicClient.simulateContract({
|
|
7960
7975
|
address: this.config.diamondAddress,
|
|
7961
7976
|
abi: LimitOrdersFacet_default,
|
|
@@ -7974,7 +7989,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7974
7989
|
*/
|
|
7975
7990
|
async cancelOrdersOnResolvedMarket(marketId, orderIds) {
|
|
7976
7991
|
const wallet = this.walletClient;
|
|
7977
|
-
const
|
|
7992
|
+
const account = await this.getSignerAccount();
|
|
7978
7993
|
const { request } = await this.publicClient.simulateContract({
|
|
7979
7994
|
address: this.config.diamondAddress,
|
|
7980
7995
|
abi: LimitOrdersFacet_default,
|
|
@@ -7995,7 +8010,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7995
8010
|
*/
|
|
7996
8011
|
async placeMarketOrder(params) {
|
|
7997
8012
|
const wallet = this.walletClient;
|
|
7998
|
-
const
|
|
8013
|
+
const account = await this.getSignerAccount();
|
|
7999
8014
|
const { request } = await this.publicClient.simulateContract({
|
|
8000
8015
|
address: this.config.diamondAddress,
|
|
8001
8016
|
abi: MarketOrdersFacet_default,
|
|
@@ -8041,8 +8056,8 @@ var TradeModule = class extends BaseModule {
|
|
|
8041
8056
|
* Preview a market order (simulate transaction)
|
|
8042
8057
|
*/
|
|
8043
8058
|
async previewMarketOrder(params) {
|
|
8044
|
-
|
|
8045
|
-
const
|
|
8059
|
+
this.walletClient;
|
|
8060
|
+
const account = await this.getSignerAccount();
|
|
8046
8061
|
const { result } = await this.publicClient.simulateContract({
|
|
8047
8062
|
address: this.config.diamondAddress,
|
|
8048
8063
|
abi: MarketOrdersFacet_default,
|
|
@@ -8062,8 +8077,8 @@ var TradeModule = class extends BaseModule {
|
|
|
8062
8077
|
* Preview placing an order (simulate transaction to check for reverts)
|
|
8063
8078
|
*/
|
|
8064
8079
|
async previewPlaceOrder(params) {
|
|
8065
|
-
|
|
8066
|
-
const
|
|
8080
|
+
this.walletClient;
|
|
8081
|
+
const account = await this.getSignerAccount();
|
|
8067
8082
|
const { result } = await this.publicClient.simulateContract({
|
|
8068
8083
|
address: this.config.diamondAddress,
|
|
8069
8084
|
abi: LimitOrdersFacet_default,
|
|
@@ -8091,7 +8106,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8091
8106
|
*/
|
|
8092
8107
|
async placeMarketSell(params) {
|
|
8093
8108
|
const wallet = this.walletClient;
|
|
8094
|
-
const
|
|
8109
|
+
const account = await this.getSignerAccount();
|
|
8095
8110
|
const { request } = await this.publicClient.simulateContract({
|
|
8096
8111
|
address: this.config.diamondAddress,
|
|
8097
8112
|
abi: MarketOrdersFacet_default,
|
|
@@ -8137,8 +8152,8 @@ var TradeModule = class extends BaseModule {
|
|
|
8137
8152
|
* Preview a market sell order (simulate transaction)
|
|
8138
8153
|
*/
|
|
8139
8154
|
async previewMarketSell(params) {
|
|
8140
|
-
|
|
8141
|
-
const
|
|
8155
|
+
this.walletClient;
|
|
8156
|
+
const account = await this.getSignerAccount();
|
|
8142
8157
|
const { result } = await this.publicClient.simulateContract({
|
|
8143
8158
|
address: this.config.diamondAddress,
|
|
8144
8159
|
abi: MarketOrdersFacet_default,
|
|
@@ -8197,7 +8212,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8197
8212
|
*/
|
|
8198
8213
|
async matchOrders(params) {
|
|
8199
8214
|
const wallet = this.walletClient;
|
|
8200
|
-
const
|
|
8215
|
+
const account = await this.getSignerAccount();
|
|
8201
8216
|
const maxSteps = params.maxSteps || 10n;
|
|
8202
8217
|
const { request } = await this.publicClient.simulateContract({
|
|
8203
8218
|
address: this.config.diamondAddress,
|
|
@@ -8297,7 +8312,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8297
8312
|
*/
|
|
8298
8313
|
async splitPosition(marketId, amount) {
|
|
8299
8314
|
const wallet = this.walletClient;
|
|
8300
|
-
const
|
|
8315
|
+
const account = await this.getSignerAccount();
|
|
8301
8316
|
const { request } = await this.publicClient.simulateContract({
|
|
8302
8317
|
address: this.config.diamondAddress,
|
|
8303
8318
|
abi: VaultFacet_default,
|
|
@@ -8315,7 +8330,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8315
8330
|
*/
|
|
8316
8331
|
async mergePositions(marketId, amount) {
|
|
8317
8332
|
const wallet = this.walletClient;
|
|
8318
|
-
const
|
|
8333
|
+
const account = await this.getSignerAccount();
|
|
8319
8334
|
const { request } = await this.publicClient.simulateContract({
|
|
8320
8335
|
address: this.config.diamondAddress,
|
|
8321
8336
|
abi: VaultFacet_default,
|
|
@@ -8336,7 +8351,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8336
8351
|
*/
|
|
8337
8352
|
async batchPlaceOrders(params) {
|
|
8338
8353
|
const wallet = this.walletClient;
|
|
8339
|
-
const
|
|
8354
|
+
const account = await this.getSignerAccount();
|
|
8340
8355
|
const { request } = await this.publicClient.simulateContract({
|
|
8341
8356
|
address: this.config.diamondAddress,
|
|
8342
8357
|
abi: BatchOrdersFacet_default,
|
|
@@ -8377,7 +8392,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8377
8392
|
*/
|
|
8378
8393
|
async batchCancelOrders(orderIds) {
|
|
8379
8394
|
const wallet = this.walletClient;
|
|
8380
|
-
const
|
|
8395
|
+
const account = await this.getSignerAccount();
|
|
8381
8396
|
const { request } = await this.publicClient.simulateContract({
|
|
8382
8397
|
address: this.config.diamondAddress,
|
|
8383
8398
|
abi: BatchOrdersFacet_default,
|
|
@@ -8396,7 +8411,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8396
8411
|
*/
|
|
8397
8412
|
async cancelAndReplace(params) {
|
|
8398
8413
|
const wallet = this.walletClient;
|
|
8399
|
-
const
|
|
8414
|
+
const account = await this.getSignerAccount();
|
|
8400
8415
|
const { request } = await this.publicClient.simulateContract({
|
|
8401
8416
|
address: this.config.diamondAddress,
|
|
8402
8417
|
abi: BatchOrdersFacet_default,
|
|
@@ -9921,7 +9936,7 @@ var TokenModule = class extends BaseModule {
|
|
|
9921
9936
|
*/
|
|
9922
9937
|
async mint(token, to, amount) {
|
|
9923
9938
|
const wallet = this.walletClient;
|
|
9924
|
-
const
|
|
9939
|
+
const account = await this.getSignerAccount();
|
|
9925
9940
|
const { request } = await this.publicClient.simulateContract({
|
|
9926
9941
|
address: token,
|
|
9927
9942
|
abi: ERC20_default,
|
|
@@ -9936,7 +9951,7 @@ var TokenModule = class extends BaseModule {
|
|
|
9936
9951
|
*/
|
|
9937
9952
|
async approve(token, spender, amount) {
|
|
9938
9953
|
const wallet = this.walletClient;
|
|
9939
|
-
const
|
|
9954
|
+
const account = await this.getSignerAccount();
|
|
9940
9955
|
const { request } = await this.publicClient.simulateContract({
|
|
9941
9956
|
address: token,
|
|
9942
9957
|
abi: ERC20_default,
|
|
@@ -10020,7 +10035,8 @@ var UmaModule = class extends BaseModule {
|
|
|
10020
10035
|
*/
|
|
10021
10036
|
async assertMarketOutcome(params) {
|
|
10022
10037
|
const wallet = this.walletClient;
|
|
10023
|
-
const
|
|
10038
|
+
const account = await this.getSignerAccount();
|
|
10039
|
+
const accountAddress = await this.getSignerAddress();
|
|
10024
10040
|
const autoApprove = params.autoApprove ?? true;
|
|
10025
10041
|
const registryData = await this.publicClient.readContract({
|
|
10026
10042
|
address: this.config.diamondAddress,
|
|
@@ -10035,7 +10051,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10035
10051
|
address: currency,
|
|
10036
10052
|
abi: viem.erc20Abi,
|
|
10037
10053
|
functionName: "allowance",
|
|
10038
|
-
args: [
|
|
10054
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
10039
10055
|
});
|
|
10040
10056
|
if (currentAllowance < bondAmount && autoApprove) {
|
|
10041
10057
|
const approveHash = await wallet.writeContract({
|
|
@@ -10055,7 +10071,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10055
10071
|
address: currency,
|
|
10056
10072
|
abi: viem.erc20Abi,
|
|
10057
10073
|
functionName: "allowance",
|
|
10058
|
-
args: [
|
|
10074
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
10059
10075
|
});
|
|
10060
10076
|
if (newAllowance < bondAmount) {
|
|
10061
10077
|
throw new Error(
|
|
@@ -10071,7 +10087,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10071
10087
|
address: currency,
|
|
10072
10088
|
abi: viem.erc20Abi,
|
|
10073
10089
|
functionName: "balanceOf",
|
|
10074
|
-
args: [
|
|
10090
|
+
args: [accountAddress]
|
|
10075
10091
|
});
|
|
10076
10092
|
if (balance < bondAmount) {
|
|
10077
10093
|
throw new Error(
|
|
@@ -10119,7 +10135,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10119
10135
|
*/
|
|
10120
10136
|
async settleAssertion(assertionId) {
|
|
10121
10137
|
const wallet = this.walletClient;
|
|
10122
|
-
const
|
|
10138
|
+
const account = await this.getSignerAccount();
|
|
10123
10139
|
const { request } = await this.publicClient.simulateContract({
|
|
10124
10140
|
address: this.config.diamondAddress,
|
|
10125
10141
|
abi: ResolutionFacet_default,
|
|
@@ -10134,7 +10150,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10134
10150
|
*/
|
|
10135
10151
|
async reportResolution(params) {
|
|
10136
10152
|
const wallet = this.walletClient;
|
|
10137
|
-
const
|
|
10153
|
+
const account = await this.getSignerAccount();
|
|
10138
10154
|
const { request } = await this.publicClient.simulateContract({
|
|
10139
10155
|
address: this.config.diamondAddress,
|
|
10140
10156
|
abi: ResolutionFacet_default,
|
|
@@ -10201,7 +10217,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10201
10217
|
*/
|
|
10202
10218
|
async redeemWinnings(marketId) {
|
|
10203
10219
|
const wallet = this.walletClient;
|
|
10204
|
-
const
|
|
10220
|
+
const account = await this.getSignerAccount();
|
|
10205
10221
|
const oracleData = await this.publicClient.readContract({
|
|
10206
10222
|
address: this.config.diamondAddress,
|
|
10207
10223
|
abi: MarketsFacet_default,
|
|
@@ -10448,7 +10464,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10448
10464
|
*/
|
|
10449
10465
|
async deployWhitelist() {
|
|
10450
10466
|
const wallet = this.walletClient;
|
|
10451
|
-
const
|
|
10467
|
+
const account = await this.getSignerAccount();
|
|
10452
10468
|
const { request } = await this.publicClient.simulateContract({
|
|
10453
10469
|
address: this.config.diamondAddress,
|
|
10454
10470
|
abi: AccessControlFacet_default,
|
|
@@ -10466,7 +10482,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10466
10482
|
*/
|
|
10467
10483
|
async deployNFTGated(params) {
|
|
10468
10484
|
const wallet = this.walletClient;
|
|
10469
|
-
const
|
|
10485
|
+
const account = await this.getSignerAccount();
|
|
10470
10486
|
const { request } = await this.publicClient.simulateContract({
|
|
10471
10487
|
address: this.config.diamondAddress,
|
|
10472
10488
|
abi: AccessControlFacet_default,
|
|
@@ -10483,7 +10499,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10483
10499
|
*/
|
|
10484
10500
|
async deployTokenGated(params) {
|
|
10485
10501
|
const wallet = this.walletClient;
|
|
10486
|
-
const
|
|
10502
|
+
const account = await this.getSignerAccount();
|
|
10487
10503
|
const { request } = await this.publicClient.simulateContract({
|
|
10488
10504
|
address: this.config.diamondAddress,
|
|
10489
10505
|
abi: AccessControlFacet_default,
|
|
@@ -10499,7 +10515,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10499
10515
|
*/
|
|
10500
10516
|
async setMarketTradingAC(params) {
|
|
10501
10517
|
const wallet = this.walletClient;
|
|
10502
|
-
const
|
|
10518
|
+
const account = await this.getSignerAccount();
|
|
10503
10519
|
const { request } = await this.publicClient.simulateContract({
|
|
10504
10520
|
address: this.config.diamondAddress,
|
|
10505
10521
|
abi: AccessControlFacet_default,
|
|
@@ -10514,7 +10530,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10514
10530
|
*/
|
|
10515
10531
|
async removeMarketTradingAC(params) {
|
|
10516
10532
|
const wallet = this.walletClient;
|
|
10517
|
-
const
|
|
10533
|
+
const account = await this.getSignerAccount();
|
|
10518
10534
|
const { request } = await this.publicClient.simulateContract({
|
|
10519
10535
|
address: this.config.diamondAddress,
|
|
10520
10536
|
abi: AccessControlFacet_default,
|
|
@@ -10553,7 +10569,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10553
10569
|
*/
|
|
10554
10570
|
async addToWhitelist(params) {
|
|
10555
10571
|
const wallet = this.walletClient;
|
|
10556
|
-
const
|
|
10572
|
+
const account = await this.getSignerAccount();
|
|
10557
10573
|
const { request } = await this.publicClient.simulateContract({
|
|
10558
10574
|
address: params.acContract,
|
|
10559
10575
|
abi: WhitelistAccessControl_default,
|
|
@@ -10568,7 +10584,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10568
10584
|
*/
|
|
10569
10585
|
async removeFromWhitelist(params) {
|
|
10570
10586
|
const wallet = this.walletClient;
|
|
10571
|
-
const
|
|
10587
|
+
const account = await this.getSignerAccount();
|
|
10572
10588
|
const { request } = await this.publicClient.simulateContract({
|
|
10573
10589
|
address: params.acContract,
|
|
10574
10590
|
abi: WhitelistAccessControl_default,
|
|
@@ -10630,10 +10646,10 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10630
10646
|
*/
|
|
10631
10647
|
async createPyth(params) {
|
|
10632
10648
|
const wallet = this.walletClient;
|
|
10633
|
-
const
|
|
10649
|
+
const account = await this.getSignerAccount();
|
|
10634
10650
|
const outcomes = params.outcomes ?? ["Up", "Down"];
|
|
10635
10651
|
const isStrikeMarket = params.strikePrice && params.strikePrice > BigInt(0);
|
|
10636
|
-
const { encodedTags, ancillaryData } = await this._prepareCreationCommon(params,
|
|
10652
|
+
const { encodedTags, ancillaryData } = await this._prepareCreationCommon(params, await this.getSignerAddress());
|
|
10637
10653
|
if (!isValidTickSize(params.tickSize)) {
|
|
10638
10654
|
throw new Error("Invalid tickSize: must be 1e15 (0.1%) or 1e16 (1%)");
|
|
10639
10655
|
}
|
|
@@ -10676,7 +10692,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10676
10692
|
*/
|
|
10677
10693
|
async resolvePyth(marketId) {
|
|
10678
10694
|
const wallet = this.walletClient;
|
|
10679
|
-
const
|
|
10695
|
+
const account = await this.getSignerAccount();
|
|
10680
10696
|
const pm = await this.get(marketId);
|
|
10681
10697
|
if (pm.resolved) {
|
|
10682
10698
|
throw new Error("Price market already resolved");
|
|
@@ -10769,7 +10785,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10769
10785
|
*/
|
|
10770
10786
|
async setPythContract(pythContract) {
|
|
10771
10787
|
const wallet = this.walletClient;
|
|
10772
|
-
const
|
|
10788
|
+
const account = await this.getSignerAccount();
|
|
10773
10789
|
const { request } = await this.publicClient.simulateContract({
|
|
10774
10790
|
address: this.config.diamondAddress,
|
|
10775
10791
|
abi: PythResolutionFacet_default,
|
|
@@ -10799,7 +10815,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10799
10815
|
*/
|
|
10800
10816
|
async setOpenMaxStaleness(openMaxStaleness) {
|
|
10801
10817
|
const wallet = this.walletClient;
|
|
10802
|
-
const
|
|
10818
|
+
const account = await this.getSignerAccount();
|
|
10803
10819
|
const { request } = await this.publicClient.simulateContract({
|
|
10804
10820
|
address: this.config.diamondAddress,
|
|
10805
10821
|
abi: PythResolutionFacet_default,
|