@superfluid-finance/sdk-core 0.5.7 → 0.5.8-dev.4039438.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/CHANGELOG.md +3 -1
- package/dist/index.umd.js +33 -7
- package/dist/main/Operation.d.ts +3 -2
- package/dist/main/Operation.d.ts.map +1 -1
- package/dist/main/Operation.js +19 -4
- package/dist/main/Operation.js.map +1 -1
- package/dist/main/defaultSubgraphReleaseTag.json +1 -1
- package/dist/module/Operation.d.ts +3 -2
- package/dist/module/Operation.d.ts.map +1 -1
- package/dist/module/Operation.js +19 -4
- package/dist/module/Operation.js.map +1 -1
- package/dist/module/defaultSubgraphReleaseTag.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
26
26
|
## [0.5.5] - 2022-08-31
|
|
27
27
|
### Added
|
|
28
28
|
- Support for: `optimism-goerli` and `arbitrum-goerli` added
|
|
29
|
+
|
|
29
30
|
### Breaking
|
|
30
31
|
- Support for: `rinkeby`, `ropsten`, `kovan`, `optimism-kovan` and `arbitrum-rinkeby` removed
|
|
31
32
|
- Don't throw `SFError` when executing `Operation` or `BatchCall`; let the original error bubble up
|
|
@@ -33,6 +34,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
33
34
|
### Fixes
|
|
34
35
|
- Serialize a much smaller version of the cause in `SFError` (only `name`, `message`, `code`)
|
|
35
36
|
- Change `SFError.name` from "Error" to "SFError"
|
|
37
|
+
|
|
36
38
|
# [0.5.4] - 2022-08-19
|
|
37
39
|
|
|
38
40
|
### Fixes
|
|
@@ -234,7 +236,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
234
236
|
- New `BatchCall` class for creating and executing batch calls with supported `Operation's`
|
|
235
237
|
|
|
236
238
|
[Unreleased]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.5.7...HEAD
|
|
237
|
-
[0.5.
|
|
239
|
+
[0.5.6]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.5.6...sdk-core%40v0.5.7
|
|
238
240
|
[0.5.6]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.5.5...sdk-core%40v0.5.6
|
|
239
241
|
[0.5.5]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.5.4...sdk-core%40v0.5.5
|
|
240
242
|
[0.5.4]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.5.3...sdk-core%40v0.5.4
|
package/dist/index.umd.js
CHANGED
|
@@ -18937,6 +18937,7 @@ module.exports =
|
|
|
18937
18937
|
"host": "0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9",
|
|
18938
18938
|
"governance": "0x3a648764a6d66440ca096343937c711a7ac1b1e9",
|
|
18939
18939
|
"cfaV1": "0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8",
|
|
18940
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
18940
18941
|
"idaV1": "0xfDdcdac21D64B639546f3Ce2868C7EF06036990c",
|
|
18941
18942
|
"superTokenFactory": "0x94f26B4c8AD12B18c12f38E878618f7664bdcCE2",
|
|
18942
18943
|
"superfluidLoader": "0x74d860243Ff08A243d5485899f343117EbDa6eA8",
|
|
@@ -18963,6 +18964,7 @@ module.exports =
|
|
|
18963
18964
|
"host": "0xEB796bdb90fFA0f28255275e16936D25d3418603",
|
|
18964
18965
|
"governance": "0x2637eA93EE5cd887ff9AC98185eA67Bd70C5f62e",
|
|
18965
18966
|
"cfaV1": "0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873",
|
|
18967
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
18966
18968
|
"idaV1": "0x804348D4960a61f2d5F9ce9103027A3E849E09b8",
|
|
18967
18969
|
"superTokenFactory": "0x200657E2f123761662567A1744f9ACAe50dF47E6",
|
|
18968
18970
|
"superfluidLoader": "0x0d56ED56b63382B0FC964490feB9AE438B6B4b79"
|
|
@@ -18988,13 +18990,14 @@ module.exports =
|
|
|
18988
18990
|
"host": "0xE40983C2476032A0915600b9472B3141aA5B5Ba9",
|
|
18989
18991
|
"governance": "0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f",
|
|
18990
18992
|
"cfaV1": "0xff48668fa670A85e55A7a822b352d5ccF3E7b18C",
|
|
18993
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
18991
18994
|
"idaV1": "0x96215257F2FcbB00135578f766c0449d239bd92F",
|
|
18992
18995
|
"superTokenFactory": "0x9aCc39d15e3f168c111a1D4F80271a9E526c9a9F",
|
|
18993
18996
|
"superfluidLoader": "0x5Bb5908dcCC9Bb0fC39a78CfDf9e47B4C08E9521"
|
|
18994
18997
|
},
|
|
18995
18998
|
"startBlockV1": 340000,
|
|
18996
18999
|
"logsQueryRange": 50000,
|
|
18997
|
-
"explorer": "https://
|
|
19000
|
+
"explorer": "https://goerli-optimism.etherscan.io",
|
|
18998
19001
|
"subgraphV1": {
|
|
18999
19002
|
"name": "protocol-v1-optimism-goerli",
|
|
19000
19003
|
"hostedEndpoint": "https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-optimism-goerli"
|
|
@@ -19013,6 +19016,7 @@ module.exports =
|
|
|
19013
19016
|
"host": "0xE40983C2476032A0915600b9472B3141aA5B5Ba9",
|
|
19014
19017
|
"governance": "0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f",
|
|
19015
19018
|
"cfaV1": "0xff48668fa670A85e55A7a822b352d5ccF3E7b18C",
|
|
19019
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
19016
19020
|
"idaV1": "0x96215257F2FcbB00135578f766c0449d239bd92F",
|
|
19017
19021
|
"superTokenFactory": "0x9aCc39d15e3f168c111a1D4F80271a9E526c9a9F",
|
|
19018
19022
|
"superfluidLoader": "0x5Bb5908dcCC9Bb0fC39a78CfDf9e47B4C08E9521"
|
|
@@ -19022,7 +19026,7 @@ module.exports =
|
|
|
19022
19026
|
"explorer": "https://goerli-rollup-explorer.arbitrum.io",
|
|
19023
19027
|
"subgraphV1": {
|
|
19024
19028
|
"name": "protocol-v1-arbitrum-goerli",
|
|
19025
|
-
"hostedEndpoint": "https://
|
|
19029
|
+
"hostedEndpoint": "https://subgraph.satsuma.xyz/superfluid/arbitrum-goerli/api"
|
|
19026
19030
|
}
|
|
19027
19031
|
},
|
|
19028
19032
|
{
|
|
@@ -19038,6 +19042,7 @@ module.exports =
|
|
|
19038
19042
|
"host": "0xf04F2C525819691ed9ABD3D2B7109E1633795e68",
|
|
19039
19043
|
"governance": "0xe4bbA294E0F7C4a83a105F7fe2CeCf4D7Bd8B3c0",
|
|
19040
19044
|
"cfaV1": "0xED74d30B8034152b0638CB03cc5c3c906dd1c482",
|
|
19045
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
19041
19046
|
"idaV1": "0x997d745884F54a93E6662b055c5e6c09F688718b",
|
|
19042
19047
|
"superTokenFactory": "0xA25dbEa94C5824892006b30a629213E7Bf238624",
|
|
19043
19048
|
"superfluidLoader": "0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f"
|
|
@@ -19063,6 +19068,7 @@ module.exports =
|
|
|
19063
19068
|
"host": "0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7",
|
|
19064
19069
|
"governance": "0xaCc7380323681fdb8a0B9F2FE7d69dDFf0664478",
|
|
19065
19070
|
"cfaV1": "0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D",
|
|
19071
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
19066
19072
|
"idaV1": "0x7888ac96F987Eb10E291F34851ae0266eF912081",
|
|
19067
19073
|
"superTokenFactory": "0x23410e2659380784498509698ed70E414D384880",
|
|
19068
19074
|
"superfluidLoader": "0x21d4E9fbB9DB742E6ef4f29d189a7C18B0b59136",
|
|
@@ -19090,6 +19096,7 @@ module.exports =
|
|
|
19090
19096
|
"host": "0x3E14dC1b13c488a8d5D310918780c983bD5982E7",
|
|
19091
19097
|
"governance": "0x3AD3f7A0965Ce6f9358AD5CCE86Bc2b05F1EE087",
|
|
19092
19098
|
"cfaV1": "0x6EeE6060f715257b970700bc2656De21dEdF074C",
|
|
19099
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
19093
19100
|
"idaV1": "0xB0aABBA4B2783A72C52956CDEF62d438ecA2d7a1",
|
|
19094
19101
|
"superTokenFactory": "0x2C90719f25B10Fc5646c82DA3240C76Fa5BcCF34",
|
|
19095
19102
|
"superfluidLoader": "0x15F0Ca26781C3852f8166eD2ebce5D18265cceb7",
|
|
@@ -19117,6 +19124,7 @@ module.exports =
|
|
|
19117
19124
|
"host": "0x567c4B141ED61923967cA25Ef4906C8781069a10",
|
|
19118
19125
|
"governance": "0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D",
|
|
19119
19126
|
"cfaV1": "0x204C6f131bb7F258b2Ea1593f5309911d8E458eD",
|
|
19127
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
19120
19128
|
"idaV1": "0xc4ce5118C3B20950ee288f086cb7FC166d222D4c",
|
|
19121
19129
|
"superTokenFactory": "0x8276469A443D5C6B7146BED45e2abCaD3B6adad9",
|
|
19122
19130
|
"superfluidLoader": "0x8E310ce29Ab7Fa2878944A65BB0eaF97B1853d40",
|
|
@@ -19144,6 +19152,7 @@ module.exports =
|
|
|
19144
19152
|
"host": "0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192",
|
|
19145
19153
|
"governance": "0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D",
|
|
19146
19154
|
"cfaV1": "0x731FdBB12944973B500518aea61942381d7e240D",
|
|
19155
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
19147
19156
|
"idaV1": "0x2319C7e07EB063340D2a0E36709B0D65fda75986",
|
|
19148
19157
|
"superTokenFactory": "0x1C21Ead77fd45C84a4c916Db7A6635D0C6FF09D6",
|
|
19149
19158
|
"superfluidLoader": "0xB99cA401e10D277345BcFb281AC148a2e16Db466",
|
|
@@ -19171,6 +19180,7 @@ module.exports =
|
|
|
19171
19180
|
"host": "0x60377C7016E4cdB03C87EF474896C11cB560752C",
|
|
19172
19181
|
"governance": "0xF74390BabA510ec2fE196c2e02B037380d7a6F12",
|
|
19173
19182
|
"cfaV1": "0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58",
|
|
19183
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
19174
19184
|
"idaV1": "0x1fA9fFe8Db73F701454B195151Db4Abb18423cf2",
|
|
19175
19185
|
"superTokenFactory": "0x464AADdBB2B80f3Cb666522EB7381bE610F638b4",
|
|
19176
19186
|
"superfluidLoader": "0x2601E69a2D16C8Ccc8aEe8cE9F59d24a59986B9E",
|
|
@@ -19198,6 +19208,7 @@ module.exports =
|
|
|
19198
19208
|
"host": "0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E",
|
|
19199
19209
|
"governance": "0xee07D9fce4Cf2a891BC979E9d365929506C2982f",
|
|
19200
19210
|
"cfaV1": "0x49c38108870e74Cb9420C0991a85D3edd6363F75",
|
|
19211
|
+
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
|
|
19201
19212
|
"idaV1": "0x594ed9Cd773584B645aC1F5B11020d3b32cDF07d",
|
|
19202
19213
|
"superTokenFactory": "0x8bde47397301F0Cd31b9000032fD517a39c946Eb",
|
|
19203
19214
|
"superfluidLoader": "0x3C26e5bEbc68EaAf4efcd88F8E5A6Aeb77b65579",
|
|
@@ -108180,10 +108191,11 @@ class Operation {
|
|
|
108180
108191
|
* Executes the operation via the provided signer.
|
|
108181
108192
|
* @description Populates all fields of the transaction, signs it and sends it to the network.
|
|
108182
108193
|
* @param signer The signer of the transaction
|
|
108194
|
+
* @param gasLimitMultiplier A multiplier to provide gasLimit buffer on top of the estimated gas limit (1.2x is the default)
|
|
108183
108195
|
* @returns {ethers.providers.TransactionResponse} A TransactionResponse object which can be awaited
|
|
108184
108196
|
*/
|
|
108185
|
-
this.exec = async (signer) => {
|
|
108186
|
-
const populatedTransaction = await this.getPopulatedTransactionRequest(signer);
|
|
108197
|
+
this.exec = async (signer, gasLimitMultiplier = 1.2) => {
|
|
108198
|
+
const populatedTransaction = await this.getPopulatedTransactionRequest(signer, gasLimitMultiplier);
|
|
108187
108199
|
return await signer.sendTransaction(populatedTransaction);
|
|
108188
108200
|
};
|
|
108189
108201
|
/**
|
|
@@ -108192,11 +108204,25 @@ class Operation {
|
|
|
108192
108204
|
* NOTE: we use the forwarder populated promise if this exists
|
|
108193
108205
|
* @returns {Promise<TransactionRequest>}
|
|
108194
108206
|
*/
|
|
108195
|
-
this.getPopulatedTransactionRequest = async (signer) => {
|
|
108207
|
+
this.getPopulatedTransactionRequest = async (signer, gasLimitMultiplier = 1.2) => {
|
|
108208
|
+
var _a;
|
|
108196
108209
|
const txnToPopulate = this.forwarderPopulatedPromise
|
|
108197
108210
|
? await this.forwarderPopulatedPromise
|
|
108198
108211
|
: await this.populateTransactionPromise;
|
|
108199
|
-
|
|
108212
|
+
const signerPopulatedTransaction = await signer.populateTransaction(txnToPopulate);
|
|
108213
|
+
// if gasLimit exists, an Overrides object has been passed or the user has explicitly set
|
|
108214
|
+
// a gasLimit for their transaction prior to execution and so we keep it as is else we apply
|
|
108215
|
+
// a specified or the default (1.2) multiplier on the gas limit.
|
|
108216
|
+
return txnToPopulate.gasLimit
|
|
108217
|
+
? txnToPopulate
|
|
108218
|
+
: {
|
|
108219
|
+
...signerPopulatedTransaction,
|
|
108220
|
+
gasLimit:
|
|
108221
|
+
// @note if gasLimit is null, this function will throw due to
|
|
108222
|
+
// conversion to BigNumber, so we must round this number
|
|
108223
|
+
// we can be more conservative by using Math.ceil instead of Math.round
|
|
108224
|
+
Math.ceil(Number((_a = signerPopulatedTransaction.gasLimit) === null || _a === void 0 ? void 0 : _a.toString()) * gasLimitMultiplier),
|
|
108225
|
+
};
|
|
108200
108226
|
};
|
|
108201
108227
|
/**
|
|
108202
108228
|
* Signs the populated transaction via the provided signer (what you intend on sending to the network).
|
|
@@ -109622,7 +109648,7 @@ exports.networkNameToChainIdMap = new Map(metadata_1.default.networks.map((x) =>
|
|
|
109622
109648
|
|
|
109623
109649
|
},{"./defaultSubgraphReleaseTag.json":609,"@superfluid-finance/metadata":255}],609:[function(require,module,exports){
|
|
109624
109650
|
module.exports={
|
|
109625
|
-
"value": "
|
|
109651
|
+
"value": "dev"
|
|
109626
109652
|
}
|
|
109627
109653
|
},{}],610:[function(require,module,exports){
|
|
109628
109654
|
"use strict";
|
package/dist/main/Operation.d.ts
CHANGED
|
@@ -14,16 +14,17 @@ export default class Operation {
|
|
|
14
14
|
* Executes the operation via the provided signer.
|
|
15
15
|
* @description Populates all fields of the transaction, signs it and sends it to the network.
|
|
16
16
|
* @param signer The signer of the transaction
|
|
17
|
+
* @param gasLimitMultiplier A multiplier to provide gasLimit buffer on top of the estimated gas limit (1.2x is the default)
|
|
17
18
|
* @returns {ethers.providers.TransactionResponse} A TransactionResponse object which can be awaited
|
|
18
19
|
*/
|
|
19
|
-
exec: (signer: ethers.Signer) => Promise<ethers.providers.TransactionResponse>;
|
|
20
|
+
exec: (signer: ethers.Signer, gasLimitMultiplier?: number) => Promise<ethers.providers.TransactionResponse>;
|
|
20
21
|
/**
|
|
21
22
|
* Get the populated transaction by awaiting `populateTransactionPromise`.
|
|
22
23
|
* @description Note that we need to populate the txn with the signer.
|
|
23
24
|
* NOTE: we use the forwarder populated promise if this exists
|
|
24
25
|
* @returns {Promise<TransactionRequest>}
|
|
25
26
|
*/
|
|
26
|
-
getPopulatedTransactionRequest: (signer: ethers.Signer) => Promise<TransactionRequest>;
|
|
27
|
+
getPopulatedTransactionRequest: (signer: ethers.Signer, gasLimitMultiplier?: number) => Promise<TransactionRequest>;
|
|
27
28
|
/**
|
|
28
29
|
* Signs the populated transaction via the provided signer (what you intend on sending to the network).
|
|
29
30
|
* @param signer The signer of the transaction
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../src/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,oBAAY,aAAa,GACnB,aAAa,GACb,eAAe,GACf,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,2BAA2B,GAC3B,iBAAiB,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC1E,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAI7B,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;gBAGtE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,EACzC,IAAI,EAAE,aAAa,EACnB,yBAAyB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC;IAOpE
|
|
1
|
+
{"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../src/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,oBAAY,aAAa,GACnB,aAAa,GACb,eAAe,GACf,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,2BAA2B,GAC3B,iBAAiB,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC1E,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAI7B,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;gBAGtE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,EACzC,IAAI,EAAE,aAAa,EACnB,yBAAyB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC;IAOpE;;;;;;OAMG;IACH,IAAI,WACQ,OAAO,MAAM,kCAEtB,QAAQ,OAAO,SAAS,CAAC,mBAAmB,CAAC,CAM9C;IAEF;;;;;OAKG;IACH,8BAA8B,WAClB,OAAO,MAAM,kCAEtB,QAAQ,kBAAkB,CAAC,CAyB5B;IACF;;;;OAIG;IACH,oBAAoB,WAAkB,OAAO,MAAM,KAAG,QAAQ,MAAM,CAAC,CAMnE;IAEF;;;;;OAKG;IACH,kBAAkB,WAAkB,OAAO,MAAM,KAAG,QAAQ,MAAM,CAAC,CAGjE;CACL"}
|
package/dist/main/Operation.js
CHANGED
|
@@ -11,10 +11,11 @@ class Operation {
|
|
|
11
11
|
* Executes the operation via the provided signer.
|
|
12
12
|
* @description Populates all fields of the transaction, signs it and sends it to the network.
|
|
13
13
|
* @param signer The signer of the transaction
|
|
14
|
+
* @param gasLimitMultiplier A multiplier to provide gasLimit buffer on top of the estimated gas limit (1.2x is the default)
|
|
14
15
|
* @returns {ethers.providers.TransactionResponse} A TransactionResponse object which can be awaited
|
|
15
16
|
*/
|
|
16
|
-
this.exec = async (signer) => {
|
|
17
|
-
const populatedTransaction = await this.getPopulatedTransactionRequest(signer);
|
|
17
|
+
this.exec = async (signer, gasLimitMultiplier = 1.2) => {
|
|
18
|
+
const populatedTransaction = await this.getPopulatedTransactionRequest(signer, gasLimitMultiplier);
|
|
18
19
|
return await signer.sendTransaction(populatedTransaction);
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
@@ -23,11 +24,25 @@ class Operation {
|
|
|
23
24
|
* NOTE: we use the forwarder populated promise if this exists
|
|
24
25
|
* @returns {Promise<TransactionRequest>}
|
|
25
26
|
*/
|
|
26
|
-
this.getPopulatedTransactionRequest = async (signer) => {
|
|
27
|
+
this.getPopulatedTransactionRequest = async (signer, gasLimitMultiplier = 1.2) => {
|
|
28
|
+
var _a;
|
|
27
29
|
const txnToPopulate = this.forwarderPopulatedPromise
|
|
28
30
|
? await this.forwarderPopulatedPromise
|
|
29
31
|
: await this.populateTransactionPromise;
|
|
30
|
-
|
|
32
|
+
const signerPopulatedTransaction = await signer.populateTransaction(txnToPopulate);
|
|
33
|
+
// if gasLimit exists, an Overrides object has been passed or the user has explicitly set
|
|
34
|
+
// a gasLimit for their transaction prior to execution and so we keep it as is else we apply
|
|
35
|
+
// a specified or the default (1.2) multiplier on the gas limit.
|
|
36
|
+
return txnToPopulate.gasLimit
|
|
37
|
+
? txnToPopulate
|
|
38
|
+
: {
|
|
39
|
+
...signerPopulatedTransaction,
|
|
40
|
+
gasLimit:
|
|
41
|
+
// @note if gasLimit is null, this function will throw due to
|
|
42
|
+
// conversion to BigNumber, so we must round this number
|
|
43
|
+
// we can be more conservative by using Math.ceil instead of Math.round
|
|
44
|
+
Math.ceil(Number((_a = signerPopulatedTransaction.gasLimit) === null || _a === void 0 ? void 0 : _a.toString()) * gasLimitMultiplier),
|
|
45
|
+
};
|
|
31
46
|
};
|
|
32
47
|
/**
|
|
33
48
|
* Signs the populated transaction via the provided signer (what you intend on sending to the network).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.js","sourceRoot":"","sources":["../../src/Operation.ts"],"names":[],"mappings":";;AACA,mCAAgC;AAWhC;;;GAGG;AACH,MAAqB,SAAS;I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,oBAAoB,GAAG,MAAM,IAAI,CAAC,8BAA8B,CAClE,MAAM,CACT,CAAC;YACF,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC;YACrE,OAAO,SAAS,CAAC;QACrB,CAAC,CAAC;QAEF;;;;;WAKG;QACH,uBAAkB,GAAG,KAAK,EAAE,MAAqB,EAAmB,EAAE;YAClE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAC1D,OAAO,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC,CAAC;QAhFE,IAAI,CAAC,0BAA0B,GAAG,GAAG,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,yBAAyB,GAAG,yBAAyB,CAAC;IAC/D,CAAC;CA8EJ;AA9FD,4BA8FC"}
|
|
@@ -14,16 +14,17 @@ export default class Operation {
|
|
|
14
14
|
* Executes the operation via the provided signer.
|
|
15
15
|
* @description Populates all fields of the transaction, signs it and sends it to the network.
|
|
16
16
|
* @param signer The signer of the transaction
|
|
17
|
+
* @param gasLimitMultiplier A multiplier to provide gasLimit buffer on top of the estimated gas limit (1.2x is the default)
|
|
17
18
|
* @returns {ethers.providers.TransactionResponse} A TransactionResponse object which can be awaited
|
|
18
19
|
*/
|
|
19
|
-
exec: (signer: ethers.Signer) => Promise<ethers.providers.TransactionResponse>;
|
|
20
|
+
exec: (signer: ethers.Signer, gasLimitMultiplier?: number) => Promise<ethers.providers.TransactionResponse>;
|
|
20
21
|
/**
|
|
21
22
|
* Get the populated transaction by awaiting `populateTransactionPromise`.
|
|
22
23
|
* @description Note that we need to populate the txn with the signer.
|
|
23
24
|
* NOTE: we use the forwarder populated promise if this exists
|
|
24
25
|
* @returns {Promise<TransactionRequest>}
|
|
25
26
|
*/
|
|
26
|
-
getPopulatedTransactionRequest: (signer: ethers.Signer) => Promise<TransactionRequest>;
|
|
27
|
+
getPopulatedTransactionRequest: (signer: ethers.Signer, gasLimitMultiplier?: number) => Promise<TransactionRequest>;
|
|
27
28
|
/**
|
|
28
29
|
* Signs the populated transaction via the provided signer (what you intend on sending to the network).
|
|
29
30
|
* @param signer The signer of the transaction
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../src/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,oBAAY,aAAa,GACnB,aAAa,GACb,eAAe,GACf,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,2BAA2B,GAC3B,iBAAiB,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC1E,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAI7B,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;gBAGtE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,EACzC,IAAI,EAAE,aAAa,EACnB,yBAAyB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC;IAOpE
|
|
1
|
+
{"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../src/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,oBAAY,aAAa,GACnB,aAAa,GACb,eAAe,GACf,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,2BAA2B,GAC3B,iBAAiB,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC1E,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAI7B,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;gBAGtE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,EACzC,IAAI,EAAE,aAAa,EACnB,yBAAyB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC;IAOpE;;;;;;OAMG;IACH,IAAI,WACQ,OAAO,MAAM,kCAEtB,QAAQ,OAAO,SAAS,CAAC,mBAAmB,CAAC,CAM9C;IAEF;;;;;OAKG;IACH,8BAA8B,WAClB,OAAO,MAAM,kCAEtB,QAAQ,kBAAkB,CAAC,CAyB5B;IACF;;;;OAIG;IACH,oBAAoB,WAAkB,OAAO,MAAM,KAAG,QAAQ,MAAM,CAAC,CAMnE;IAEF;;;;;OAKG;IACH,kBAAkB,WAAkB,OAAO,MAAM,KAAG,QAAQ,MAAM,CAAC,CAGjE;CACL"}
|
package/dist/module/Operation.js
CHANGED
|
@@ -9,10 +9,11 @@ export default class Operation {
|
|
|
9
9
|
* Executes the operation via the provided signer.
|
|
10
10
|
* @description Populates all fields of the transaction, signs it and sends it to the network.
|
|
11
11
|
* @param signer The signer of the transaction
|
|
12
|
+
* @param gasLimitMultiplier A multiplier to provide gasLimit buffer on top of the estimated gas limit (1.2x is the default)
|
|
12
13
|
* @returns {ethers.providers.TransactionResponse} A TransactionResponse object which can be awaited
|
|
13
14
|
*/
|
|
14
|
-
this.exec = async (signer) => {
|
|
15
|
-
const populatedTransaction = await this.getPopulatedTransactionRequest(signer);
|
|
15
|
+
this.exec = async (signer, gasLimitMultiplier = 1.2) => {
|
|
16
|
+
const populatedTransaction = await this.getPopulatedTransactionRequest(signer, gasLimitMultiplier);
|
|
16
17
|
return await signer.sendTransaction(populatedTransaction);
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
@@ -21,11 +22,25 @@ export default class Operation {
|
|
|
21
22
|
* NOTE: we use the forwarder populated promise if this exists
|
|
22
23
|
* @returns {Promise<TransactionRequest>}
|
|
23
24
|
*/
|
|
24
|
-
this.getPopulatedTransactionRequest = async (signer) => {
|
|
25
|
+
this.getPopulatedTransactionRequest = async (signer, gasLimitMultiplier = 1.2) => {
|
|
26
|
+
var _a;
|
|
25
27
|
const txnToPopulate = this.forwarderPopulatedPromise
|
|
26
28
|
? await this.forwarderPopulatedPromise
|
|
27
29
|
: await this.populateTransactionPromise;
|
|
28
|
-
|
|
30
|
+
const signerPopulatedTransaction = await signer.populateTransaction(txnToPopulate);
|
|
31
|
+
// if gasLimit exists, an Overrides object has been passed or the user has explicitly set
|
|
32
|
+
// a gasLimit for their transaction prior to execution and so we keep it as is else we apply
|
|
33
|
+
// a specified or the default (1.2) multiplier on the gas limit.
|
|
34
|
+
return txnToPopulate.gasLimit
|
|
35
|
+
? txnToPopulate
|
|
36
|
+
: {
|
|
37
|
+
...signerPopulatedTransaction,
|
|
38
|
+
gasLimit:
|
|
39
|
+
// @note if gasLimit is null, this function will throw due to
|
|
40
|
+
// conversion to BigNumber, so we must round this number
|
|
41
|
+
// we can be more conservative by using Math.ceil instead of Math.round
|
|
42
|
+
Math.ceil(Number((_a = signerPopulatedTransaction.gasLimit) === null || _a === void 0 ? void 0 : _a.toString()) * gasLimitMultiplier),
|
|
43
|
+
};
|
|
29
44
|
};
|
|
30
45
|
/**
|
|
31
46
|
* Signs the populated transaction via the provided signer (what you intend on sending to the network).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.js","sourceRoot":"","sources":["../../src/Operation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWhC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,S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BAAoB,GAAG,KAAK,EAAE,MAAqB,EAAmB,EAAE;YACpE,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAC,8BAA8B,CAClE,MAAM,CACT,CAAC;YACF,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC;YACrE,OAAO,SAAS,CAAC;QACrB,CAAC,CAAC;QAEF;;;;;WAKG;QACH,uBAAkB,GAAG,KAAK,EAAE,MAAqB,EAAmB,EAAE;YAClE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAC1D,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC,CAAC;QAhFE,IAAI,CAAC,0BAA0B,GAAG,GAAG,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,yBAAyB,GAAG,yBAAyB,CAAC;IAC/D,CAAC;CA8EJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superfluid-finance/sdk-core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8-dev.4039438.0",
|
|
4
4
|
"description": "SDK Core for building with Superfluid Protocol",
|
|
5
5
|
"homepage": "https://github.com/superfluid-finance/protocol-monorepo/tree/dev/packages/sdk-core#readme",
|
|
6
6
|
"repository": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"url": "https://github.com/superfluid-finance/protocol-monorepo/issues"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@superfluid-finance/ethereum-contracts": "1.4.
|
|
58
|
+
"@superfluid-finance/ethereum-contracts": "^1.4.3-dev.4039438.0",
|
|
59
59
|
"@superfluid-finance/metadata": "git+https://github.com/superfluid-finance/metadata.git",
|
|
60
60
|
"browserify": "^17.0.0",
|
|
61
61
|
"graphql-request": "^4.3.0",
|