Coder Social home page Coder Social logo

xpring-eng / xpring4j Goto Github PK

View Code? Open in Web Editor NEW
28.0 11.0 19.0 3.08 MB

Xpring4j has been deprecated. Instead, use xrpl4j

Home Page: https://github.com/XRPLF/xrpl4j

License: MIT License

Shell 0.08% Java 99.92%
xrp xrp-ledger ripple xpring ilp interledger interledger-protocol sdk java xpring4j

xpring4j's People

Contributors

ameten avatar dependabot-preview[bot] avatar intelliot avatar keefertaylor avatar loisrp avatar mvadari avatar nhartner avatar nkramer44 avatar sappenin avatar stormtv avatar tedkalaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xpring4j's Issues

Send XRP with DestinationTag response "TransactionResult":"tecDST_TAG_NEEDED"

myCode

String MAIN_RPC_URL = "main.xrp.xpring.io:50051";
String PUBLIC_KEY = "";
String PRIVATE_KEY = "";
XrpClient xrpClient = new XrpClient(MAIN_RPC_URL, XrplNetwork.MAIN);
        
        String address = "classicAddress";
        String tag = "123456";
        BigDecimal amount = new BigDecimal("1");

        Wallet wallet = Wallet.walletFromKeys(PUBLIC_KEY,PRIVATE_KEY, false);
        ClassicAddress classicAddress = ImmutableClassicAddress.builder()
            .address(address)
            .tag(Integer.valueOf(tag))
            .isTest(false)
            .build();
        String transactionHash = xrpClient
            .send(toBigInteger(amount), Utils.encodeXAddress(classicAddress), wallet);

The code successfully returns the transaction hash, but when I query this hash, I find that it fails, Did not submit the DestinationTag,this is the URL:

https://livenet.xrpl.org/transactions/F8081122E463152D13DA5163A905D017D414D30665FC764CB854A743E548F115


我在瑞波区块链浏览器查询,该交易广播失败了,原因是收放的地址必须要求填入DestinationTag,但是我在代码里面有带上 tag,在浏览器查询的详情里面发现没有带上 tag,请修复下这个问题,这是浏览器查询地址
https://livenet.xrpl.org/transactions/F8081122E463152D13DA5163A905D017D414D30665FC764CB854A743E548F115

Properly shutdown gRPC Channels

ERROR [2020-02-09 01:31:44,766] io.grpc.internal.ManagedChannelOrphanWrapper: *~*~*~ Channel ManagedChannelImpl{logId=25, target=grpc.xpring.tech:80} was not shutdown properly!!! ~*~*~*
    Make sure to call shutdown()/shutdownNow() and wait until awaitTermination() returns true.
! java.lang.RuntimeException: ManagedChannel allocation site
! at io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.<init>(ManagedChannelOrphanWrapper.java:94)
! at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:52)
! at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:43)
! at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:524)
! at io.xpring.xrpl.DefaultXpringClient.<init>(DefaultXpringClient.java:39)
! at io.xpring.xrpl.XpringClient.<init>(XpringClient.java:17)

Can't get artifacts from maven

I've setup my username and a Personal Acces Token (PAT) in ~/.m2/settings.xml as described here:

https://help.github.com/en/articles/configuring-apache-maven-for-use-with-github-package-registry#authenticating-to-github-package-registry

And have added the repository, as per the README, to my project's pom.xml..

<repositories>
  <repository>
    <id>github</id>
    <name>GitHub xpring-eng Apache Maven Packages</name>
    <url>https://maven.pkg.github.com/xpring-eng</url>
  </repository>
</repositories>

Yet I'm still unable to retrieve the artifacts from the repo, using this dependency in the pom.

<dependency>
  <groupId>io.xpring</groupId>
  <artifactId>xpring4j</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

I keep getting (variations of):

"Could not find artifact io.xpring:xpring4j:jar:1.0 in central (https://repo1.maven.org/maven2)"

I've tried disabling the central repo, granting more access rights to the PAT, changing the version (1.0, 1.0-SNAPSHOT) but nothing seems to work.

What am I doing wrong? What am I missing?

parsePayID returns a deprecated type

PayIDUtils method parsePayID returns a deprecated type:

PayIDComponents parsedPayID = PayIDUtils.parsePayID(inValidPayID);

Should PayIDUtils be moved to an idiomatically cased class?

Unable to use in a multi threaded environment

When using the API in multiple threads, an exception is thrown.
Example code:

        Wallet fromSeedWallet = new Wallet("qwertyuiop123", true); // qwertyuiop123 > enter seed.

Throws this exception when used in multiple threads like e.g. batch jobs.

