Skip to content

Commit

Permalink
test: multichain test of auto-stake-it
Browse files Browse the repository at this point in the history
- auto-stake-it transfer tokens to an InterchainAccount and delegates them when received over IBC to a contract controlled account
- includes patches for @cosmjs/stargate, since we are using it to execute IBC transfers from external accounts
- refs: #9042
  • Loading branch information
0xpatrickdev committed Jul 12, 2024
1 parent 84d2192 commit 3d80104
Show file tree
Hide file tree
Showing 7 changed files with 407 additions and 7 deletions.
3 changes: 2 additions & 1 deletion multichain-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"typescript": "^5.3.3"
},
"resolutions": {
"node-fetch": "2.6.12"
"node-fetch": "2.6.12",
"axios": "1.6.7"
},
"ava": {
"extensions": {
Expand Down
44 changes: 44 additions & 0 deletions multichain-testing/patches/axios+1.6.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/node_modules/axios/dist/node/axios.cjs b/node_modules/axios/dist/node/axios.cjs
index 9099d87..7104f6e 100644
--- a/node_modules/axios/dist/node/axios.cjs
+++ b/node_modules/axios/dist/node/axios.cjs
@@ -370,9 +370,9 @@ function merge(/* obj1, obj2, obj3, ... */) {
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
forEach(b, (val, key) => {
if (thisArg && isFunction(val)) {
- a[key] = bind(val, thisArg);
+ Object.defineProperty(a, key, {value: bind(val, thisArg)});
} else {
- a[key] = val;
+ Object.defineProperty(a, key, {value: val});
}
}, {allOwnKeys});
return a;
@@ -403,7 +403,9 @@ const stripBOM = (content) => {
*/
const inherits = (constructor, superConstructor, props, descriptors) => {
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
- constructor.prototype.constructor = constructor;
+ Object.defineProperty(constructor, 'constructor', {
+ value: constructor
+ });
Object.defineProperty(constructor, 'super', {
value: superConstructor.prototype
});
@@ -565,12 +567,14 @@ const isRegExp = kindOfTest('RegExp');

const reduceDescriptors = (obj, reducer) => {
const descriptors = Object.getOwnPropertyDescriptors(obj);
- const reducedDescriptors = {};
+ let reducedDescriptors = {};

forEach(descriptors, (descriptor, name) => {
let ret;
if ((ret = reducer(descriptor, name, obj)) !== false) {
- reducedDescriptors[name] = ret || descriptor;
+ reducedDescriptors = {...reducedDescriptors,
+ [name]: ret || descriptor
+ };
}
});

56 changes: 56 additions & 0 deletions multichain-testing/patches/protobufjs+6.11.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
diff --git a/node_modules/protobufjs/src/util/minimal.js b/node_modules/protobufjs/src/util/minimal.js
index 7f62daa..8d60657 100644
--- a/node_modules/protobufjs/src/util/minimal.js
+++ b/node_modules/protobufjs/src/util/minimal.js
@@ -259,14 +259,9 @@ util.newError = newError;
* @returns {Constructor<Error>} Custom error constructor
*/
function newError(name) {
-
function CustomError(message, properties) {
-
if (!(this instanceof CustomError))
return new CustomError(message, properties);
-
- // Error.call(this, message);
- // ^ just returns a new error instance because the ctor can be called as a function

Object.defineProperty(this, "message", { get: function() { return message; } });

@@ -280,13 +275,31 @@ function newError(name) {
merge(this, properties);
}

- (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;
+ // Create a new object with Error.prototype as its prototype
+ const proto = Object.create(Error.prototype);

- Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } });
+ // Define properties on the prototype
+ Object.defineProperties(proto, {
+ constructor: {
+ value: CustomError,
+ writable: true,
+ configurable: true
+ },
+ name: {
+ get: function() { return name; },
+ configurable: true
+ },
+ toString: {
+ value: function toString() {
+ return this.name + ": " + this.message;
+ },
+ writable: true,
+ configurable: true
+ }
+ });

- CustomError.prototype.toString = function toString() {
- return this.name + ": " + this.message;
- };
+ // Set the prototype of CustomError
+ CustomError.prototype = proto;

return CustomError;
}
Loading

0 comments on commit 3d80104

Please sign in to comment.