@oddmaki-protocol/sdk 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +7 -1
- package/dist/index.d.mts +300 -43
- package/dist/index.d.ts +300 -43
- package/dist/index.js +350 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +350 -76
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -3
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: "0x31a4126aec35b36d46dd371eb0f0d5b71e1c2292",
|
|
11
11
|
conditionalTokens: "0x7364747372Ac4a175B5326f5B2C9CB1C271d32e8",
|
|
12
|
-
usdc: "
|
|
12
|
+
usdc: "0x1d3caa0156e8e573814b78766ba7958d7e11488b",
|
|
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
|
|
@@ -6811,6 +6824,260 @@ var ERC20_default = [
|
|
|
6811
6824
|
}
|
|
6812
6825
|
];
|
|
6813
6826
|
|
|
6827
|
+
// src/contracts/abis/UmaOracle.json
|
|
6828
|
+
var UmaOracle_default = [
|
|
6829
|
+
{
|
|
6830
|
+
type: "function",
|
|
6831
|
+
name: "assertTruth",
|
|
6832
|
+
inputs: [
|
|
6833
|
+
{
|
|
6834
|
+
name: "claim",
|
|
6835
|
+
type: "bytes",
|
|
6836
|
+
internalType: "bytes"
|
|
6837
|
+
},
|
|
6838
|
+
{
|
|
6839
|
+
name: "asserter",
|
|
6840
|
+
type: "address",
|
|
6841
|
+
internalType: "address"
|
|
6842
|
+
},
|
|
6843
|
+
{
|
|
6844
|
+
name: "callbackRecipient",
|
|
6845
|
+
type: "address",
|
|
6846
|
+
internalType: "address"
|
|
6847
|
+
},
|
|
6848
|
+
{
|
|
6849
|
+
name: "escalationManager",
|
|
6850
|
+
type: "address",
|
|
6851
|
+
internalType: "address"
|
|
6852
|
+
},
|
|
6853
|
+
{
|
|
6854
|
+
name: "liveness",
|
|
6855
|
+
type: "uint64",
|
|
6856
|
+
internalType: "uint64"
|
|
6857
|
+
},
|
|
6858
|
+
{
|
|
6859
|
+
name: "currency",
|
|
6860
|
+
type: "address",
|
|
6861
|
+
internalType: "contract IERC20"
|
|
6862
|
+
},
|
|
6863
|
+
{
|
|
6864
|
+
name: "bond",
|
|
6865
|
+
type: "uint256",
|
|
6866
|
+
internalType: "uint256"
|
|
6867
|
+
},
|
|
6868
|
+
{
|
|
6869
|
+
name: "identifier",
|
|
6870
|
+
type: "bytes32",
|
|
6871
|
+
internalType: "bytes32"
|
|
6872
|
+
},
|
|
6873
|
+
{
|
|
6874
|
+
name: "domainId",
|
|
6875
|
+
type: "bytes32",
|
|
6876
|
+
internalType: "bytes32"
|
|
6877
|
+
}
|
|
6878
|
+
],
|
|
6879
|
+
outputs: [
|
|
6880
|
+
{
|
|
6881
|
+
name: "",
|
|
6882
|
+
type: "bytes32",
|
|
6883
|
+
internalType: "bytes32"
|
|
6884
|
+
}
|
|
6885
|
+
],
|
|
6886
|
+
stateMutability: "nonpayable"
|
|
6887
|
+
},
|
|
6888
|
+
{
|
|
6889
|
+
type: "function",
|
|
6890
|
+
name: "defaultIdentifier",
|
|
6891
|
+
inputs: [],
|
|
6892
|
+
outputs: [
|
|
6893
|
+
{
|
|
6894
|
+
name: "",
|
|
6895
|
+
type: "bytes32",
|
|
6896
|
+
internalType: "bytes32"
|
|
6897
|
+
}
|
|
6898
|
+
],
|
|
6899
|
+
stateMutability: "view"
|
|
6900
|
+
},
|
|
6901
|
+
{
|
|
6902
|
+
type: "function",
|
|
6903
|
+
name: "getAssertion",
|
|
6904
|
+
inputs: [
|
|
6905
|
+
{
|
|
6906
|
+
name: "assertionId",
|
|
6907
|
+
type: "bytes32",
|
|
6908
|
+
internalType: "bytes32"
|
|
6909
|
+
}
|
|
6910
|
+
],
|
|
6911
|
+
outputs: [
|
|
6912
|
+
{
|
|
6913
|
+
name: "",
|
|
6914
|
+
type: "tuple",
|
|
6915
|
+
internalType: "struct OptimisticOracleV3Interface.Assertion",
|
|
6916
|
+
components: [
|
|
6917
|
+
{
|
|
6918
|
+
name: "escalationManagerSettings",
|
|
6919
|
+
type: "tuple",
|
|
6920
|
+
internalType: "struct OptimisticOracleV3Interface.EscalationManagerSettings",
|
|
6921
|
+
components: [
|
|
6922
|
+
{
|
|
6923
|
+
name: "arbitrateViaEscalationManager",
|
|
6924
|
+
type: "bool",
|
|
6925
|
+
internalType: "bool"
|
|
6926
|
+
},
|
|
6927
|
+
{
|
|
6928
|
+
name: "discardOracle",
|
|
6929
|
+
type: "bool",
|
|
6930
|
+
internalType: "bool"
|
|
6931
|
+
},
|
|
6932
|
+
{
|
|
6933
|
+
name: "validateDisputers",
|
|
6934
|
+
type: "bool",
|
|
6935
|
+
internalType: "bool"
|
|
6936
|
+
},
|
|
6937
|
+
{
|
|
6938
|
+
name: "assertingCaller",
|
|
6939
|
+
type: "address",
|
|
6940
|
+
internalType: "address"
|
|
6941
|
+
},
|
|
6942
|
+
{
|
|
6943
|
+
name: "escalationManager",
|
|
6944
|
+
type: "address",
|
|
6945
|
+
internalType: "address"
|
|
6946
|
+
}
|
|
6947
|
+
]
|
|
6948
|
+
},
|
|
6949
|
+
{
|
|
6950
|
+
name: "asserter",
|
|
6951
|
+
type: "address",
|
|
6952
|
+
internalType: "address"
|
|
6953
|
+
},
|
|
6954
|
+
{
|
|
6955
|
+
name: "assertionTime",
|
|
6956
|
+
type: "uint64",
|
|
6957
|
+
internalType: "uint64"
|
|
6958
|
+
},
|
|
6959
|
+
{
|
|
6960
|
+
name: "settled",
|
|
6961
|
+
type: "bool",
|
|
6962
|
+
internalType: "bool"
|
|
6963
|
+
},
|
|
6964
|
+
{
|
|
6965
|
+
name: "currency",
|
|
6966
|
+
type: "address",
|
|
6967
|
+
internalType: "contract IERC20"
|
|
6968
|
+
},
|
|
6969
|
+
{
|
|
6970
|
+
name: "expirationTime",
|
|
6971
|
+
type: "uint64",
|
|
6972
|
+
internalType: "uint64"
|
|
6973
|
+
},
|
|
6974
|
+
{
|
|
6975
|
+
name: "settlementResolution",
|
|
6976
|
+
type: "bool",
|
|
6977
|
+
internalType: "bool"
|
|
6978
|
+
},
|
|
6979
|
+
{
|
|
6980
|
+
name: "domainId",
|
|
6981
|
+
type: "bytes32",
|
|
6982
|
+
internalType: "bytes32"
|
|
6983
|
+
},
|
|
6984
|
+
{
|
|
6985
|
+
name: "identifier",
|
|
6986
|
+
type: "bytes32",
|
|
6987
|
+
internalType: "bytes32"
|
|
6988
|
+
},
|
|
6989
|
+
{
|
|
6990
|
+
name: "bond",
|
|
6991
|
+
type: "uint256",
|
|
6992
|
+
internalType: "uint256"
|
|
6993
|
+
},
|
|
6994
|
+
{
|
|
6995
|
+
name: "callbackRecipient",
|
|
6996
|
+
type: "address",
|
|
6997
|
+
internalType: "address"
|
|
6998
|
+
},
|
|
6999
|
+
{
|
|
7000
|
+
name: "disputer",
|
|
7001
|
+
type: "address",
|
|
7002
|
+
internalType: "address"
|
|
7003
|
+
}
|
|
7004
|
+
]
|
|
7005
|
+
}
|
|
7006
|
+
],
|
|
7007
|
+
stateMutability: "view"
|
|
7008
|
+
},
|
|
7009
|
+
{
|
|
7010
|
+
type: "function",
|
|
7011
|
+
name: "getAssertionResult",
|
|
7012
|
+
inputs: [
|
|
7013
|
+
{
|
|
7014
|
+
name: "assertionId",
|
|
7015
|
+
type: "bytes32",
|
|
7016
|
+
internalType: "bytes32"
|
|
7017
|
+
}
|
|
7018
|
+
],
|
|
7019
|
+
outputs: [
|
|
7020
|
+
{
|
|
7021
|
+
name: "",
|
|
7022
|
+
type: "bool",
|
|
7023
|
+
internalType: "bool"
|
|
7024
|
+
}
|
|
7025
|
+
],
|
|
7026
|
+
stateMutability: "view"
|
|
7027
|
+
},
|
|
7028
|
+
{
|
|
7029
|
+
type: "function",
|
|
7030
|
+
name: "getMinimumBond",
|
|
7031
|
+
inputs: [
|
|
7032
|
+
{
|
|
7033
|
+
name: "currency",
|
|
7034
|
+
type: "address",
|
|
7035
|
+
internalType: "address"
|
|
7036
|
+
}
|
|
7037
|
+
],
|
|
7038
|
+
outputs: [
|
|
7039
|
+
{
|
|
7040
|
+
name: "",
|
|
7041
|
+
type: "uint256",
|
|
7042
|
+
internalType: "uint256"
|
|
7043
|
+
}
|
|
7044
|
+
],
|
|
7045
|
+
stateMutability: "view"
|
|
7046
|
+
},
|
|
7047
|
+
{
|
|
7048
|
+
type: "function",
|
|
7049
|
+
name: "isSettled",
|
|
7050
|
+
inputs: [
|
|
7051
|
+
{
|
|
7052
|
+
name: "assertionId",
|
|
7053
|
+
type: "bytes32",
|
|
7054
|
+
internalType: "bytes32"
|
|
7055
|
+
}
|
|
7056
|
+
],
|
|
7057
|
+
outputs: [
|
|
7058
|
+
{
|
|
7059
|
+
name: "settled",
|
|
7060
|
+
type: "bool",
|
|
7061
|
+
internalType: "bool"
|
|
7062
|
+
}
|
|
7063
|
+
],
|
|
7064
|
+
stateMutability: "view"
|
|
7065
|
+
},
|
|
7066
|
+
{
|
|
7067
|
+
type: "function",
|
|
7068
|
+
name: "settleAssertion",
|
|
7069
|
+
inputs: [
|
|
7070
|
+
{
|
|
7071
|
+
name: "assertionId",
|
|
7072
|
+
type: "bytes32",
|
|
7073
|
+
internalType: "bytes32"
|
|
7074
|
+
}
|
|
7075
|
+
],
|
|
7076
|
+
outputs: [],
|
|
7077
|
+
stateMutability: "nonpayable"
|
|
7078
|
+
}
|
|
7079
|
+
];
|
|
7080
|
+
|
|
6814
7081
|
// src/modules/venue.ts
|
|
6815
7082
|
var VenueModule = class extends BaseModule {
|
|
6816
7083
|
/**
|
|
@@ -6832,7 +7099,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6832
7099
|
*/
|
|
6833
7100
|
async createVenue(params) {
|
|
6834
7101
|
const wallet = this.walletClient;
|
|
6835
|
-
const
|
|
7102
|
+
const account = await this.getSignerAccount();
|
|
6836
7103
|
const { request } = await this.publicClient.simulateContract({
|
|
6837
7104
|
address: this.config.diamondAddress,
|
|
6838
7105
|
abi: VenueFacet_default,
|
|
@@ -6859,7 +7126,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6859
7126
|
*/
|
|
6860
7127
|
async updateFees(params) {
|
|
6861
7128
|
const wallet = this.walletClient;
|
|
6862
|
-
const
|
|
7129
|
+
const account = await this.getSignerAccount();
|
|
6863
7130
|
const { request } = await this.publicClient.simulateContract({
|
|
6864
7131
|
address: this.config.diamondAddress,
|
|
6865
7132
|
abi: VenueFacet_default,
|
|
@@ -6874,7 +7141,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6874
7141
|
*/
|
|
6875
7142
|
async setPaused(venueId, paused) {
|
|
6876
7143
|
const wallet = this.walletClient;
|
|
6877
|
-
const
|
|
7144
|
+
const account = await this.getSignerAccount();
|
|
6878
7145
|
const functionName = paused ? "pauseVenue" : "unpauseVenue";
|
|
6879
7146
|
const { request } = await this.publicClient.simulateContract({
|
|
6880
7147
|
address: this.config.diamondAddress,
|
|
@@ -6901,7 +7168,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6901
7168
|
*/
|
|
6902
7169
|
async updateVenue(params) {
|
|
6903
7170
|
const wallet = this.walletClient;
|
|
6904
|
-
const
|
|
7171
|
+
const account = await this.getSignerAccount();
|
|
6905
7172
|
const { request } = await this.publicClient.simulateContract({
|
|
6906
7173
|
address: this.config.diamondAddress,
|
|
6907
7174
|
abi: VenueFacet_default,
|
|
@@ -6923,7 +7190,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6923
7190
|
*/
|
|
6924
7191
|
async updateOracleParams(params) {
|
|
6925
7192
|
const wallet = this.walletClient;
|
|
6926
|
-
const
|
|
7193
|
+
const account = await this.getSignerAccount();
|
|
6927
7194
|
const { request } = await this.publicClient.simulateContract({
|
|
6928
7195
|
address: this.config.diamondAddress,
|
|
6929
7196
|
abi: VenueFacet_default,
|
|
@@ -6972,7 +7239,7 @@ var VenueModule = class extends BaseModule {
|
|
|
6972
7239
|
*/
|
|
6973
7240
|
async setProtocolFeeBps(bps) {
|
|
6974
7241
|
const wallet = this.walletClient;
|
|
6975
|
-
const
|
|
7242
|
+
const account = await this.getSignerAccount();
|
|
6976
7243
|
const { request } = await this.publicClient.simulateContract({
|
|
6977
7244
|
address: this.config.diamondAddress,
|
|
6978
7245
|
abi: ProtocolFacet_default,
|
|
@@ -7208,6 +7475,18 @@ function clearDecimalsCache() {
|
|
|
7208
7475
|
}
|
|
7209
7476
|
|
|
7210
7477
|
// src/modules/market.ts
|
|
7478
|
+
var CTF_IS_APPROVED_FOR_ALL_ABI = [
|
|
7479
|
+
{
|
|
7480
|
+
name: "isApprovedForAll",
|
|
7481
|
+
type: "function",
|
|
7482
|
+
stateMutability: "view",
|
|
7483
|
+
inputs: [
|
|
7484
|
+
{ name: "account", type: "address" },
|
|
7485
|
+
{ name: "operator", type: "address" }
|
|
7486
|
+
],
|
|
7487
|
+
outputs: [{ name: "", type: "bool" }]
|
|
7488
|
+
}
|
|
7489
|
+
];
|
|
7211
7490
|
var MarketModule = class extends BaseModule {
|
|
7212
7491
|
/**
|
|
7213
7492
|
* Format market question into UMA-compliant ancillary data
|
|
@@ -7233,7 +7512,8 @@ var MarketModule = class extends BaseModule {
|
|
|
7233
7512
|
*/
|
|
7234
7513
|
async createMarket(params) {
|
|
7235
7514
|
const wallet = this.walletClient;
|
|
7236
|
-
const
|
|
7515
|
+
const account = await this.getSignerAccount();
|
|
7516
|
+
const accountAddress = await this.getSignerAddress();
|
|
7237
7517
|
const venue = await this.publicClient.readContract({
|
|
7238
7518
|
address: this.config.diamondAddress,
|
|
7239
7519
|
abi: VenueFacet_default,
|
|
@@ -7248,7 +7528,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7248
7528
|
address: params.collateralToken,
|
|
7249
7529
|
abi: viem.erc20Abi,
|
|
7250
7530
|
functionName: "allowance",
|
|
7251
|
-
args: [
|
|
7531
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
7252
7532
|
});
|
|
7253
7533
|
if (allowance < totalRequired) {
|
|
7254
7534
|
throw new Error(
|
|
@@ -7259,7 +7539,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7259
7539
|
address: params.collateralToken,
|
|
7260
7540
|
abi: viem.erc20Abi,
|
|
7261
7541
|
functionName: "balanceOf",
|
|
7262
|
-
args: [
|
|
7542
|
+
args: [accountAddress]
|
|
7263
7543
|
});
|
|
7264
7544
|
if (balance < totalRequired) {
|
|
7265
7545
|
throw new Error(
|
|
@@ -7502,7 +7782,8 @@ var MarketModule = class extends BaseModule {
|
|
|
7502
7782
|
*/
|
|
7503
7783
|
async createMarketGroup(params) {
|
|
7504
7784
|
const wallet = this.walletClient;
|
|
7505
|
-
const
|
|
7785
|
+
const account = await this.getSignerAccount();
|
|
7786
|
+
const accountAddress = await this.getSignerAddress();
|
|
7506
7787
|
const venue = await this.publicClient.readContract({
|
|
7507
7788
|
address: this.config.diamondAddress,
|
|
7508
7789
|
abi: VenueFacet_default,
|
|
@@ -7517,7 +7798,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7517
7798
|
address: params.collateralToken,
|
|
7518
7799
|
abi: viem.erc20Abi,
|
|
7519
7800
|
functionName: "allowance",
|
|
7520
|
-
args: [
|
|
7801
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
7521
7802
|
});
|
|
7522
7803
|
if (allowance < totalRequired) {
|
|
7523
7804
|
throw new Error(
|
|
@@ -7528,7 +7809,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7528
7809
|
address: params.collateralToken,
|
|
7529
7810
|
abi: viem.erc20Abi,
|
|
7530
7811
|
functionName: "balanceOf",
|
|
7531
|
-
args: [
|
|
7812
|
+
args: [accountAddress]
|
|
7532
7813
|
});
|
|
7533
7814
|
if (balance < totalRequired) {
|
|
7534
7815
|
throw new Error(
|
|
@@ -7565,7 +7846,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7565
7846
|
*/
|
|
7566
7847
|
async addMarketToGroup(params) {
|
|
7567
7848
|
const wallet = this.walletClient;
|
|
7568
|
-
const
|
|
7849
|
+
const account = await this.getSignerAccount();
|
|
7569
7850
|
const { request } = await this.publicClient.simulateContract({
|
|
7570
7851
|
address: this.config.diamondAddress,
|
|
7571
7852
|
abi: MarketsFacet_default,
|
|
@@ -7580,7 +7861,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7580
7861
|
*/
|
|
7581
7862
|
async addPlaceholderMarkets(params) {
|
|
7582
7863
|
const wallet = this.walletClient;
|
|
7583
|
-
const
|
|
7864
|
+
const account = await this.getSignerAccount();
|
|
7584
7865
|
if (params.count < 1n || params.count > 50n) {
|
|
7585
7866
|
throw new Error("Count must be between 1 and 50");
|
|
7586
7867
|
}
|
|
@@ -7598,7 +7879,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7598
7879
|
*/
|
|
7599
7880
|
async activatePlaceholder(params) {
|
|
7600
7881
|
const wallet = this.walletClient;
|
|
7601
|
-
const
|
|
7882
|
+
const account = await this.getSignerAccount();
|
|
7602
7883
|
const { request } = await this.publicClient.simulateContract({
|
|
7603
7884
|
address: this.config.diamondAddress,
|
|
7604
7885
|
abi: MarketsFacet_default,
|
|
@@ -7618,7 +7899,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7618
7899
|
*/
|
|
7619
7900
|
async activateMarketGroup(params) {
|
|
7620
7901
|
const wallet = this.walletClient;
|
|
7621
|
-
const
|
|
7902
|
+
const account = await this.getSignerAccount();
|
|
7622
7903
|
const { request } = await this.publicClient.simulateContract({
|
|
7623
7904
|
address: this.config.diamondAddress,
|
|
7624
7905
|
abi: MarketGroupFacet_default,
|
|
@@ -7635,12 +7916,13 @@ var MarketModule = class extends BaseModule {
|
|
|
7635
7916
|
*/
|
|
7636
7917
|
async convertPositions(params) {
|
|
7637
7918
|
const wallet = this.walletClient;
|
|
7638
|
-
const
|
|
7919
|
+
const account = await this.getSignerAccount();
|
|
7920
|
+
const accountAddress = await this.getSignerAddress();
|
|
7639
7921
|
const isApproved = await this.publicClient.readContract({
|
|
7640
7922
|
address: this.config.conditionalTokensAddress,
|
|
7641
|
-
abi:
|
|
7923
|
+
abi: CTF_IS_APPROVED_FOR_ALL_ABI,
|
|
7642
7924
|
functionName: "isApprovedForAll",
|
|
7643
|
-
args: [
|
|
7925
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
7644
7926
|
});
|
|
7645
7927
|
if (!isApproved) {
|
|
7646
7928
|
throw new Error(
|
|
@@ -7791,7 +8073,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7791
8073
|
*/
|
|
7792
8074
|
async pauseMarket(marketId) {
|
|
7793
8075
|
const wallet = this.walletClient;
|
|
7794
|
-
const
|
|
8076
|
+
const account = await this.getSignerAccount();
|
|
7795
8077
|
const { request } = await this.publicClient.simulateContract({
|
|
7796
8078
|
address: this.config.diamondAddress,
|
|
7797
8079
|
abi: MarketsFacet_default,
|
|
@@ -7807,7 +8089,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7807
8089
|
*/
|
|
7808
8090
|
async unpauseMarket(marketId) {
|
|
7809
8091
|
const wallet = this.walletClient;
|
|
7810
|
-
const
|
|
8092
|
+
const account = await this.getSignerAccount();
|
|
7811
8093
|
const { request } = await this.publicClient.simulateContract({
|
|
7812
8094
|
address: this.config.diamondAddress,
|
|
7813
8095
|
abi: MarketsFacet_default,
|
|
@@ -7826,7 +8108,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7826
8108
|
*/
|
|
7827
8109
|
async updateMarketTags(params) {
|
|
7828
8110
|
const wallet = this.walletClient;
|
|
7829
|
-
const
|
|
8111
|
+
const account = await this.getSignerAccount();
|
|
7830
8112
|
const encodedTags = params.tags.map(
|
|
7831
8113
|
(t) => viem.stringToHex(t, { size: 32 })
|
|
7832
8114
|
);
|
|
@@ -7845,7 +8127,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7845
8127
|
*/
|
|
7846
8128
|
async updateMarketGroupTags(params) {
|
|
7847
8129
|
const wallet = this.walletClient;
|
|
7848
|
-
const
|
|
8130
|
+
const account = await this.getSignerAccount();
|
|
7849
8131
|
const encodedTags = params.tags.map(
|
|
7850
8132
|
(t) => viem.stringToHex(t, { size: 32 })
|
|
7851
8133
|
);
|
|
@@ -7867,7 +8149,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7867
8149
|
*/
|
|
7868
8150
|
async updateMarketMetadata(params) {
|
|
7869
8151
|
const wallet = this.walletClient;
|
|
7870
|
-
const
|
|
8152
|
+
const account = await this.getSignerAccount();
|
|
7871
8153
|
const { request } = await this.publicClient.simulateContract({
|
|
7872
8154
|
address: this.config.diamondAddress,
|
|
7873
8155
|
abi: MetadataFacet_default,
|
|
@@ -7883,7 +8165,7 @@ var MarketModule = class extends BaseModule {
|
|
|
7883
8165
|
*/
|
|
7884
8166
|
async updateMarketGroupMetadata(params) {
|
|
7885
8167
|
const wallet = this.walletClient;
|
|
7886
|
-
const
|
|
8168
|
+
const account = await this.getSignerAccount();
|
|
7887
8169
|
const { request } = await this.publicClient.simulateContract({
|
|
7888
8170
|
address: this.config.diamondAddress,
|
|
7889
8171
|
abi: MetadataFacet_default,
|
|
@@ -7903,7 +8185,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7903
8185
|
*/
|
|
7904
8186
|
async placeOrder(params) {
|
|
7905
8187
|
const wallet = this.walletClient;
|
|
7906
|
-
const
|
|
8188
|
+
const account = await this.getSignerAccount();
|
|
7907
8189
|
const { request } = await this.publicClient.simulateContract({
|
|
7908
8190
|
address: this.config.diamondAddress,
|
|
7909
8191
|
abi: LimitOrdersFacet_default,
|
|
@@ -7955,7 +8237,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7955
8237
|
*/
|
|
7956
8238
|
async cancelOrder(orderId) {
|
|
7957
8239
|
const wallet = this.walletClient;
|
|
7958
|
-
const
|
|
8240
|
+
const account = await this.getSignerAccount();
|
|
7959
8241
|
const { request } = await this.publicClient.simulateContract({
|
|
7960
8242
|
address: this.config.diamondAddress,
|
|
7961
8243
|
abi: LimitOrdersFacet_default,
|
|
@@ -7974,7 +8256,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7974
8256
|
*/
|
|
7975
8257
|
async cancelOrdersOnResolvedMarket(marketId, orderIds) {
|
|
7976
8258
|
const wallet = this.walletClient;
|
|
7977
|
-
const
|
|
8259
|
+
const account = await this.getSignerAccount();
|
|
7978
8260
|
const { request } = await this.publicClient.simulateContract({
|
|
7979
8261
|
address: this.config.diamondAddress,
|
|
7980
8262
|
abi: LimitOrdersFacet_default,
|
|
@@ -7995,7 +8277,7 @@ var TradeModule = class extends BaseModule {
|
|
|
7995
8277
|
*/
|
|
7996
8278
|
async placeMarketOrder(params) {
|
|
7997
8279
|
const wallet = this.walletClient;
|
|
7998
|
-
const
|
|
8280
|
+
const account = await this.getSignerAccount();
|
|
7999
8281
|
const { request } = await this.publicClient.simulateContract({
|
|
8000
8282
|
address: this.config.diamondAddress,
|
|
8001
8283
|
abi: MarketOrdersFacet_default,
|
|
@@ -8041,8 +8323,8 @@ var TradeModule = class extends BaseModule {
|
|
|
8041
8323
|
* Preview a market order (simulate transaction)
|
|
8042
8324
|
*/
|
|
8043
8325
|
async previewMarketOrder(params) {
|
|
8044
|
-
|
|
8045
|
-
const
|
|
8326
|
+
this.walletClient;
|
|
8327
|
+
const account = await this.getSignerAccount();
|
|
8046
8328
|
const { result } = await this.publicClient.simulateContract({
|
|
8047
8329
|
address: this.config.diamondAddress,
|
|
8048
8330
|
abi: MarketOrdersFacet_default,
|
|
@@ -8062,8 +8344,8 @@ var TradeModule = class extends BaseModule {
|
|
|
8062
8344
|
* Preview placing an order (simulate transaction to check for reverts)
|
|
8063
8345
|
*/
|
|
8064
8346
|
async previewPlaceOrder(params) {
|
|
8065
|
-
|
|
8066
|
-
const
|
|
8347
|
+
this.walletClient;
|
|
8348
|
+
const account = await this.getSignerAccount();
|
|
8067
8349
|
const { result } = await this.publicClient.simulateContract({
|
|
8068
8350
|
address: this.config.diamondAddress,
|
|
8069
8351
|
abi: LimitOrdersFacet_default,
|
|
@@ -8091,7 +8373,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8091
8373
|
*/
|
|
8092
8374
|
async placeMarketSell(params) {
|
|
8093
8375
|
const wallet = this.walletClient;
|
|
8094
|
-
const
|
|
8376
|
+
const account = await this.getSignerAccount();
|
|
8095
8377
|
const { request } = await this.publicClient.simulateContract({
|
|
8096
8378
|
address: this.config.diamondAddress,
|
|
8097
8379
|
abi: MarketOrdersFacet_default,
|
|
@@ -8137,8 +8419,8 @@ var TradeModule = class extends BaseModule {
|
|
|
8137
8419
|
* Preview a market sell order (simulate transaction)
|
|
8138
8420
|
*/
|
|
8139
8421
|
async previewMarketSell(params) {
|
|
8140
|
-
|
|
8141
|
-
const
|
|
8422
|
+
this.walletClient;
|
|
8423
|
+
const account = await this.getSignerAccount();
|
|
8142
8424
|
const { result } = await this.publicClient.simulateContract({
|
|
8143
8425
|
address: this.config.diamondAddress,
|
|
8144
8426
|
abi: MarketOrdersFacet_default,
|
|
@@ -8197,7 +8479,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8197
8479
|
*/
|
|
8198
8480
|
async matchOrders(params) {
|
|
8199
8481
|
const wallet = this.walletClient;
|
|
8200
|
-
const
|
|
8482
|
+
const account = await this.getSignerAccount();
|
|
8201
8483
|
const maxSteps = params.maxSteps || 10n;
|
|
8202
8484
|
const { request } = await this.publicClient.simulateContract({
|
|
8203
8485
|
address: this.config.diamondAddress,
|
|
@@ -8297,7 +8579,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8297
8579
|
*/
|
|
8298
8580
|
async splitPosition(marketId, amount) {
|
|
8299
8581
|
const wallet = this.walletClient;
|
|
8300
|
-
const
|
|
8582
|
+
const account = await this.getSignerAccount();
|
|
8301
8583
|
const { request } = await this.publicClient.simulateContract({
|
|
8302
8584
|
address: this.config.diamondAddress,
|
|
8303
8585
|
abi: VaultFacet_default,
|
|
@@ -8315,7 +8597,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8315
8597
|
*/
|
|
8316
8598
|
async mergePositions(marketId, amount) {
|
|
8317
8599
|
const wallet = this.walletClient;
|
|
8318
|
-
const
|
|
8600
|
+
const account = await this.getSignerAccount();
|
|
8319
8601
|
const { request } = await this.publicClient.simulateContract({
|
|
8320
8602
|
address: this.config.diamondAddress,
|
|
8321
8603
|
abi: VaultFacet_default,
|
|
@@ -8336,7 +8618,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8336
8618
|
*/
|
|
8337
8619
|
async batchPlaceOrders(params) {
|
|
8338
8620
|
const wallet = this.walletClient;
|
|
8339
|
-
const
|
|
8621
|
+
const account = await this.getSignerAccount();
|
|
8340
8622
|
const { request } = await this.publicClient.simulateContract({
|
|
8341
8623
|
address: this.config.diamondAddress,
|
|
8342
8624
|
abi: BatchOrdersFacet_default,
|
|
@@ -8377,7 +8659,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8377
8659
|
*/
|
|
8378
8660
|
async batchCancelOrders(orderIds) {
|
|
8379
8661
|
const wallet = this.walletClient;
|
|
8380
|
-
const
|
|
8662
|
+
const account = await this.getSignerAccount();
|
|
8381
8663
|
const { request } = await this.publicClient.simulateContract({
|
|
8382
8664
|
address: this.config.diamondAddress,
|
|
8383
8665
|
abi: BatchOrdersFacet_default,
|
|
@@ -8396,7 +8678,7 @@ var TradeModule = class extends BaseModule {
|
|
|
8396
8678
|
*/
|
|
8397
8679
|
async cancelAndReplace(params) {
|
|
8398
8680
|
const wallet = this.walletClient;
|
|
8399
|
-
const
|
|
8681
|
+
const account = await this.getSignerAccount();
|
|
8400
8682
|
const { request } = await this.publicClient.simulateContract({
|
|
8401
8683
|
address: this.config.diamondAddress,
|
|
8402
8684
|
abi: BatchOrdersFacet_default,
|
|
@@ -9921,7 +10203,7 @@ var TokenModule = class extends BaseModule {
|
|
|
9921
10203
|
*/
|
|
9922
10204
|
async mint(token, to, amount) {
|
|
9923
10205
|
const wallet = this.walletClient;
|
|
9924
|
-
const
|
|
10206
|
+
const account = await this.getSignerAccount();
|
|
9925
10207
|
const { request } = await this.publicClient.simulateContract({
|
|
9926
10208
|
address: token,
|
|
9927
10209
|
abi: ERC20_default,
|
|
@@ -9936,7 +10218,7 @@ var TokenModule = class extends BaseModule {
|
|
|
9936
10218
|
*/
|
|
9937
10219
|
async approve(token, spender, amount) {
|
|
9938
10220
|
const wallet = this.walletClient;
|
|
9939
|
-
const
|
|
10221
|
+
const account = await this.getSignerAccount();
|
|
9940
10222
|
const { request } = await this.publicClient.simulateContract({
|
|
9941
10223
|
address: token,
|
|
9942
10224
|
abi: ERC20_default,
|
|
@@ -9999,15 +10281,6 @@ var TokenModule = class extends BaseModule {
|
|
|
9999
10281
|
});
|
|
10000
10282
|
}
|
|
10001
10283
|
};
|
|
10002
|
-
var optimisticOracleV3Abi = [
|
|
10003
|
-
{
|
|
10004
|
-
inputs: [{ name: "currency", type: "address" }],
|
|
10005
|
-
name: "getMinimumBond",
|
|
10006
|
-
outputs: [{ name: "", type: "uint256" }],
|
|
10007
|
-
stateMutability: "view",
|
|
10008
|
-
type: "function"
|
|
10009
|
-
}
|
|
10010
|
-
];
|
|
10011
10284
|
var UmaModule = class extends BaseModule {
|
|
10012
10285
|
/**
|
|
10013
10286
|
* Assert an outcome for a market question
|
|
@@ -10020,7 +10293,8 @@ var UmaModule = class extends BaseModule {
|
|
|
10020
10293
|
*/
|
|
10021
10294
|
async assertMarketOutcome(params) {
|
|
10022
10295
|
const wallet = this.walletClient;
|
|
10023
|
-
const
|
|
10296
|
+
const account = await this.getSignerAccount();
|
|
10297
|
+
const accountAddress = await this.getSignerAddress();
|
|
10024
10298
|
const autoApprove = params.autoApprove ?? true;
|
|
10025
10299
|
const registryData = await this.publicClient.readContract({
|
|
10026
10300
|
address: this.config.diamondAddress,
|
|
@@ -10035,7 +10309,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10035
10309
|
address: currency,
|
|
10036
10310
|
abi: viem.erc20Abi,
|
|
10037
10311
|
functionName: "allowance",
|
|
10038
|
-
args: [
|
|
10312
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
10039
10313
|
});
|
|
10040
10314
|
if (currentAllowance < bondAmount && autoApprove) {
|
|
10041
10315
|
const approveHash = await wallet.writeContract({
|
|
@@ -10055,7 +10329,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10055
10329
|
address: currency,
|
|
10056
10330
|
abi: viem.erc20Abi,
|
|
10057
10331
|
functionName: "allowance",
|
|
10058
|
-
args: [
|
|
10332
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
10059
10333
|
});
|
|
10060
10334
|
if (newAllowance < bondAmount) {
|
|
10061
10335
|
throw new Error(
|
|
@@ -10071,7 +10345,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10071
10345
|
address: currency,
|
|
10072
10346
|
abi: viem.erc20Abi,
|
|
10073
10347
|
functionName: "balanceOf",
|
|
10074
|
-
args: [
|
|
10348
|
+
args: [accountAddress]
|
|
10075
10349
|
});
|
|
10076
10350
|
if (balance < bondAmount) {
|
|
10077
10351
|
throw new Error(
|
|
@@ -10107,7 +10381,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10107
10381
|
});
|
|
10108
10382
|
const minimumBond = await this.publicClient.readContract({
|
|
10109
10383
|
address: umaOracle,
|
|
10110
|
-
abi:
|
|
10384
|
+
abi: UmaOracle_default,
|
|
10111
10385
|
functionName: "getMinimumBond",
|
|
10112
10386
|
args: [currency]
|
|
10113
10387
|
});
|
|
@@ -10119,7 +10393,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10119
10393
|
*/
|
|
10120
10394
|
async settleAssertion(assertionId) {
|
|
10121
10395
|
const wallet = this.walletClient;
|
|
10122
|
-
const
|
|
10396
|
+
const account = await this.getSignerAccount();
|
|
10123
10397
|
const { request } = await this.publicClient.simulateContract({
|
|
10124
10398
|
address: this.config.diamondAddress,
|
|
10125
10399
|
abi: ResolutionFacet_default,
|
|
@@ -10134,7 +10408,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10134
10408
|
*/
|
|
10135
10409
|
async reportResolution(params) {
|
|
10136
10410
|
const wallet = this.walletClient;
|
|
10137
|
-
const
|
|
10411
|
+
const account = await this.getSignerAccount();
|
|
10138
10412
|
const { request } = await this.publicClient.simulateContract({
|
|
10139
10413
|
address: this.config.diamondAddress,
|
|
10140
10414
|
abi: ResolutionFacet_default,
|
|
@@ -10201,7 +10475,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10201
10475
|
*/
|
|
10202
10476
|
async redeemWinnings(marketId) {
|
|
10203
10477
|
const wallet = this.walletClient;
|
|
10204
|
-
const
|
|
10478
|
+
const account = await this.getSignerAccount();
|
|
10205
10479
|
const oracleData = await this.publicClient.readContract({
|
|
10206
10480
|
address: this.config.diamondAddress,
|
|
10207
10481
|
abi: MarketsFacet_default,
|
|
@@ -10448,7 +10722,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10448
10722
|
*/
|
|
10449
10723
|
async deployWhitelist() {
|
|
10450
10724
|
const wallet = this.walletClient;
|
|
10451
|
-
const
|
|
10725
|
+
const account = await this.getSignerAccount();
|
|
10452
10726
|
const { request } = await this.publicClient.simulateContract({
|
|
10453
10727
|
address: this.config.diamondAddress,
|
|
10454
10728
|
abi: AccessControlFacet_default,
|
|
@@ -10466,7 +10740,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10466
10740
|
*/
|
|
10467
10741
|
async deployNFTGated(params) {
|
|
10468
10742
|
const wallet = this.walletClient;
|
|
10469
|
-
const
|
|
10743
|
+
const account = await this.getSignerAccount();
|
|
10470
10744
|
const { request } = await this.publicClient.simulateContract({
|
|
10471
10745
|
address: this.config.diamondAddress,
|
|
10472
10746
|
abi: AccessControlFacet_default,
|
|
@@ -10483,7 +10757,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10483
10757
|
*/
|
|
10484
10758
|
async deployTokenGated(params) {
|
|
10485
10759
|
const wallet = this.walletClient;
|
|
10486
|
-
const
|
|
10760
|
+
const account = await this.getSignerAccount();
|
|
10487
10761
|
const { request } = await this.publicClient.simulateContract({
|
|
10488
10762
|
address: this.config.diamondAddress,
|
|
10489
10763
|
abi: AccessControlFacet_default,
|
|
@@ -10499,7 +10773,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10499
10773
|
*/
|
|
10500
10774
|
async setMarketTradingAC(params) {
|
|
10501
10775
|
const wallet = this.walletClient;
|
|
10502
|
-
const
|
|
10776
|
+
const account = await this.getSignerAccount();
|
|
10503
10777
|
const { request } = await this.publicClient.simulateContract({
|
|
10504
10778
|
address: this.config.diamondAddress,
|
|
10505
10779
|
abi: AccessControlFacet_default,
|
|
@@ -10514,7 +10788,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10514
10788
|
*/
|
|
10515
10789
|
async removeMarketTradingAC(params) {
|
|
10516
10790
|
const wallet = this.walletClient;
|
|
10517
|
-
const
|
|
10791
|
+
const account = await this.getSignerAccount();
|
|
10518
10792
|
const { request } = await this.publicClient.simulateContract({
|
|
10519
10793
|
address: this.config.diamondAddress,
|
|
10520
10794
|
abi: AccessControlFacet_default,
|
|
@@ -10553,7 +10827,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10553
10827
|
*/
|
|
10554
10828
|
async addToWhitelist(params) {
|
|
10555
10829
|
const wallet = this.walletClient;
|
|
10556
|
-
const
|
|
10830
|
+
const account = await this.getSignerAccount();
|
|
10557
10831
|
const { request } = await this.publicClient.simulateContract({
|
|
10558
10832
|
address: params.acContract,
|
|
10559
10833
|
abi: WhitelistAccessControl_default,
|
|
@@ -10568,7 +10842,7 @@ var AccessControlModule = class extends BaseModule {
|
|
|
10568
10842
|
*/
|
|
10569
10843
|
async removeFromWhitelist(params) {
|
|
10570
10844
|
const wallet = this.walletClient;
|
|
10571
|
-
const
|
|
10845
|
+
const account = await this.getSignerAccount();
|
|
10572
10846
|
const { request } = await this.publicClient.simulateContract({
|
|
10573
10847
|
address: params.acContract,
|
|
10574
10848
|
abi: WhitelistAccessControl_default,
|
|
@@ -10630,10 +10904,10 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10630
10904
|
*/
|
|
10631
10905
|
async createPyth(params) {
|
|
10632
10906
|
const wallet = this.walletClient;
|
|
10633
|
-
const
|
|
10907
|
+
const account = await this.getSignerAccount();
|
|
10634
10908
|
const outcomes = params.outcomes ?? ["Up", "Down"];
|
|
10635
10909
|
const isStrikeMarket = params.strikePrice && params.strikePrice > BigInt(0);
|
|
10636
|
-
const { encodedTags, ancillaryData } = await this._prepareCreationCommon(params,
|
|
10910
|
+
const { encodedTags, ancillaryData } = await this._prepareCreationCommon(params, await this.getSignerAddress());
|
|
10637
10911
|
if (!isValidTickSize(params.tickSize)) {
|
|
10638
10912
|
throw new Error("Invalid tickSize: must be 1e15 (0.1%) or 1e16 (1%)");
|
|
10639
10913
|
}
|
|
@@ -10676,7 +10950,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10676
10950
|
*/
|
|
10677
10951
|
async resolvePyth(marketId) {
|
|
10678
10952
|
const wallet = this.walletClient;
|
|
10679
|
-
const
|
|
10953
|
+
const account = await this.getSignerAccount();
|
|
10680
10954
|
const pm = await this.get(marketId);
|
|
10681
10955
|
if (pm.resolved) {
|
|
10682
10956
|
throw new Error("Price market already resolved");
|
|
@@ -10769,7 +11043,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10769
11043
|
*/
|
|
10770
11044
|
async setPythContract(pythContract) {
|
|
10771
11045
|
const wallet = this.walletClient;
|
|
10772
|
-
const
|
|
11046
|
+
const account = await this.getSignerAccount();
|
|
10773
11047
|
const { request } = await this.publicClient.simulateContract({
|
|
10774
11048
|
address: this.config.diamondAddress,
|
|
10775
11049
|
abi: PythResolutionFacet_default,
|
|
@@ -10799,7 +11073,7 @@ var PriceMarketModule = class extends BaseModule {
|
|
|
10799
11073
|
*/
|
|
10800
11074
|
async setOpenMaxStaleness(openMaxStaleness) {
|
|
10801
11075
|
const wallet = this.walletClient;
|
|
10802
|
-
const
|
|
11076
|
+
const account = await this.getSignerAccount();
|
|
10803
11077
|
const { request } = await this.publicClient.simulateContract({
|
|
10804
11078
|
address: this.config.diamondAddress,
|
|
10805
11079
|
abi: PythResolutionFacet_default,
|
|
@@ -11104,6 +11378,7 @@ exports.TokenModule = TokenModule;
|
|
|
11104
11378
|
exports.TradeModule = TradeModule;
|
|
11105
11379
|
exports.UMA_DEFAULTS = UMA_DEFAULTS;
|
|
11106
11380
|
exports.UmaModule = UmaModule;
|
|
11381
|
+
exports.UmaOracleABI = UmaOracle_default;
|
|
11107
11382
|
exports.VALID_TICK_SIZES = VALID_TICK_SIZES;
|
|
11108
11383
|
exports.VaultFacetABI = VaultFacet_default;
|
|
11109
11384
|
exports.VenueFacetABI = VenueFacet_default;
|