java.lang.IllegalStateException: Multi threaded access requested by thread Thread[scheduler_Worker-2,5,main] but is not allowed for language(s) js.
	at com.oracle.truffle.polyglot.PolyglotEngineException.illegalState(PolyglotEngineException.java:132) ~[truffle-api-20.2.0.jar:na]
	at com.oracle.truffle.polyglot.PolyglotContextImpl.throwDeniedThreadAccess(PolyglotContextImpl.java:660) ~[truffle-api-20.2.0.jar:na]
	at com.oracle.truffle.polyglot.PolyglotContextImpl.checkAllThreadAccesses(PolyglotContextImpl.java:563) ~[truffle-api-20.2.0.jar:na]
	at com.oracle.truffle.polyglot.PolyglotContextImpl.enterThreadChanged(PolyglotContextImpl.java:490) ~[truffle-api-20.2.0.jar:na]
	at com.oracle.truffle.polyglot.PolyglotEngineImpl.enter(PolyglotEngineImpl.java:1599) ~[truffle-api-20.2.0.jar:na]
	at com.oracle.truffle.polyglot.HostToGuestRootNode.execute(HostToGuestRootNode.java:89) ~[truffle-api-20.2.0.jar:na]
	at com.oracle.truffle.api.impl.DefaultCallTarget.call(DefaultCallTarget.java:99) ~[truffle-api-20.2.0.jar:na]
	at com.oracle.truffle.api.impl.DefaultRuntimeAccessor$DefaultRuntimeSupport.callProfiled(DefaultRuntimeAccessor.java:131) ~[truffle-api-20.2.0.jar:na]
	at com.oracle.truffle.polyglot.PolyglotValue$InteropValue.invoke(PolyglotValue.java:2809) ~[truffle-api-20.2.0.jar:na]
	at org.graalvm.polyglot.Value.invokeMember(Value.java:549) ~[graal-sdk-20.2.0.jar:na]
	at io.xpring.xrpl.javascript.JavaScriptWalletFactory.walletFromSeed(JavaScriptWalletFactory.java:85) ~[xpring4j-6.1.1.jar:na]
	at io.xpring.xrpl.Wallet.<init>(Wallet.java:35) ~[xpring4j-6.1.1.jar:na]

Android device compatibility

Hi folks, it seems the SDK currently requires android api v.26+.
Do you know if it would be possible to extend it to 21 to support more devices?

Thank you!

Getting Exception in thread "main" java.lang.ExceptionInInitializerError

I am trying to setup a Java Xpring for testing purposes.

`import java.math.BigInteger;
import io.xpring.common.XrplNetwork;
import io.xpring.xrpl.XrpClient;
import io.xpring.xrpl.XrpException;

public class Main {
public static void main(String[] args) {
try {
XrpClient xrpClient = new XrpClient("test.xrp.xpring.io:50051", XrplNetwork.TEST);
String address = "X7u4MQVhU2YxS4P9fWzQjnNuDRUkP3GM6kiVjTjcQgUU3Jr";
BigInteger balance;
balance = xrpClient.getBalance(address);
System.out.println(balance);
} catch (XrpException e) {
e.printStackTrace();
}
}
}`

The above code is taken from the main wiki.

The results:

Exception in thread "main" java.lang.ExceptionInInitializerError at io.xpring.xrpl.javascript.JavaScriptUtils.<init>(JavaScriptUtils.java:26) at io.xpring.xrpl.Utils.<clinit>(Utils.java:20) at io.xpring.xrpl.DefaultXrpClient.getBalance(DefaultXrpClient.java:104) at io.xpring.xrpl.ReliableSubmissionXrpClient.getBalance(ReliableSubmissionXrpClient.java:17) at io.xpring.xrpl.XrpClient.getBalance(XrpClient.java:51) at org.thothtrust.cryptocurrency.xrp.bridge.Main.main(Main.java:15) Caused by: org.graalvm.polyglot.PolyglotException: SyntaxError: Invalid regular expression: /[֑-ۯۺ-ࣿ�?-??-?�-﷿ﹰ-ﻼ]/: Range out of order in character class at <js>.:anonymous(/index.js:22) at <js>.:anonymous(/index.js:22) at <js>.r(/index.js:1) at <js>.:anonymous(/index.js:22) at <js>.r(/index.js:1) at <js>.:anonymous(/index.js:22) at <js>.r(/index.js:1) at <js>.:anonymous(/index.js:22) at <js>.r(/index.js:1) at <js>.:anonymous(/index.js:1) at <js>.:anonymous(/index.js:1) at <js>.:anonymous(/index.js:1) at <js>.:program(/index.js:1) at org.graalvm.polyglot.Context.eval(Context.java:345) at io.xpring.xrpl.javascript.JavaScriptLoader.<clinit>(JavaScriptLoader.java:49) ... 6 more

The Maven dependency has been successfully included into the Eclipse IDE java project with Maven just for additional information. The maven dependency seems to be using xpring4j-6.0.2.jar.

Align IlpClient.sendPayment parameters with other SDKs

Currently, the sendPayment API takes the following parameters:

final String destinationPaymentPointer,
final UnsignedLong amount,
final String accountId,
final String bearerToken

These should change to

final UnsignedLong amount,
final String destinationPaymentPointer,
final String senderAccountId,
final String bearerToken

to align parameters across all SDK languages.

getBalance in the readme seem to be incorrect

Hi;
the example for getting balance from a wallet does not seem to be correct.
the 'address' variable is never used.
I assume this:
String address = "rHsMGQEkVNJmpGWs8XUBoTBiAAbwxZN5v3"; BigInteger balance = xpringClient.getBalance(XRPL_ADDRESS);
should be like this:
String address = "rHsMGQEkVNJmpGWs8XUBoTBiAAbwxZN5v3"; BigInteger balance = xpringClient.getBalance(address);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.