@oddmaki-protocol/sdk 0.5.1 → 1.0.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 +284 -24
- package/dist/index.d.ts +284 -24
- package/dist/index.js +282 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +283 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -7,13 +7,19 @@ 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
|
+
},
|
|
15
|
+
[chains.base.id]: {
|
|
16
|
+
diamond: "0x025d086a62d93e24f3cb3f161612ca8e9530127d",
|
|
17
|
+
conditionalTokens: "0x3e2ae408ca03f27849edff32d107c7b8ea5c87b4",
|
|
18
|
+
usdc: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
19
|
+
subgraph: "https://api.studio.thegraph.com/query/1716020/oddmaki-base/version/latest"
|
|
14
20
|
}
|
|
15
21
|
};
|
|
16
|
-
var DEFAULT_CHAIN = chains.
|
|
22
|
+
var DEFAULT_CHAIN = chains.base;
|
|
17
23
|
var SubgraphClient = class {
|
|
18
24
|
constructor(endpoint) {
|
|
19
25
|
this.client = new graphqlRequest.GraphQLClient(endpoint);
|
|
@@ -6824,6 +6830,260 @@ var ERC20_default = [
|
|
|
6824
6830
|
}
|
|
6825
6831
|
];
|
|
6826
6832
|
|
|
6833
|
+
// src/contracts/abis/UmaOracle.json
|
|
6834
|
+
var UmaOracle_default = [
|
|
6835
|
+
{
|
|
6836
|
+
type: "function",
|
|
6837
|
+
name: "assertTruth",
|
|
6838
|
+
inputs: [
|
|
6839
|
+
{
|
|
6840
|
+
name: "claim",
|
|
6841
|
+
type: "bytes",
|
|
6842
|
+
internalType: "bytes"
|
|
6843
|
+
},
|
|
6844
|
+
{
|
|
6845
|
+
name: "asserter",
|
|
6846
|
+
type: "address",
|
|
6847
|
+
internalType: "address"
|
|
6848
|
+
},
|
|
6849
|
+
{
|
|
6850
|
+
name: "callbackRecipient",
|
|
6851
|
+
type: "address",
|
|
6852
|
+
internalType: "address"
|
|
6853
|
+
},
|
|
6854
|
+
{
|
|
6855
|
+
name: "escalationManager",
|
|
6856
|
+
type: "address",
|
|
6857
|
+
internalType: "address"
|
|
6858
|
+
},
|
|
6859
|
+
{
|
|
6860
|
+
name: "liveness",
|
|
6861
|
+
type: "uint64",
|
|
6862
|
+
internalType: "uint64"
|
|
6863
|
+
},
|
|
6864
|
+
{
|
|
6865
|
+
name: "currency",
|
|
6866
|
+
type: "address",
|
|
6867
|
+
internalType: "contract IERC20"
|
|
6868
|
+
},
|
|
6869
|
+
{
|
|
6870
|
+
name: "bond",
|
|
6871
|
+
type: "uint256",
|
|
6872
|
+
internalType: "uint256"
|
|
6873
|
+
},
|
|
6874
|
+
{
|
|
6875
|
+
name: "identifier",
|
|
6876
|
+
type: "bytes32",
|
|
6877
|
+
internalType: "bytes32"
|
|
6878
|
+
},
|
|
6879
|
+
{
|
|
6880
|
+
name: "domainId",
|
|
6881
|
+
type: "bytes32",
|
|
6882
|
+
internalType: "bytes32"
|
|
6883
|
+
}
|
|
6884
|
+
],
|
|
6885
|
+
outputs: [
|
|
6886
|
+
{
|
|
6887
|
+
name: "",
|
|
6888
|
+
type: "bytes32",
|
|
6889
|
+
internalType: "bytes32"
|
|
6890
|
+
}
|
|
6891
|
+
],
|
|
6892
|
+
stateMutability: "nonpayable"
|
|
6893
|
+
},
|
|
6894
|
+
{
|
|
6895
|
+
type: "function",
|
|
6896
|
+
name: "defaultIdentifier",
|
|
6897
|
+
inputs: [],
|
|
6898
|
+
outputs: [
|
|
6899
|
+
{
|
|
6900
|
+
name: "",
|
|
6901
|
+
type: "bytes32",
|
|
6902
|
+
internalType: "bytes32"
|
|
6903
|
+
}
|
|
6904
|
+
],
|
|
6905
|
+
stateMutability: "view"
|
|
6906
|
+
},
|
|
6907
|
+
{
|
|
6908
|
+
type: "function",
|
|
6909
|
+
name: "getAssertion",
|
|
6910
|
+
inputs: [
|
|
6911
|
+
{
|
|
6912
|
+
name: "assertionId",
|
|
6913
|
+
type: "bytes32",
|
|
6914
|
+
internalType: "bytes32"
|
|
6915
|
+
}
|
|
6916
|
+
],
|
|
6917
|
+
outputs: [
|
|
6918
|
+
{
|
|
6919
|
+
name: "",
|
|
6920
|
+
type: "tuple",
|
|
6921
|
+
internalType: "struct OptimisticOracleV3Interface.Assertion",
|
|
6922
|
+
components: [
|
|
6923
|
+
{
|
|
6924
|
+
name: "escalationManagerSettings",
|
|
6925
|
+
type: "tuple",
|
|
6926
|
+
internalType: "struct OptimisticOracleV3Interface.EscalationManagerSettings",
|
|
6927
|
+
components: [
|
|
6928
|
+
{
|
|
6929
|
+
name: "arbitrateViaEscalationManager",
|
|
6930
|
+
type: "bool",
|
|
6931
|
+
internalType: "bool"
|
|
6932
|
+
},
|
|
6933
|
+
{
|
|
6934
|
+
name: "discardOracle",
|
|
6935
|
+
type: "bool",
|
|
6936
|
+
internalType: "bool"
|
|
6937
|
+
},
|
|
6938
|
+
{
|
|
6939
|
+
name: "validateDisputers",
|
|
6940
|
+
type: "bool",
|
|
6941
|
+
internalType: "bool"
|
|
6942
|
+
},
|
|
6943
|
+
{
|
|
6944
|
+
name: "assertingCaller",
|
|
6945
|
+
type: "address",
|
|
6946
|
+
internalType: "address"
|
|
6947
|
+
},
|
|
6948
|
+
{
|
|
6949
|
+
name: "escalationManager",
|
|
6950
|
+
type: "address",
|
|
6951
|
+
internalType: "address"
|
|
6952
|
+
}
|
|
6953
|
+
]
|
|
6954
|
+
},
|
|
6955
|
+
{
|
|
6956
|
+
name: "asserter",
|
|
6957
|
+
type: "address",
|
|
6958
|
+
internalType: "address"
|
|
6959
|
+
},
|
|
6960
|
+
{
|
|
6961
|
+
name: "assertionTime",
|
|
6962
|
+
type: "uint64",
|
|
6963
|
+
internalType: "uint64"
|
|
6964
|
+
},
|
|
6965
|
+
{
|
|
6966
|
+
name: "settled",
|
|
6967
|
+
type: "bool",
|
|
6968
|
+
internalType: "bool"
|
|
6969
|
+
},
|
|
6970
|
+
{
|
|
6971
|
+
name: "currency",
|
|
6972
|
+
type: "address",
|
|
6973
|
+
internalType: "contract IERC20"
|
|
6974
|
+
},
|
|
6975
|
+
{
|
|
6976
|
+
name: "expirationTime",
|
|
6977
|
+
type: "uint64",
|
|
6978
|
+
internalType: "uint64"
|
|
6979
|
+
},
|
|
6980
|
+
{
|
|
6981
|
+
name: "settlementResolution",
|
|
6982
|
+
type: "bool",
|
|
6983
|
+
internalType: "bool"
|
|
6984
|
+
},
|
|
6985
|
+
{
|
|
6986
|
+
name: "domainId",
|
|
6987
|
+
type: "bytes32",
|
|
6988
|
+
internalType: "bytes32"
|
|
6989
|
+
},
|
|
6990
|
+
{
|
|
6991
|
+
name: "identifier",
|
|
6992
|
+
type: "bytes32",
|
|
6993
|
+
internalType: "bytes32"
|
|
6994
|
+
},
|
|
6995
|
+
{
|
|
6996
|
+
name: "bond",
|
|
6997
|
+
type: "uint256",
|
|
6998
|
+
internalType: "uint256"
|
|
6999
|
+
},
|
|
7000
|
+
{
|
|
7001
|
+
name: "callbackRecipient",
|
|
7002
|
+
type: "address",
|
|
7003
|
+
internalType: "address"
|
|
7004
|
+
},
|
|
7005
|
+
{
|
|
7006
|
+
name: "disputer",
|
|
7007
|
+
type: "address",
|
|
7008
|
+
internalType: "address"
|
|
7009
|
+
}
|
|
7010
|
+
]
|
|
7011
|
+
}
|
|
7012
|
+
],
|
|
7013
|
+
stateMutability: "view"
|
|
7014
|
+
},
|
|
7015
|
+
{
|
|
7016
|
+
type: "function",
|
|
7017
|
+
name: "getAssertionResult",
|
|
7018
|
+
inputs: [
|
|
7019
|
+
{
|
|
7020
|
+
name: "assertionId",
|
|
7021
|
+
type: "bytes32",
|
|
7022
|
+
internalType: "bytes32"
|
|
7023
|
+
}
|
|
7024
|
+
],
|
|
7025
|
+
outputs: [
|
|
7026
|
+
{
|
|
7027
|
+
name: "",
|
|
7028
|
+
type: "bool",
|
|
7029
|
+
internalType: "bool"
|
|
7030
|
+
}
|
|
7031
|
+
],
|
|
7032
|
+
stateMutability: "view"
|
|
7033
|
+
},
|
|
7034
|
+
{
|
|
7035
|
+
type: "function",
|
|
7036
|
+
name: "getMinimumBond",
|
|
7037
|
+
inputs: [
|
|
7038
|
+
{
|
|
7039
|
+
name: "currency",
|
|
7040
|
+
type: "address",
|
|
7041
|
+
internalType: "address"
|
|
7042
|
+
}
|
|
7043
|
+
],
|
|
7044
|
+
outputs: [
|
|
7045
|
+
{
|
|
7046
|
+
name: "",
|
|
7047
|
+
type: "uint256",
|
|
7048
|
+
internalType: "uint256"
|
|
7049
|
+
}
|
|
7050
|
+
],
|
|
7051
|
+
stateMutability: "view"
|
|
7052
|
+
},
|
|
7053
|
+
{
|
|
7054
|
+
type: "function",
|
|
7055
|
+
name: "isSettled",
|
|
7056
|
+
inputs: [
|
|
7057
|
+
{
|
|
7058
|
+
name: "assertionId",
|
|
7059
|
+
type: "bytes32",
|
|
7060
|
+
internalType: "bytes32"
|
|
7061
|
+
}
|
|
7062
|
+
],
|
|
7063
|
+
outputs: [
|
|
7064
|
+
{
|
|
7065
|
+
name: "settled",
|
|
7066
|
+
type: "bool",
|
|
7067
|
+
internalType: "bool"
|
|
7068
|
+
}
|
|
7069
|
+
],
|
|
7070
|
+
stateMutability: "view"
|
|
7071
|
+
},
|
|
7072
|
+
{
|
|
7073
|
+
type: "function",
|
|
7074
|
+
name: "settleAssertion",
|
|
7075
|
+
inputs: [
|
|
7076
|
+
{
|
|
7077
|
+
name: "assertionId",
|
|
7078
|
+
type: "bytes32",
|
|
7079
|
+
internalType: "bytes32"
|
|
7080
|
+
}
|
|
7081
|
+
],
|
|
7082
|
+
outputs: [],
|
|
7083
|
+
stateMutability: "nonpayable"
|
|
7084
|
+
}
|
|
7085
|
+
];
|
|
7086
|
+
|
|
6827
7087
|
// src/modules/venue.ts
|
|
6828
7088
|
var VenueModule = class extends BaseModule {
|
|
6829
7089
|
/**
|
|
@@ -7221,6 +7481,18 @@ function clearDecimalsCache() {
|
|
|
7221
7481
|
}
|
|
7222
7482
|
|
|
7223
7483
|
// src/modules/market.ts
|
|
7484
|
+
var CTF_IS_APPROVED_FOR_ALL_ABI = [
|
|
7485
|
+
{
|
|
7486
|
+
name: "isApprovedForAll",
|
|
7487
|
+
type: "function",
|
|
7488
|
+
stateMutability: "view",
|
|
7489
|
+
inputs: [
|
|
7490
|
+
{ name: "account", type: "address" },
|
|
7491
|
+
{ name: "operator", type: "address" }
|
|
7492
|
+
],
|
|
7493
|
+
outputs: [{ name: "", type: "bool" }]
|
|
7494
|
+
}
|
|
7495
|
+
];
|
|
7224
7496
|
var MarketModule = class extends BaseModule {
|
|
7225
7497
|
/**
|
|
7226
7498
|
* Format market question into UMA-compliant ancillary data
|
|
@@ -7651,11 +7923,12 @@ var MarketModule = class extends BaseModule {
|
|
|
7651
7923
|
async convertPositions(params) {
|
|
7652
7924
|
const wallet = this.walletClient;
|
|
7653
7925
|
const account = await this.getSignerAccount();
|
|
7926
|
+
const accountAddress = await this.getSignerAddress();
|
|
7654
7927
|
const isApproved = await this.publicClient.readContract({
|
|
7655
7928
|
address: this.config.conditionalTokensAddress,
|
|
7656
|
-
abi:
|
|
7929
|
+
abi: CTF_IS_APPROVED_FOR_ALL_ABI,
|
|
7657
7930
|
functionName: "isApprovedForAll",
|
|
7658
|
-
args: [
|
|
7931
|
+
args: [accountAddress, this.config.diamondAddress]
|
|
7659
7932
|
});
|
|
7660
7933
|
if (!isApproved) {
|
|
7661
7934
|
throw new Error(
|
|
@@ -10014,15 +10287,6 @@ var TokenModule = class extends BaseModule {
|
|
|
10014
10287
|
});
|
|
10015
10288
|
}
|
|
10016
10289
|
};
|
|
10017
|
-
var optimisticOracleV3Abi = [
|
|
10018
|
-
{
|
|
10019
|
-
inputs: [{ name: "currency", type: "address" }],
|
|
10020
|
-
name: "getMinimumBond",
|
|
10021
|
-
outputs: [{ name: "", type: "uint256" }],
|
|
10022
|
-
stateMutability: "view",
|
|
10023
|
-
type: "function"
|
|
10024
|
-
}
|
|
10025
|
-
];
|
|
10026
10290
|
var UmaModule = class extends BaseModule {
|
|
10027
10291
|
/**
|
|
10028
10292
|
* Assert an outcome for a market question
|
|
@@ -10123,7 +10387,7 @@ var UmaModule = class extends BaseModule {
|
|
|
10123
10387
|
});
|
|
10124
10388
|
const minimumBond = await this.publicClient.readContract({
|
|
10125
10389
|
address: umaOracle,
|
|
10126
|
-
abi:
|
|
10390
|
+
abi: UmaOracle_default,
|
|
10127
10391
|
functionName: "getMinimumBond",
|
|
10128
10392
|
args: [currency]
|
|
10129
10393
|
});
|
|
@@ -11038,8 +11302,8 @@ function resolveIPFSUri(uri, gateway) {
|
|
|
11038
11302
|
if (!uri) return "";
|
|
11039
11303
|
const gw = gateway || DEFAULT_IPFS_GATEWAY;
|
|
11040
11304
|
if (uri.startsWith("ipfs://")) {
|
|
11041
|
-
const
|
|
11042
|
-
const gateway2 =
|
|
11305
|
+
const base2 = gw.endsWith("/") ? gw : `${gw}/`;
|
|
11306
|
+
const gateway2 = base2.includes("/ipfs/") ? base2 : `${base2}ipfs/`;
|
|
11043
11307
|
return `${gateway2}${uri.slice(7)}`;
|
|
11044
11308
|
}
|
|
11045
11309
|
return uri;
|
|
@@ -11120,6 +11384,7 @@ exports.TokenModule = TokenModule;
|
|
|
11120
11384
|
exports.TradeModule = TradeModule;
|
|
11121
11385
|
exports.UMA_DEFAULTS = UMA_DEFAULTS;
|
|
11122
11386
|
exports.UmaModule = UmaModule;
|
|
11387
|
+
exports.UmaOracleABI = UmaOracle_default;
|
|
11123
11388
|
exports.VALID_TICK_SIZES = VALID_TICK_SIZES;
|
|
11124
11389
|
exports.VaultFacetABI = VaultFacet_default;
|
|
11125
11390
|
exports.VenueFacetABI = VenueFacet_default;
|